Skip to content

Avoid unnecessary MoE router host synchronization - #6432

Merged
JF-D merged 1 commit into
NVIDIA:mainfrom
JF-D:jiangfeid/moe_router_async_host_sync
Aug 13, 2026
Merged

Avoid unnecessary MoE router host synchronization#6432
JF-D merged 1 commit into
NVIDIA:mainfrom
JF-D:jiangfeid/moe_router_async_host_sync

Conversation

@JF-D

@JF-D JF-D commented Aug 11, 2026

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

What does this PR do?

Avoids blocking the host after partial MoE router CUDA graph replay when all
token-dispatcher outputs remain on the GPU.

The router path previously recorded and synchronized a CUDA event after every
graph replay. This synchronization is only required when asynchronous D2H
outputs must be consumed by eager host code.

This change:

  • Synchronizes only when a returned dispatcher attribute resides on the CPU.
  • Lazily creates and reuses the D2H completion event.
  • Preserves CUDA ordering through the existing graph-completion event.

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

@JF-D
JF-D requested review from a team as code owners August 11, 2026 06:51
@copy-pr-bot

copy-pr-bot Bot commented Aug 11, 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.

@svcnvidia-nemo-ci
svcnvidia-nemo-ci marked this pull request as draft August 11, 2026 06:51
@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.

@JF-D JF-D added the nemotron label Aug 11, 2026
@JF-D JF-D linked an issue Aug 11, 2026 that may be closed by this pull request
@JF-D
JF-D marked this pull request as ready for review August 11, 2026 06:52
@JF-D
JF-D requested a review from fanshiqing August 11, 2026 06:55
@JF-D
JF-D force-pushed the jiangfeid/moe_router_async_host_sync branch from e4c74fa to dd7d892 Compare August 11, 2026 06:57
@JF-D

JF-D commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

@claude strict-review

@JF-D

JF-D commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test dd7d892

@svcnvidia-nemo-ci svcnvidia-nemo-ci added the Final Review PR is in the "final review" stage label Aug 12, 2026
Partial MoE router CUDA graphs currently block the host after every replay, even when all token-dispatcher outputs remain on the GPU. Synchronize only when a graph output resides on the host, and lazily reuse the D2H completion event. Add unit coverage for both CUDA-only and host-output paths.

Signed-off-by: Jiangfei Duan <jiangfeid@nvidia.com>
@JF-D
JF-D force-pushed the jiangfeid/moe_router_async_host_sync branch from dd7d892 to 3e5fbbf Compare August 12, 2026 15:37
@svcnvidia-nemo-ci svcnvidia-nemo-ci added Approved All necessary approvals have been made and removed Final Review PR is in the "final review" stage labels Aug 12, 2026
@JF-D
JF-D enabled auto-merge August 12, 2026 15:56
@JF-D
JF-D added this pull request to the merge queue Aug 13, 2026
@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/31662952600

Merged via the queue into NVIDIA:main with commit a34880f Aug 13, 2026
92 of 94 checks passed
@JF-D
JF-D deleted the jiangfeid/moe_router_async_host_sync branch August 13, 2026 04:53
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: low nemotron

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] GTP+ParialCG

6 participants