mirror of
https://github.com/deepseek-ai/DeepEP.git
synced 2026-11-05 00:47:32 +00:00
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#768
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/767
Author: @Dashener2
Created: 9/29/2026
Status: 🔄 Open
Base:
main← Head:fix/comm-handle-null-comm-reuse📝 Commits (1)
f581515fix: reuse PyTorch NCCL comm only when all ranks own one (#726)📊 Changes
2 files changed (+164 additions, -2 deletions)
View changed files
📝
deep_ep/comm/handle.py(+27 -2)➕
tests/comm/test_comm_reuse.py(+137 -0)📄 Description
Fixes #726.
Problem
get_nccl_comm_handle()cached whatever PyTorch's_comm_ptr()returned, including thenull pointer it yields before the group's NCCL communicator is lazily materialized
(eager creation only happens when
init_process_groupreceiveddevice_id=...). Thecached null handle is later dereferenced in C++ — e.g.
ncclTeamWorldreadscomm->nRanks— crashing the rank during buffer construction. This is thevllm serve16/16-rank failure reported in the issue.Root cause
deep_ep/comm/handle.py:The pointer is used without checking that it is non-null. A per-rank
!= 0check wouldnot be enough either: ranks can disagree on
_comm_ptr()(a peer may have materializedits communicator via an earlier point-to-point op, or be on a different current device),
and then some ranks would return early while others enter the group-wide unique-id
exchange below — a hang rather than an error.
Fix
Decide reuse with a group-wide
all_gather_objectso every rank takes the same branch,and fall back to a DeepEP-managed comm when any rank has not materialized its
communicator yet:
The collective is reached unconditionally on the reuse path, so ranks cannot split
between "return PyTorch's comm" and "run the unique-id exchange".
Relationship to #727
#727 addresses the same bug but targets
deep_ep/utils/comm.py, which has since movedto
deep_ep/comm/handle.pyonmain, so it is stale/conflicting. This ports the fix tothe current path.
Testing
tests/comm/test_comm_reuse.pyadds 5 mocked cases:_comm_ptr()is null → fall through to a managed commEP_REUSE_NCCL_COMM=0→ forces a managed comm regardless of pointer stateThe collectives are monkeypatched, so the test needs no GPU. Importing
deep_ep.comm.handlestill requires the host extension to be built, like the rest of thesuite.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.