mirror of
https://github.com/deepseek-ai/DeepEP.git
synced 2026-11-05 00:47:32 +00:00
[GH-ISSUE #28] test_low_latency.py bandwidth extremely low #29
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#29
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 @Qizhi697 on GitHub (Feb 28, 2025).
Original GitHub issue: https://github.com/deepseek-ai/DeepEP/issues/28
I tested
tests/test_low_latency.pyon 2 nodes with a total of 16 H800 (8 H800 per node) with 400G CX7 connected. I wanted to reproduce the situation whereDispatch #EPandCombine #EPare both16. The test results show that theDispatch + combine bandwidthis normal, but theDispatch bandwidthorCombine bandwidthis extremely low. I would like to ask why this is happening.@LyricZhao commented on GitHub (Feb 28, 2025):
Dispatch + combineuses CUDA event to profile; while the rest tests use CUPTI (PyTorch Kineto profiler, more accuracy at microsecond level), but maybe CUPTI costs more CPU resources so that some ranks maybe launch the send/recv kernel later than other ranks. In your example, rank 8-10 seem launch eariler than other ones (keep waiting for other ranks).You can try to add the
trace_pathto check profiling JSON (align the timeline of all ranks) or switch on/off thebarrier_comm_profiling(add/remove a barrier before launching the kernel) option inbench_kinetoand observe results.If the problem is from CPU, one possible solution is to bind NUMA for CPU cores.
If the problem is not from CPU, try to check whether other processes run on GPU/PCIe/network card/switch/background traffic.
@haswelliris commented on GitHub (Feb 28, 2025):
It appears that the test was conducted in a RoCE network. I recommend checking the following network settings to ensure optimal performance:
NVSHMEM_IB_TRAFFIC_CLASSor set a default DSCP value? These settings are essential for lossless RDMA traffic.@Qizhi697 commented on GitHub (Mar 2, 2025):
I am truly grateful for the help from both developers. I have tried each of your suggestions and made some progress, but I still encountered some unexplained phenomena. I hope to get your assistance.
@haswelliris
1:1.NVSHMEM_IB_TRAFFIC_CLASS, there was no change in bandwidth.PFChas been correctly configured.RoCE v2network.@LyricZhao
By default,
barrier_comm_profilingis switched on, resulting in very low bandwidth in my reproduce. After I turned offbarrier_comm_profiling, the situation improved significantly, and the combined bandwidth was basically normal at42-43GB/s. However, the dispatch bandwidth is still low by about25%and bind NUMA for CPU cores did not make any difference.Additionally, I discovered 4 strange phenomena:
barrier_comm_profiling, both combine and dispatch became much faster. Why do the previousmatrix multiplicationandall_reducesynchronization operations affectdispatch/combine?barrier_comm_profilingis on, the initial fewdispatch/combineoperations are much faster compared to the later ones.barrier_comm_profilingis off, the trace recording starts from combine, resulting in only59dispatch modules (one is missing).barrier_comm_profilingis off, there isalways one dispatchoperation that takes an unusually long time.The experimental data regarding the above phenomena is also provided below for reference. I truly appreciate all the help and support you have provided. Thank you so much for your assistance.
switch onswitch off@LyricZhao commented on GitHub (Mar 3, 2025):
The GPU
all_reduceis used to eliminate the CPU launch overhead, consider two ranks launch the kernel with a huge time gap, the fast rank will wait for the slower one, will may introduce inaccurate timing.But still, if
all_reducekernel execution is too fast and cannot cover the different launch overhead (or the kernel gap betweenall_reduceand later communication kernels) of the dispatch/combine kernel, so we need a GEMM here to make sure the kernel gap is consistent. For example, after the all-reduce is finished (rank 0 and rank 1 have no gap launching the all-reduce), rank 0 costs 1 CPU secs to launch dispatch, rank 1 cost 2 CPU seconds to launch, the rank 1 has to wait rank 0 for another2 - 1secs, which is also not accurate. So if the GEMM is long enough, e.g. 10 secs, then the CPU gap is eliminated.It is not the expected behavior, maybe you can try to do a large GEMM before every run (currently the GEMM and all-reduce is done only before the tests for once). I guess the CPU launching or GPU freq is getting worse during your run. You can align the timeline of different ranks and test.
This is also related to the previous question, dispatch is a natural barrier (just like the all-reduce) for combine. Maybe always only dispatch suffers from the launch gap problem.
I didn't check the code, but I guess it doesn't matter. As the profile table counts for average time. If you are interested in fixing it, please submit a PR.
Similar to above answers, suffering from launching gap.
@LyricZhao commented on GitHub (Mar 3, 2025):
BTW, I also suggest you to test in your model run, as the real cases are also different from the tests. Testing only matters when it is close to the real online scenarios.
@Qizhi697 commented on GitHub (Mar 3, 2025):
When
barrier_comm_profilingis off, only the first dispatch kernel takes a longer time, which might be due to the lack of synchronization between different ranks. After that, thedispatch/combinetimes are quite normal (around 170us).However, when
barrier_comm_profilingis on, I don't understand why alldispatch/combinekernel execution times become extremely long (around 30ms). Do you have any insights on this phenomenon?@LyricZhao commented on GitHub (Mar 3, 2025):
Could you please check the GEMM and all-reduce time in different ranks? e.g. Are they aligned in wall clock?
Or try to remove the GEMM call?
@LyricZhao commented on GitHub (Mar 3, 2025):
And, overall, I think it is an issue only related to testing, maybe not a problem while model running.
@Qizhi697 commented on GitHub (Mar 3, 2025):
I have removed the GEMM above, and having only all-reduce causes the dispatch/combine execution time to be extremely long(around 30ms).
How can we compare the wall clock times of different nodes, given that the system times of the two nodes themselves may differ?
I want to observe the kernel execution purely from the communication perspective. Haha~
@LyricZhao commented on GitHub (Mar 3, 2025):
You can align the end of all-reduce kernels as the same timestamp.
@LyricZhao commented on GitHub (Mar 3, 2025):
In conclusion, I guess it must be related to your GEMM time (different node different time, someone else occuping your node?); NCCL all-reduce issues (network issues? slow traffic for some certain node?); CPU launch issues (CPU of some nodes is slowing down). All you have to do is to find something reliable to align the wall clock, and figure out which rank is slow and the slowing reason.
@LyricZhao commented on GitHub (Mar 3, 2025):
BTW, the low-latency kernels can run on a 8-rank node (no need for two nodes), NVLink is automatically disabled and traffic goes via IBGDA.
@Qizhi697 commented on GitHub (Mar 3, 2025):
I recorded the execution duration of the kernel for
all_reduceand the first dispatch afterall_reduce. In theory, the execution time of thefirst dispatch kernelimmediately followingall_reduceshould be the same. However, I found that there are always some abnormallyslow nodes, and these nodes are notconsistent.The results of my tests on a single machine with 8 GPUs showed no issues.
Since
dispatchis a natural barrier (just like theall-reduce) forcombine, which eliminates the impact of the launch gap, the bandwidth ofcombinestill becomes extremely low after I swtch onall_reduce.@LyricZhao commented on GitHub (Mar 4, 2025):
How about the gap between all-reduce and dispatch? Is CPU launching costing too much?
Anyway, we didn't do anything special for each rank, every rank executes the same code. I strongly suggest you to investigate your cluster network settings carefully.
@MarkLiJing commented on GitHub (Mar 7, 2025):
how to turn off this feature?
@Qizhi697 commented on GitHub (Mar 7, 2025):
@MarkLiJing
github.com/deepseek-ai/DeepEP@1fc40d50f3/tests/test_low_latency.py (L120-L125)By set
barrier_comm_profiling=False@HodBadichi commented on GitHub (Aug 22, 2025):
Following up on the discussion with @Qizhi697: I'm also seeing a ~10ms end-to-end latency despite GEMM , all reduce operations having uniform and fast timings across all ranks. Any ideas on what could be causing this bottleneck or a methodologic way to check it out ?