mirror of
https://github.com/deepseek-ai/DeepEP.git
synced 2026-11-05 00:47:32 +00:00
[PR #702] fix(legacy): make IBGDA CQ polling concurrency-safe #717
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#717
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/702
Author: @youchengsong
Created: 7/27/2026
Status: 🔄 Open
Base:
main← Head:fix-legacy-cq-poll📝 Commits (1)
a26db61fix(legacy): make IBGDA CQ polling concurrency-safe📊 Changes
1 file changed (+28 additions, -7 deletions)
View changed files
📝
csrc/kernels/legacy/ibgda_device.cuh(+28 -7)📄 Description
Summary
Make the legacy IBGDA CQ poller safe when multiple callers observe the same
collapsed CQ, and make its 16-bit completion-counter handling wrap-safe.
The change mirrors the core protocol used by NVSHMEM:
interpreting the 16-bit CQE counter;
wait;
atomicMax;Why
The existing helper explicitly retained an exclusive-poller assumption.
Concurrent callers can otherwise continue spinning after another caller has
already advanced the shared consumer, or write an older target over a newer
consumer index. A target sufficiently far ahead can also make a stale
16-bit WQE counter ambiguous across wraparound.
This extends the initial early-return added by #371 with the producer,
concurrent-consumer, wrap reconstruction, and monotonic update checks from
the NVSHMEM implementation.
Scope
This PR only changes CQ polling in
csrc/kernels/legacy/ibgda_device.cuh. It intentionally does not change:Validation
sm_103with CUDA 13.0.88,NVSHMEM 3.7.2, NCCL 2.30.7, and PyTorch 2.11;
bash ./format.sh;git diff --check upstream/main...HEAD;32 GPUs, with the final correctness check at round 18,921 and without the
prior CQ/queue timeout.
The multi-node validation binary also carried the required NVSHMEM 3.7.2 RC
QP-layout compatibility backport, so that result is integration evidence
rather than a current-main single-variable comparison.
Integration note
This patch relies on
cq->prod_idxremaining the monotonic posted frontier.Any async post-send changes, including when stacking with #677, must preserve
that invariant; the producer guard is required to disambiguate 16-bit
counter wraparound.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.