Skip to content

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

Merged
phu0ngng merged 8 commits into
NVIDIA:mainfrom
YangFei1990:allow_ep_rank_no_data
Aug 5, 2026
Merged

[Pytorch] [NCCL EP] Allow zero tokens for an EP rank in eager mode#3276
phu0ngng merged 8 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

Updates expert-parallel eager execution to accept empty tensors with null data pointers.

  • Relaxes the NCCL EP tensor descriptor validation only for zero-element tensors.
  • Adds a distributed eager-mode test covering zero-token receive ranks through dispatch, combine, and backward.
  • 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 Allows null tensor data only when the corresponding NVTETensor contains zero elements.
tests/pytorch/distributed/run_ep.py Adds eager-mode distributed coverage for zero-token receive ranks across forward and backward execution.
3rdparty/nccl-extensions Advances the NCCL extensions submodule revision supporting the updated EP behavior.

Sequence Diagram

sequenceDiagram
  participant Router
  participant Dispatch as EP Dispatch
  participant Rank as Zero-receive EP Rank
  participant Combine as EP Combine
  Router->>Dispatch: Route all tokens to another rank
  Dispatch->>Rank: "Empty tensors (numel = 0, data = null)"
  Rank->>Combine: Empty expert output
  Combine-->>Router: Reconstructed local-token result
  Router->>Rank: Backward gradients
  Rank-->>Router: Completed backward pass
Loading

Reviews (7): Last reviewed commit: "Merge branch 'main' into allow_ep_rank_n..." | 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

@phu0ngng

phu0ngng commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Pipeline 61101023 passed except L1_pytorch_distributed_unittest--B200_8GPU is out of time due to deprecated messages, which is unrelated to this PR.

@phu0ngng
phu0ngng merged commit af1ed44 into NVIDIA:main Aug 5, 2026
9 of 14 checks passed
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