Conversation
Importing deep_ep runs check_nccl_so() and init_jit(), which need the compiled extension and a NCCL install, so the pure-Python helpers under deep_ep/utils/ had no tests that could run on a machine without a GPU. Load those modules directly by path and cover math, semantic and testing.parse_num_bytes. hash_tensor() assumed a contiguous tensor with 4-byte elements and raised for bool, int64, float16 and non-contiguous inputs; normalize through a byte view for other element sizes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Importing
deep_eprunscheck_nccl_so()andinit_jit(), which require the compiledextension and a NCCL install, so the pure-Python helpers under
deep_ep/utils/could notbe tested on a machine without a GPU. While adding those tests,
hash_tensor()turned outto raise for common inputs.
Root cause
deep_ep/utils/math.py:view(torch.int)requires a contiguous tensor with a 4-byte element size. It raises forbool,int64,float16/bfloat16, and for non-contiguous tensors.hash_tensorsis apublic helper under
deep_ep.utils.math, so any caller hashing non-float32 test data hitsthis.
Fix
Load the host modules directly by path so the tests do not import
deep_ep, and makehash_tensordtype/layout agnostic:Testing
No GPU, no CUDA and no compiled extension required:
Verified with
torch 2.8.0+cpuandnumpy 1.26. The added hash test fails against the oldimplementation with
RuntimeError: self.stride(-1) must be 1 to view Long as Int.