mirror of
https://github.com/deepseek-ai/DeepEP.git
synced 2026-11-05 00:47:32 +00:00
[PR #720] feat(normal): add optional diagnostic probes for DeepEP normal mode #733
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#733
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/720
Author: @Marsssqqq
Created: 8/10/2026
Status: 🔄 Open
Base:
antgroup-opt← Head:xym/antgroup-opt-normal-deepxtrace📝 Commits (10+)
699d17bfix(build): locate CUDA 13 CCCL headers5867e09feat(deepxtrace): validate and bind normal stats contract4365d77feat(normal): add notify full-kernel duration probesf46f3fffeat(normal): add dispatch final completion probesb10f01dfeat(normal): add dispatch RDMA receive completion probes7ab8aa8feat(normal): add combine logical receive completion probes9572707feat(deepxtrace): make normal diagnosis optional and configurablefd9182afix(buffer): preserve backward-compatible optional defaults5caf04efix(normal): harden optional DeepXTrace integration77977edfix(normal): isolate diagnostics from low-latency APIs📊 Changes
7 files changed (+632 additions, -172 deletions)
View changed files
📝
csrc/deep_ep.cpp(+170 -7)📝
csrc/deep_ep.hpp(+30 -2)📝
csrc/kernels/api.cuh(+23 -2)📝
csrc/kernels/internode.cu(+342 -136)📝
deep_ep/buffer.py(+26 -15)📝
setup.py(+4 -1)📝
tests/test_internode.py(+37 -9)📄 Description
Summary
This PR adds six opt-in cumulative probes to DeepEP's internode Normal dispatch and combine kernels: three full-kernel Notify timers, two Dispatch completion probes, and one Combine logical completion probe. Together they expose rank-arrival and data-path progress evidence without changing existing Normal return values or adding a collective or inter-rank synchronization.
The probes are disabled when their optional tensor arguments are absent.
Motivation
Normal mode is the throughput-oriented path used by MoE training and inference prefill. Its dispatch and combine kernels move larger token sets through inter-node RDMA and intra-node NVLink stages while interacting with upstream computation and scheduling.
An end-to-end slowdown can therefore have different causes: a rank may enter the communication stage late, the RDMA path may slow globally, a subset of gateways or rank pairs may degrade, or progress may stall near the final receive stage. Host-side timing exposes the symptom but cannot identify the device-side stage. This change records evidence at existing synchronization and queue-progress boundaries without adding a new collective to the data path.
Implementation
Normal API and integration contract
The public Normal APIs gain two optional trailing arguments:
normal_dispatch_stats: an opaque bundle of ten cumulativeint64CUDA tensors;normal_combine_stats: an opaque bundle of five cumulativeint64CUDA tensors.The tensors are supplied by the caller and passed through the Python, pybind, C++, and CUDA layers. For example, a caller using the companion DeepXTrace PR can obtain and pass the bundles unchanged:
The Python layer checks only bundle arity. The native layer validates CUDA placement,
int64dtype, expected shapes, and all-or-none enablement for each Notify pair or Completion triplet.The per-launch Notify timer scratch is allocated and managed by the DeepEP runtime. It is not part of either caller-visible bundle.
Notify full-kernel duration
The implementation times three existing coordination kernels:
At kernel entry, thread 0 of every block publishes its
%globaltimervalue to the per-launch timer state. The complemented timestamp andatomicMaxselect the earliest block start. At the epilogue, every block increments the completion counter; the last block records the interval from the earliest block start to the last block completion and increments the cumulative launch count. The timer state is reset on the same runtime stream before the launch.This produces exactly one full-grid duration sample per rank and launch. It intentionally includes the time spent by early blocks waiting for the rest of the coordination grid, which makes cross-rank arrival skew visible to the consumer.
The Notify control flow converges at a common timing epilogue so every launched block contributes to the full-grid completion count. Probe-disabled launches preserve the existing communication and metadata work.
Dispatch completion probes
The Dispatch kernel assigns warps to
kRDMASender,kRDMASenderCoordinator,kRDMAAndNVLForwarder,kForwarderCoordinator, andkNVLReceiversroles. The two probes target the receive-side data-moving roles:dispatch_rdma_recvruns in akRDMAAndNVLForwarderwarp. Each such warp owns one destination NVLink rank, and each active lane tracks one source RDMA rank. After metadata arrives, the lane waits until the acquire-loaded RDMA tail reaches its expected token count and records elapsedclock64()cycles, one sample, and the expected token count. Only the warp targeting destination NVLink rank 0 records, avoiding eight duplicate observations; the resulting source index is a gateway proxy rather than precise source-GPU timing.dispatch_finalruns in akNVLReceiverswarp. Each receiver warp owns one source NVLink rank, while lanes map source RDMA ranks. A lane records only after the last expected token for that logical source completes its TMA store to the output. Combining the lane's source RDMA rank with the warp's source NVLink rank produces the logical global source rank; gathering destination-local vectors yields a dense logical source-by-destination matrix.Combine logical completion probe
The Combine kernel assigns warps to
kNVLSender,kNVLAndRDMAForwarder,kRDMAReceiver, andkCoordinatorroles.combine_logical_recvruns only in thekCoordinatorwarp on the non-forwarder SM. Each active coordinator lane owns one source RDMA rank and reconstructs the eight logical NVLink-source dependencies within that source node from the routing bitmap. The lane derives each logical source's last expected RDMA head and observes the receive tail in the coordinator's existing progress loop. Once the tail passes that head, it records elapsedclock64()cycles, one sample, and the logical source token count.Counter contract
notify_dispatchcached_notify_dispatchcached_notify_combinedispatch_finaldispatch_rdma_recvcombine_logical_recvNotify duration is accumulated in nanoseconds from
%globaltimer. Completion cost is accumulated in device cycles fromclock64(). Each Completion probe also records sample count and token count, allowing a consumer to normalizecost / sample_countwhile retaining traffic volume as context.The counters are monotonic and are not reset by DeepEP. Snapshot ordering, window differencing, distributed aggregation, diagnosis, logging, and artifacts belong to the external diagnostics provider.
CUDA 13 build support
setup.pyalso discovers CUDA 13 CCCL headers when they are installed underCUDA_HOME/include/cccl.Validation
The end-to-end test used two 8-GPU NVIDIA H20-3e nodes (EP16), an asynchronous one-second interval with a one-second collection warm-up, 4,096 tokens, hidden size 4,096, top-k 8, 128 experts, 512 workload warm-up iterations, and 512 measured iterations per phase. The Normal APIs were exercised after initializing NVSHMEM with
low_latency_mode=Trueand explicit NIC-PE mapping across four bonded HCAs. Dispatch alternated between 256 non-cached and 256 cached calls; cached Combine ran for all 512 iterations. Both node launchers and all RDMA pressure processes exited successfully.ok; dense matrices showed only the expected intra-node/inter-node block structurenotify_dispatchandcached_notify_dispatchisolated rank 9; downstream Completion probes remained normal; twopre_stage_arrival_skewincidentscached_notify_combineisolated rank 9; Completion probes remained normal;pre_stage_arrival_skewglobal_data_path_slowdownlocalized_data_path_slowdownfor token-owner ranks0/1/8/9Scope and compatibility
None; existing dispatch/combine return values are unchanged.Companion PR
Configuration, lifecycle, snapshotting, semantic diagnosis, logging, NPZ artifacts, and heatmap rendering are implemented in antgroup/DeepXTrace#17.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.