mirror of
https://github.com/deepseek-ai/DeepEP.git
synced 2026-11-05 00:47:32 +00:00
[PR #437] [MERGED] [Feature] Eager RDMA for lower latency, fenceless token delivery #569
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#569
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/437
Author: @Gaojiaqi
Created: 9/29/2025
Status: ✅ Merged
Merged: 9/30/2025
Merged by: @Chaser-wind
Base:
eager-rdma← Head:eager-rdma📝 Commits (4)
ea6f2e0Add RDMA eager library and kernel integration6504341Integrate with python and C++ API0aaa674Update readmede76790Add performance result📊 Changes
15 files changed (+1468 additions, -306 deletions)
View changed files
📝
README.md(+83 -0)📝
csrc/config.hpp(+9 -3)📝
csrc/deep_ep.cpp(+44 -17)📝
csrc/deep_ep.hpp(+10 -4)📝
csrc/kernels/api.cuh(+6 -3)📝
csrc/kernels/configs.cuh(+2 -2)➕
csrc/kernels/eager.cuh(+583 -0)➕
csrc/kernels/eager.h(+52 -0)📝
csrc/kernels/ibgda_device.cuh(+9 -0)📝
csrc/kernels/internode_ll.cu(+477 -211)📝
deep_ep/buffer.py(+25 -13)➕
figures/EP16eager.png(+0 -0)➕
figures/EP32eager.png(+0 -0)📝
tests/test_low_latency.py(+106 -48)📝
tests/utils.py(+62 -5)📄 Description
TL;DR: This feature branch replaces the standard “write-then-atomic ACK” path with an Eager RDMA layout that bundles data and per-token signals into a single
IBV_WR_RDMA_WRITE. It removes the extra RTT latency introduced by atomics on multi-path NICs and enables fine-grained overlap at the receiver. In our tests (Hopper + BlueField-3, multi-path enabled), Eager RDMA reduces latency by up to 20%.Background
DeepEP’s current implementation follows the InfiniBand Architecture Specification and uses a standard acknowledgement sequence on the same QP:
IBV_WR_RDMA_WRITE(data “tokens”).IBV_WR_RDMA_ATOMIC_FETCH_AND_ADDas the confirmation.This guarantees that all tokens posted before the atomic are visible when the atomic is observed.
On modern multi-path capable adapters (e.g., NVIDIA ConnectX-7, BlueField-3) and multi-path fabrics (InfiniBand Adaptive Routing, multi-path Ethernet), the network may reorder the atomic and write packets. To preserve ordering semantics, the stack will refrain from issuing the atomic until all in-flight writes on that QP have completed (i.e., the fence)—effectively injecting one RTT of latency for each atomic that follows writes.
Eager RDMA removes atomics and fences from the critical path by interleaving data and a small “signal” field inside every write WQE. The sender emits a single
IBV_WR_RDMA_WRITEthat carries both payload and signals; the receiver polls those signals directly in device memory to determine readiness. This further enables per-token acknowledgement, receiver can process tokens as soon as they’re ready (fine-grained overlap between intra-node D2D copies and inter-node sending/receiving).Requirements
Ordering Guarantees
On Hopper or newer GPUs, the DMA writes arriving from the RNIC to GPU memory and the memory update order visible to GPU kernels are ordered when all of the following hold:
CU_POINTER_ATTRIBUTE_SYNC_MEMOPSis set viacuPointerSetAttribute(NVSHMEM sets this by default).IBV_ACCESS_RELAXED_ORDERING(By disablingNVSHMEM_IB_ENABLE_RELAXED_ORDERING).Under these conditions, when a full-MTU RDMA write completes, the GPU’s memory view is ordered—i.e., once the last 16-byte signal is updated, the preceding 4080 bytes of data in that MTU tile are also visible.
Layout & Data Path
Sender layout
Each 4096-byte MTU tile is laid out as:
The sender maps its normal memory view to the Eager RDMA view and issues
IBV_WR_RDMA_WRITEWQEs with this layout. Original atomics are replaced by RDMA writes.Receiver progress
Programming Model & APIs
Eager RDMA provides two ways to integrate with existing kernels:
Wrapped load/store APIs (global memory):
If your code uses explicit loads/stores, call the Eager RDMA wrappers to access the interleaved view safely.
In-place TMA view transforms (shared memory):
If your code uses TMA (Tensor Memory Accelerator), use the provided in-place transform to construct/deconstruct the Eager RDMA layout when staging through shared memory.
Performance
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.