mirror of
https://github.com/deepseek-ai/DeepEP.git
synced 2026-11-05 00:47:32 +00:00
[GH-ISSUE #427] low latency dispatch may have correctness issue under heavily imbalanced expert load cases #286
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#286
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 @yifeizhang-c on GitHub (Sep 24, 2025).
Original GitHub issue: https://github.com/deepseek-ai/DeepEP/issues/427
The issue happens on the latest main da6ca24e as well as previous commit 8b0c5944, seems to be a long existing issue.
If we test
test_low_latency.pyon multiple nodes (e.g. 2 nodes, 16 ranks in total) with a largernum_tokensvalue (e.g. 2304) while making expert load heavily imbalanced (e.g. by changing the random scores into the following):
The test might fail at dispatch stage correctness check, e.g.
A more detailed analysis showing in above mentioned cases some inter-node ibgda num_tokens transmissions might have value mismatch, e.g.
This kind of failure often appears as the transmitted
-num_tokens_sent - 1got doubled or tripled in its value on arrival.The above shown case is one of the low_latency dispatch correctness issues that we may encounter. Similar ibgda related transmissions issues may also lead to
recv_xcontent different from expectation.@sphish commented on GitHub (Sep 25, 2025):
I discussed this issue with @yifeizhang-c on WeChat, and we found that the cause is that in cases with a large number of tokens and a highly uneven distribution, a higher
NVSHMEM_IB_QP_DEPTHneeds to be set. I will consider how to make this problem easier to debug.@sphish commented on GitHub (Sep 25, 2025):
Added a related assert. https://github.com/deepseek-ai/DeepEP/pull/430
@yifeizhang-c commented on GitHub (Sep 25, 2025):
Thanks for the clarification! Enhancing the value of
NVSHMEM_QP_DEPTHcan effectively resolve all encountered low latency hanging/illegal memory access/incorrectness cases so far. Also thanks for the new enhancement for checkingNVSHMEM_QP_DEPTH.@yifeizhang-c commented on GitHub (Sep 26, 2025):
Hi @sphish , I would like to double confirm for the safe lower bound of
NVSHMEM_QP_DEPTH, as largeQP_DEPTHmay lead to insufficient memory and cause qp creation failure.Currently, the lower bound is set to be
(num_max_dispatch_tokens_per_rank + 1) * 2. Whether it would be better to set it asnum_max_dispatch_tokens_per_rank + num_ranksas the number of token-sending requests to each experts is at mostnum_max_dispatch_tokens_per_rank, and the number of counts/flag related sync request is at mostnum_ranksper experts?@sphish commented on GitHub (Sep 26, 2025):
@yifeizhang-c Each QP can send at most
num_max_dispatch_tokens_per_rank + 1requests per round (since each expert has its own QP, each QP only sends a single flag).Regarding the
*2, it’s somewhat similar to a double-buffer design — this is because when we enter the current communication round, we cannot guarantee that all requests from the previous round have already been fully sent.For example, using the test case you provided, if we set
num_tokens = 864andqp_depth = 1024, there is still a high probability of reproducing the issue.@yifeizhang-c commented on GitHub (Sep 26, 2025):
Thanks for the clarification!
@robertgshaw2-redhat commented on GitHub (Sep 26, 2025):
Would this issue manifest as a hang in the dispatch?
I'm getting a hang in multi-node case on B200
I upped the
NVSHMEM_QP_DEPTHto 8192note: this issue occurs on the most recent tagged release
@robertgshaw2-redhat commented on GitHub (Sep 26, 2025):
apologies, I realized the other node is actually hung in cutlass MLA --- this is not due to the deepep.
@aahouzi commented on GitHub (Oct 3, 2025):
@yifeizhang-c @sphish I noticed that even after your fix for NVSHMEM_QP_DEPTH, I still have corectness issues as I noticed it never works for number of tokens larger than 512:
@sphish commented on GitHub (Oct 10, 2025):
@aahouzi This is caused by
round_scale.round_scalewill introduce relatively large error. In our test script, we set an upper bound for our commonly used test cased, but this may not be suitable for largenum_tokens. If you don't useround_scale, you can disable theround_scaletest.@gangxie112 commented on GitHub (Oct 11, 2025):
@sphish Hi, could this issue exist in normal kernel?