mirror of
https://github.com/deepseek-ai/DeepEP.git
synced 2026-11-05 00:47:32 +00:00
[PR #791] Make symmetric-window ordering configurable: opt into relaxed ordering to recover ~6x hybrid inter-node EP bandwidth #788
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#788
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/791
Author: @sssssakuraaaaa
Created: 10/23/2026
Status: 🔄 Open
Base:
main← Head:fix/relax-symmetric-window-ordering📝 Commits (1)
863328cMake symmetric-window ordering configurable (EP_RELAXED_WIN_ORDERING)📊 Changes
1 file changed (+14 additions, -1 deletions)
View changed files
📝
csrc/kernels/comm/context.cpp(+14 -1)📄 Description
TL;DR
The main symmetric window is registered with
NCCL_WIN_STRICT_ORDERING(
csrc/kernels/comm/context.cpp). On hybrid inter-node EP this costs ~6xdispatch/combine bandwidth. The strict flag was added in #674 to fix the ordering
hazard in #661, but that hazard only bites when PCIe native atomics
(
PCI_ATOMIC_MODE=4) are combined with relaxed ordering. This PR keeps strict as thedefault and adds an opt-in (
EP_RELAXED_WIN_ORDERING=1) to restore the fastNCCL_WIN_DEFAULTpath on platforms where relaxed ordering is safe.Background: two optimizations that are each fine alone
DeepEP's inter-node path leans on two independent hardware optimizations:
write; RO lets posted writes land out of order, saturates PCIe bandwidth and reduces
head-of-line blocking. This is why the window was originally registered with
NCCL_WIN_DEFAULT(RO on).PCI_ATOMIC_MODE=4). dispatch/combinesignal progress with a large number of per-
channel×rankRDMA atomics. Mode 4 usesthe PCIe-native AtomicOp (hardware-offloaded, high throughput); mode 0 falls back to a
slower NIC RMW ext-atomic, so the README recommends mode 4.
The hazard (#661) and the fix (#674)
Used together, they create a data-ordering risk (see #661):
warp polls the tail, reads the recv buffer, and gets stale / not-yet-landed data →
silent data corruption (critical in training).
#674 fixed this by switching the window to
NCCL_WIN_STRICT_ORDERING, which maps toNCCL_NET_MR_FLAG_FORCE_SOand disablesIBV_ACCESS_RELAXED_ORDERINGat MR registration.That is correct, but heavy-handed: it serializes all RDMA writes to the window, not just
the signal path.
Cost of the blanket strict ordering
Measured on B300 + NCCL 2.32.3 + CUDA 13.0, EP16 (2 nodes × 8 GPU) hybrid,
num_sms=32,EP_OVERRIDE_RDMA_SL=162, token=4096:NCCL_WIN_STRICT_ORDERING(current): dispatch SO 23 GB/s, 2745 us; combine SO ~28 GB/sNCCL_WIN_DEFAULT: dispatch SO 130 GB/s, 469 us; combine SO 124 GB/sFull token sweep with DEFAULT (1024→16384) gives dispatch SO 82/101/129/152/168 GB/s, on par
with v2.0.0; the strict build stays ~23 GB/s across the sweep. The regression is independent
of SM count — it is a memory-ordering/PCIe limit, not a compute one, so raising
num_smsdoes not help.
This PR
The #661 hazard is specific to the RO + PCIe-native-atomic (
PCI_ATOMIC_MODE=4) combination.When PCIe native atomics are not used (e.g.
PCI_ATOMIC_MODE=0), relaxed ordering is bothfaster and, in our testing, correct.
Rather than unconditionally revert #674 (which would re-expose
PCI_ATOMIC_MODE=4users to theoriginal corruption), this PR:
NCCL_WIN_STRICT_ORDERINGas the default (behavior unchanged);NCCL_WIN_DEFAULTviaEP_RELAXED_WIN_ORDERING=1on platformswhere RO is known to be safe (uses the existing
get_envhelper /EP_env convention);NCCL_WIN_GIN_ONLY) untouched.Correctness check
With the relaxed window (
EP_RELAXED_WIN_ORDERING=1,PCI_ATOMIC_MODE=0), rebuilt and ran thefull matrix without
--skip-check: 144 cases (72 fp8 + 72 bf16) all pass, 0 assertion errors /0 mismatches on B300 + NCCL 2.32.3.
Caveats
EP_RELAXED_WIN_ORDERING=1together withPCI_ATOMIC_MODE=4— that is exactlythe combination #661 flagged as unsafe.
PCI_ATOMIC_MODE=0; we cannotguarantee it on every platform / root complex / BIOS, which is why the default stays strict and
this is strictly opt-in.
signal path (so write-before-signal visibility holds even under RO), rather than serializing the
whole window. That is a larger change and out of scope here. Happy to follow up if maintainers
are interested.
IBV_ACCESS_RELAXED_ORDERINGlinkage is from reading NCCL source; not independentlyre-verified at the binary level.
Repro
--allow-hybrid-mode 1)tests/ep/test_ep.py, experts=256, hidden=7168, topk=8, num_sms=32,EP_OVERRIDE_RDMA_SL=162, token sweep🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.