mirror of
https://github.com/deepseek-ai/DeepEP.git
synced 2026-11-05 00:47:32 +00:00
[PR #612] aws-efa: cap auto-QP at 2 on EFA to avoid 128-slot GIN ring overflow #661
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#661
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/612
Author: @dmvevents
Created: 4/24/2026
Status: 🔄 Open
Base:
main← Head:aws-efa-auto-qp-cap📝 Commits (4)
4eddba3aws-efa: cap auto-QP at 2 on EFA to avoid 128-slot GIN ring overflow922a1faaws-efa: add EFA fast path in get_rdma_gbs to fix SM auto-sizing28d1f7faws-efa: raise dispatch kScaleoutUpdateInterval from 6 to 169061859aws-efa: yapf-format the EFA QP-cap notice📊 Changes
3 files changed (+69 additions, -1 deletions)
View changed files
📝
deep_ep/buffers/elastic.py(+38 -0)📝
deep_ep/include/deep_ep/impls/hybrid_dispatch.cuh(+1 -1)📝
deep_ep/utils/envs.py(+30 -0)📄 Description
Summary
Three AWS EFA optimizations for DeepEP V2 (ElasticBuffer / NCCL-Gin
backend). Each commit is independent and safe on non-EFA fabrics —
behavior is unchanged when EFA is not detected. Validated end-to-end
on 2× p5.48xlarge (H100, 16 GPUs total) with real Qwen3-30B-A3B MoE
training via Megatron-LM + NeMo-RL.
Updated 2026-05-05: rebased on top of PR #605 (V2) now that it
has merged to
main. Branch is exactly 3 commits ahead ofmain—no merge conflicts, no redundant commits. Framing of commit
fe20874also updated in light of upstream aws-ofi-nccl fix6e504db(see "Changed urgency framing" below).fe20874deep_ep/buffers/elastic.pynum_allocated_qpsat 2 on EFA (default is 129, wasteful on EFA)0b78333deep_ep/utils/envs.pyget_rdma_gbs()— fixes SM auto-sizing whenibstatis absentc84dcacdeep_ep/include/deep_ep/impls/hybrid_dispatch.cuhkScaleoutUpdateInterval3→16 for 22% D+C latency improvement on EFAChanged urgency framing after aws-ofi-nccl
6e504db(2026-04-24)The original framing of
fe20874called the auto-QP cap a"correctness fix" — without it, EFA would silently hang at first
dispatch because DeepEP's default of 129 QPs overflowed
aws-ofi-nccl's 128-slot GIN ring. That specific crash is now
prevented upstream by
aws/aws-ofi-nccl@6e504db("gin: Size active_put_signal to full sequence number space"), which
sizes the bitset to the full sequence-number space. With that
commit, running unpatched DeepEP V2 on EFA no longer hangs.
However, 129 QPs is still wasteful on EFA (EFA has a much
tighter QP budget per instance than Mellanox). The cap at 2 remains
the correct default for EFA — it's now a
performance/resource-efficiency fix rather than a crash-avoidance
fix. Same code, same patch, more nuanced framing.
Commits
0b78333andc84dcacare unaffected by the aws-ofi-nccl fixBoth are pure DeepEP internals:
0b78333—check_fast_rdma_atomic_support()callsibstatwhich is not installed on EFA instances. Without the EFA fast
path, SM auto-sizing gets a garbage NIC-bandwidth estimate,
leading to a 2× perf regression. aws-ofi-nccl does not touch this
code path.
c84dcac—kScaleoutUpdateIntervalcontrols how often thehybrid_dispatch kernel flushes scaleout state updates. Raising
3→16 reduces sync overhead by 22% on EFA, measured on a 2-node p5
bench. Pure DeepEP kernel tuning; aws-ofi-nccl has no say.
Testing
On EFA
With an AWS EFA-enabled instance (p4d, p5, p5en):
Expected on 2 nodes of p5.48xlarge: no hang, p50 D+C ≈ 740 µs.
On non-EFA (Mellanox IB)
Same command. Behavior is unchanged — the EFA detection gate
(
env.is_efa_efa_device()in commitsfe20874and0b78333)returns False and the original code path runs. Validates that these
commits are safe to merge even for reviewers without EFA access.
Evidence: end-to-end integrated stack
Validated 2026-05-05 on 2× p5.48xlarge H100 EFA with real
Qwen3-30B-A3B MoE training. All three of this PR's commits were
applied on top of vanilla DeepEP
main@b306af0. Training configuredwith Megatron-LM's flex dispatcher + DeepEP V2 ElasticBuffer (V1
shim disabled, V2 native).
Measured outputs (inline, for reviewers without access to our private CI)
NCCL / OFI transport selection (from pod torchrun log):
DeepEP V2 activation (from training driver log):
Training step output (Qwen3-30B-A3B, 128 experts top-8, EP=16,
seq_len=512, micro_bs=2, 3 steps + warmup):
Loss is monotonically decreasing, grad_norm is real and non-zero,
step latency stabilizes after warmup — real training signal, not a
synthetic harness.
EFA counter deltas across the training window (both pods,
summed across 16 rdmap NICs):
≥ 1 GB TX per pod confirms the MoE dispatch/combine traffic went
over EFA RDMA, not a silent NVLink shortcut or CPU fallback.
Microbenchmark (
tests/elastic/test_ep.py)Independent of the end-to-end run, the existing DeepSeek test at
tests/elastic/test_ep.pymeasures p50 D+C ≈ 740 µs on 2-nodep5.48xlarge with these 3 commits applied. Matches the Mellanox-path
performance ceiling reported in the PR #605 merge commit.
Public reproduction repo
A standalone public repo with full multi-stage Dockerfile chain
(FROM
nvcr.io/nvidia/cuda-dl-base), all patches pre-applied, K8smanifest, and the Qwen3 training driver is being prepared at:
https://github.com/antonai-work/nemo-rl-deepep-v2-efa(to bepublished once NeMo-RL + Megatron-LM companion PRs are filed)
Until that repo is public, the 3 patches in this PR can be applied
directly to any DeepEP V2 checkout via
git amfrom the commits atdmvevents/DeepEP-1@aws-efa-auto-qp-cap(this PR's head). Reviewers with EFA access can
git clonethatfork branch,
pip install -e ., and run the test above.Backward compatibility
deep_ep.Buffercall sites: unchanged (this PR onlytouches V2 ElasticBuffer).
commits gate on EFA detection.
num_allocated_qpsfor NCCL-Gin on IB: unchanged(remains 129).
Related
aws/aws-ofi-nccl@6e504db(2026-04-24)as the upstream fix that changed the urgency framing of commit
fe20874.#1206 which
proposed a runtime-tunable ring;
6e504dbis strictly better.support in
_DeepepManager(to be filed shortly) — integratedstack was validated together.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.