mirror of
https://github.com/deepseek-ai/DeepEP.git
synced 2026-11-05 00:47:32 +00:00
[GH-ISSUE #560] Hash Validation in test_low_latency.py #344
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
deepseek-ai/DeepEP#344
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Hizhaoyuan on GitHub (Jan 9, 2026).
Original GitHub issue: https://github.com/deepseek-ai/DeepEP/issues/560
Question: Hash Validation in test_low_latency.py - Dependency on Receive Order?
Observation
In
tests/test_low_latency.py, the test validates received tokens by hashing the entire received buffer for each expert:if dispatch_use_fp8:
hash_value ^= hash_tensor(packed_recv_x[0][i, :num_valid_tokens])
hash_value ^= hash_tensor(packed_recv_x[1][i, :num_valid_tokens])
else:
hash_value ^= hash_tensor(packed_recv_x[i, :num_valid_tokens])
From reading
csrc/kernels/internode_ll.cu, I noticed that the placement of received tokens uses an atomic operation:recv_token_begin_idx = atomicAdd(packed_recv_count + local_expert_idx, num_recv_tokens);Based on this, my understanding is:
atomicAdddetermines where each rank's tokens are placed in the bufferpacked_recv_xacross multiple runsIs my understanding correct? If so, wouldn't hashing the entire buffer be sensitive to this non-deterministic ordering?
Current
Question
Could you clarify:
Suggested Solution (if my understanding is correct)
If the receive order is indeed non-deterministic, we could hash per-rank segments using
packed_recv_layout_range:for j in range(num_ranks):
begin_idx = (recv_layout_range[j] >> 32).item()
count = (recv_layout_range[j] & int_mask).item()
if count > 0:
if dispatch_use_fp8:
hash_value ^= hash_tensor(packed_recv_x[0][i, begin_idx:begin_idx + count])
hash_value ^= hash_tensor(packed_recv_x[1][i, begin_idx:begin_idx + count])
else:
hash_value ^= hash_tensor(packed_recv_x[i, begin_idx:begin_idx + count])This would:
However, I'd appreciate your confirmation on whether this concern is valid before proposing any changes.
Thank you for the excellent work on DeepEP!
@Hizhaoyuan commented on GitHub (Jan 9, 2026):
I've reviewed the
hash_tensorimplementation. The function usessum()which is mathematically order-insensitive (commutative). Closing this issue as the implementation is correct by design.