Skip to content

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

Open
YangFei1990 wants to merge 3 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 3 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-mode expert-parallel ranks to process zero received tokens.

  • Accepts null data pointers for zero-element NCCL EP tensor descriptors while retaining validation for non-empty tensors.
  • Adds a distributed eager-mode test covering dispatch, combine, and backward propagation when non-target ranks receive no tokens.

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 tensor descriptor validation only for zero-element tensors, enabling empty eager-mode EP receive buffers.
tests/pytorch/distributed/run_ep.py Adds forward-and-backward coverage for EP routing where all tokens are assigned to one rank and other ranks receive empty tensors.

Reviews (2): Last reviewed commit: "Merge branch 'main' into allow_ep_rank_n..." | Re-trigger Greptile

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