Skip to content

[Pytorch] [NCCL EP] Allow zero tokens for an EP rank in eager mode - #3276

Open
YangFei1990 wants to merge 7 commits into
NVIDIA:mainfrom
YangFei1990:allow_ep_rank_no_data
Open

[Pytorch] [NCCL EP] Allow zero tokens for an EP rank in eager mode#3276
YangFei1990 wants to merge 7 commits into
NVIDIA:mainfrom
YangFei1990:allow_ep_rank_no_data

Conversation

@YangFei1990

Copy link
Copy Markdown
Collaborator

Description

For eager mode, there could be case where certain EP ranks do not receive any token, based on the routing strategy. This PR relax the constraint to allow such behavior.

Fixes # (issue)

Type of change

  • Documentation change (change only to the documentation, either a fix or a new content)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Infra/Build change
  • Code refactoring

Checklist:

  • I have read and followed the contributing guidelines
  • The functionality is complete
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Signed-off-by: YangFei1990 <feiw@nvidia.com>
@YangFei1990
YangFei1990 requested a review from phu0ngng July 29, 2026 18:48
@YangFei1990

Copy link
Copy Markdown
Collaborator Author

/te-ci L1

@greptile-apps

greptile-apps Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Allows eager expert-parallel ranks to process zero received tokens.

  • Permits null tensor data pointers when the corresponding tensor has zero elements.
  • Adds eager-mode distributed coverage for forward and backward processing on zero-token ranks.
  • Updates the NCCL extensions submodule revision.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
transformer_engine/common/ep/ep_backend.cpp Relaxes descriptor validation to accept null storage exclusively for zero-element tensors.
tests/pytorch/distributed/run_ep.py Adds eager-mode forward and backward coverage for ranks receiving no routed tokens.
3rdparty/nccl-extensions Updates the NCCL extensions submodule revision used by the EP backend.

Sequence Diagram

sequenceDiagram
  participant Router
  participant Dispatch as EP Dispatch
  participant EmptyRank as Zero-token EP rank
  participant Combine as EP Combine
  Router->>Dispatch: Route all tokens to another rank
  Dispatch->>EmptyRank: Empty receive tensors
  Note over EmptyRank: numel = 0<br/>data pointer may be null
  EmptyRank->>Combine: Empty expert output
  Combine-->>Router: Combined local-token result
Loading

Reviews (6): Last reviewed commit: "update the nccl-ext submodule" | Re-trigger Greptile

@phu0ngng phu0ngng left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hold this PR until the NCCL-EP fix is upstreamed and submodule dependency is bumped.

@YangFei1990

Copy link
Copy Markdown
Collaborator Author

/te-ci L1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants