mirror of
https://github.com/deepseek-ai/DeepEP.git
synced 2026-11-05 00:47:32 +00:00
[PR #716] perf: reuse HybridEP routing allgather buffer #729
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#729
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?
📋 Pull Request Information
Original PR: https://github.com/deepseek-ai/DeepEP/pull/716
Author: @akoumpa
Created: 8/5/2026
Status: 🔄 Open
Base:
hybrid-ep← Head:akoumpa/perf/reuse-hybridep-routing-gather-buffer📝 Commits (3)
fd14215perf: reuse HybridEP routing gather buffer4a12969test: cover HybridEP allgather buffer reuse1f2c371test: assert HybridEP validation topology📊 Changes
2 files changed (+272 additions, -1 deletions)
View changed files
📝
csrc/hybrid_ep/executor/executor.cu(+5 -1)➕
tests/test_allgather_grad_validation.py(+267 -0)📄 Description
Summary
Reuse HybridEP's preallocated allgather output buffer for the NCCL/inter-node routing-map allgather instead of allocating a temporary CUDA tensor during every dispatch.
The routing map is consumed by metadata preprocessing on the same stream before the next dispatch can reuse the buffer, so its lifetime does not overlap the following collective.
Memory impact
The removed temporary allocation contains the globally gathered routing payload on every rank.
For sparse Boolean routing, the saved allocation per rank is:
For dense
int16routing, it is:For the stress configuration used during validation (
8192tokens/rank,8ranks,256experts, and top-k36), this avoids:Implementation
CustomAllgather::get_output_buffer()as the NCCL allgather output tensor.bool/int16dtype, routing shape, and byte views used for NCCL.Testing
Validation was performed on H100 GPUs using a multi-node DOCA/RDMA build in both of these topologies:
Output and gradient regression
Added
tests/test_allgather_grad_validation.py, which compares the reused-buffer path with the existing allgather behavior.The test covers the Cartesian product of:
This produces 12 cases per topology. Each case validates:
Nonebehavior.All 12 cases passed on both the single-node and two-node topologies.
Full HybridEP reference validation
Ran
tests/test_hybrid_ep.pywith 512 tokens/rank, eight local experts, top-k 8, hidden dimension 1024, and padding multiple 32.The following passed for both BF16 and FP8 on both topologies:
The API-level and kernel-level benchmark loops also completed successfully.
CUDA graph and nonblocking validation
Ran
tests/test_graphed_hybrid_ep.pyacross:All combinations passed on every rank in both topologies.
Harry Zhou's standalone allgather stress test
Thanks to Harry Zhou for providing
test_allgather.py, which was used as an additional correctness and stress test.It was run in both single-node and two-node configurations with its original stress dimensions:
For both dense-index and sparse-Boolean routing:
Thanks again to Harry for the focused test coverage and stress configuration.
Static checks
The new regression test also passed Ruff linting, Ruff formatting, Python bytecode compilation, and repository pre-commit checks.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.