Skip to content

Inference: Do not route pad/dummy tokens to any expert - #4922

Merged
sidsingh-nvidia merged 9 commits into
NVIDIA:mainfrom
sidsingh-nvidia:siddharth/ep-no-route-pad-tokens
Jul 14, 2026
Merged

Inference: Do not route pad/dummy tokens to any expert#4922
sidsingh-nvidia merged 9 commits into
NVIDIA:mainfrom
sidsingh-nvidia:siddharth/ep-no-route-pad-tokens

Conversation

@sidsingh-nvidia

@sidsingh-nvidia sidsingh-nvidia commented May 21, 2026

Copy link
Copy Markdown
Contributor
  • I, the PR author, have personally reviewed every line of this PR.

What does this PR do ?

Prevents routing of padding / dummy tokens to any of the routed experts. For small decodes, these can end up unnecessarily activating experts. This PR makes it such that only real tokens activate experts. This can help us move away from recording way too many fine grained cuda-graphs.

⚠️ For major changes (either in lines of code or in its impact), please make sure to first share a design doc with the team. If you're unsure what's the best way to do so, contact @NVIDIA/mcore-oncall.

Issue tracking

For PRs from open-source community contributors:

  • New features: a linked issue is required. Please open a feature request and reference it here before submitting the PR.
  • Small updates (bug fixes, minor improvements): a linked issue is recommended and will accelerate the PR review process.

Linked issue:

Contribution process

Pre-checks

  • I have added relevant unit tests
  • I have added relevant functional tests
  • I have added proper typing to my code Typing guidelines
  • I have added relevant documentation
  • I have run the autoformatter.sh on my PR

Code review

Feel free to message or comment @NVIDIA/mcore-oncall to help accelerate your merge into main. The less complex your PR is, the faster it will be approved and merged!

All PRs start as draft. If you open a non-draft PR, it will be automatically converted to draft.

Step 1: Mark PR as "Ready for Review"

  1. When your PR is ready, click Ready for Review.
  2. An oncall reviewer is auto-assigned and expert reviewers are notified based on your changes.
    • Some PRs may jump straight to step 2. This is determined by .github/CODEOWNERS.

⚠️ Only mark as ready once merge-conflicts are resolved and the CI is passing.
Final Review might get declined if these requirements are not fulfilled.

Step 2: Final Review

For PRs that change megatron/core, once all expert reviewers have approved, the Final Review label is applied automatically and final reviewers are assigned.

For PRs outside megatron/core, this step is skipped.

Step 3: Approved

Once all required reviewers have approved, the Approved label is applied automatically.

Merge

Any member of mcore-engineers will be able to merge your PR.

@sidsingh-nvidia
sidsingh-nvidia requested review from a team as code owners May 21, 2026 21:18
@svcnvidia-nemo-ci
svcnvidia-nemo-ci marked this pull request as draft May 21, 2026 21:18
@github-actions

Copy link
Copy Markdown
Contributor

This PR has been automatically converted to draft because all PRs must start as drafts.

When you are ready for review, click Ready for Review to begin the review process. This will:

  1. Add the oncall reviewer (optional reviewer)
  2. Add required review teams based on your changes

See the contribution guide for more details.

@copy-pr-bot

copy-pr-bot Bot commented May 21, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@sidsingh-nvidia

Copy link
Copy Markdown
Contributor Author

/claude review

Comment thread megatron/core/transformer/attention.py Outdated
@sidsingh-nvidia

Copy link
Copy Markdown
Contributor Author

/claude review

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@kvareddy

kvareddy commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

@santhnm2 can you please take a look at this MR?

@copy-pr-bot

copy-pr-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@Phlip79

Phlip79 commented Jul 13, 2026

Copy link
Copy Markdown
Member

@sidsingh-nvidia please fix DCO error

I, Siddharth Singh <sidsingh@nvidia.com>, hereby add my Signed-off-by to this commit: 02a8f52
I, Siddharth Singh <sidsingh@nvidia.com>, hereby add my Signed-off-by to this commit: 7ae32ed

Signed-off-by: Siddharth Singh <sidsingh@nvidia.com>
@sidsingh-nvidia

Copy link
Copy Markdown
Contributor Author

@Phlip79 the suggested rebase commands always end up messing the commit-tree. I am having to do this manually.

@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started!

You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/29313280742

@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started!

You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/29319016188

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

Labels

Approved All necessary approvals have been made complexity: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants