Skip to content

[https://nvbugs/6892493][fix] Support MegaMoE CuteDSL TEP for all models and fix the Kimi-K3 CUDA-graph hang (cherry-pick #20055 + part of #19960) - #20619

Merged
peihu-nv merged 3 commits into
NVIDIA:release/1.3from
peihu-nv:fix/nvbug-6892493-kimi-tep-release-1.3
Oct 23, 2026
Merged

peihu-nv merged 3 commits into
NVIDIA:release/1.3from
peihu-nv:fix/nvbug-6892493-kimi-tep-release-1.3

Conversation

@peihu-nv

@peihu-nv peihu-nv commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Dev Engineer Review

  • MegaMoE CuteDSL accepts broader TEP configurations, including MiniMax, SiTu, and plain SwiGLU activations. MoE tensor parallelism remains rejected.
  • ConfigurableMoE adds a default-false global routed-output opt-in. Opted-in callers can skip their routed all-reduce when the backend returns globally combined output; other callers retain the rank-partial behavior.
  • Kimi-K3 defers the shared-expert all-reduce until routed execution completes. The multi-stream, non-compiled path uses a CUDA event to order the reduction.
  • Strict backend-resolution errors now include candidate rejection details. Fused-communication scheduling also validates per-EP token metadata.
  • Reported CI runs include failures and successes. The latest listed run, #479, succeeded; failure details and the result of any later rerun are unavailable.

QA Engineer Review

  • Modified test files cover shared-expert reduction ordering, MegaMoE eligibility and strict-resolution errors, fused-communication output and token metadata, and MiniMax-M3 routed-output behavior.
  • tests/integration/test_lists/test-db/l0_b300.yml adds CI selectors for singleton token metadata, full-EP indexing, and rejection of partial EP metadata.
  • tests/integration/test_lists/waives.txt removes the waiver for TestKimiK3DSpark::test_gsm8k_tep8. The test remains selected in tests/integration/test_lists/qa/llm_function_core.txt and is listed with TIMEOUT (60) in test-db/l0_gb300_multi_nodes_node2_gpu8.yml.
  • The changed unit-test files have CI selections: test_kimi_k3_mlp.py in l0_h100.yml and l0_b200.yml; test_moe_backend.py in several test-db files, including l0_b300.yml; and test_minimax_m3.py in l0_cpu.yml.
  • Coverage verdict: needs follow-up. CI outcomes are mixed, and the supplied results do not identify failure causes or establish the status of a later rerun.

Per-File QA Perspective

  • tensorrt_llm/_torch/models/modeling_kimi_linear.py — Verify shared-expert reduction ordering for serial, parallel, compiled, and multi-stream execution.
  • tensorrt_llm/_torch/models/modeling_minimaxm3.py — Verify that MiniMax-M3 skips routed reduction only when the MoE reports globally combined output.
  • tensorrt_llm/_torch/moe/fused_moe/configurable_moe.py — Verify the default-false opt-in and backend-dependent global-output contract.
  • tensorrt_llm/_torch/moe/fused_moe/create_moe.py — Verify option forwarding and unchanged behavior for callers that do not opt in.
  • tensorrt_llm/_torch/moe/fused_moe/interface.py — Verify that the new global-output contract defaults to false.
  • tensorrt_llm/_torch/moe/fused_moe/mega_moe/mega_moe_cute_dsl.py — Verify broader TEP acceptance, continued MoE-TP rejection, and the repeated-compute warning.
  • tensorrt_llm/_torch/moe/fused_moe/moe_resolution.py — Verify strict errors include backend rejection details.
  • tensorrt_llm/_torch/moe/fused_moe/moe_scheduler.py — Verify rank-partial versus global output behavior and token-metadata validation.
  • tests/unittest/_torch/moe/test_kimi_k3_mlp.py — Covers shared-expert construction and reduction ordering. The file is selected in l0_h100.yml and l0_b200.yml.
  • tests/unittest/_torch/moe/test_moe_backend.py — Covers backend eligibility, output handling, token metadata, and strict-resolution errors. Selectors appear in several test-db files, including l0_b300.yml.
  • tests/unittest/_torch/models/test_minimax_m3.py — Covers MiniMax-M3 routed-output behavior. The file is selected in l0_cpu.yml.
  • tests/integration/test_lists/test-db/l0_b300.yml — Adds CI entries for singleton, full-EP, and rejected partial token metadata cases.
  • tests/integration/test_lists/waives.txt — Removes the Kimi-K3 accuracy-test waiver; verify the now-unwaived test in the applicable integration run.

Description

This brings two fixes to release/1.3 so Kimi-K3 can run MegaMoE CuteDSL under TEP (attention TP + MoE EP). It fixes https://nvbugs/6892493 and https://nvbugs/6946611.

  1. Part of [None][feat] Kimi K3 optimizations on Rubin #19960: the CUDA-graph hang fix (nvbugs/6946611). With MegaMoE CuteDSL under TEP, the fused kernel does its own cross-rank exchange while the shared-expert all-reduce ran at the same time on the aux stream. That deadlocks during CUDA-graph warmup. The shared-expert all-reduce now waits for the routed MoE (_defer_shared_allreduce), with its unit tests. [None][feat] Kimi K3 optimizations on Rubin #19960 is otherwise a large Rubin optimization PR, so only this ordering change is taken.
  2. Cherry-pick of [https://nvbugs/6892493][fix] Support MegaMoE CuteDSL TEP for all models #20055: MegaMoE CuteDSL TEP for all models (nvbugs/6892493). On release/1.3, MegaMoE CuteDSL allowed TEP only for MiniMax-style models, so Kimi-K3 TEP failed at startup. The fused kernel returns a globally combined routed output. ConfigurableMoE now reports this through returns_global_routed_output, so callers that opt in (Kimi-K3, MiniMax-M3) skip their own all-reduce, and other callers get a rank partial. The TEP gate is removed. Strict MoE resolution errors now include each backend's rejection reason.

The #20055 conflicts came only from main-only fields (unfinalized_combine_fn, supports_routing_aux), which are left out.

Test Coverage

PR Checklist

Please review the following before submitting your PR:

  • PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.

  • PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.

  • Test cases are provided for new code paths (see test instructions)

  • If PR introduces API changes, an appropriate PR label is added - either api-compatible or api-breaking. For api-breaking, include BREAKING in the PR title.

  • Any new dependencies have been scanned for license and vulnerabilities

  • CODEOWNERS updated if ownership changes

  • Documentation updated as needed

  • Update tava architecture diagram if there is a significant design change in PR.

  • The reviewers assigned automatically/manually are appropriate for the PR.

  • Please check this after reviewing the above items as appropriate for this PR.

GitHub Bot Help

To see a list of available CI bot commands, please comment /bot help.

@peihu-nv

Copy link
Copy Markdown
Collaborator Author

/bot run --extra-stage "GB300-8_GPUs-2_Nodes-PyTorch-SingleNvlinkDomain-Post-Merge-1"

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #78995 [ run ] triggered by Bot. Commit: 3ec3da3 Link to invocation

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between cb49e39 and 73fcc67.

📒 Files selected for processing: 2
  • tests/integration/test_lists/test-db/l0_b300.yml
  • tests/integration/test_lists/waives.txt
💤 Files with no reviewable changes: 1
  • tests/integration/test_lists/waives.txt

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.

Walkthrough

The changes define a global routed-output contract for fused-communication MoE backends. The scheduler and model callers use that contract to control routed reductions. The Kimi runtime changes shared-expert all-reduce ordering for a specific MegaMoE configuration. The changes also expand MegaMoE TEP eligibility and token-metadata validation.

Changes

Fused MoE routed-output handling

Layer / File(s) Summary
Define and propagate the routed-output contract
tensorrt_llm/_torch/moe/fused_moe/interface.py, tensorrt_llm/_torch/moe/fused_moe/configurable_moe.py, tensorrt_llm/_torch/moe/fused_moe/create_moe.py, tensorrt_llm/_torch/models/modeling_minimaxm3.py, tests/unittest/_torch/models/test_minimax_m3.py, tests/unittest/_torch/moe/test_moe_backend.py
MoE and ConfigurableMoE expose whether routed output is globally combined. create_moe forwards the option. MiniMax callers and tests use the contract.
Handle fused output and supported topologies
tensorrt_llm/_torch/moe/fused_moe/moe_scheduler.py, tensorrt_llm/_torch/moe/fused_moe/mega_moe/mega_moe_cute_dsl.py, tensorrt_llm/_torch/moe/fused_moe/moe_resolution.py, tests/unittest/_torch/moe/test_moe_backend.py, tests/integration/test_lists/test-db/l0_b300.yml
The fused scheduler handles rank-partial output and validates token metadata. MegaMoE CuteDSL accepts additional TEP configurations and warns about repeated compute. Strict resolution errors include candidate rejection details. Tests and pre-merge lists cover these changes.
Order Kimi shared-expert reduction
tensorrt_llm/_torch/models/modeling_kimi_linear.py, tests/unittest/_torch/moe/test_kimi_k3_mlp.py, tests/integration/test_lists/waives.txt
The Kimi runtime defers shared all-reduce for the specified MegaMoE fused-communication configuration. Tests check event ordering and execution behavior. The Kimi integration skip entry is removed.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant Runtime as KimiK3MoERuntime
  participant Routed as Routed branch
  participant Event as CUDA event
  participant Shared as Shared branch
  Runtime->>Routed: Run routed work
  Routed->>Event: Record completion before norm/up tail
  Shared->>Event: Wait for routed completion
  Shared->>Shared: Perform shared all-reduce
Loading

Possibly related issues

  • NVIDIA/Megatron-LM#8427: The changes extend MegaMoE CuTeDSL TEP support and update Kimi K3 MoE reduction handling.
  • NVIDIA/Megatron-LM#6757: The changes add MegaMoE TEP coverage, which is one of the roadmap objectives described in the issue.

Possibly related PRs

Suggested reviewers: xxi-nv

Merge Risk: ⚪ Minimal · up to 73fcc

The reviewed test-list and waiver updates present no established merge-blocking risk.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 42.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 50 functions across 11 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title follows the required NVBugs and fix format and clearly summarizes both main changes: MegaMoE CuteDSL TEP support and the Kimi-K3 CUDA-graph hang fix.
Description check Passed The description includes the required sections, explains the problem and solution, lists relevant test coverage, and marks the checklist as reviewed.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 42.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 50 functions across 11 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #78995 [ run ] completed with state SUCCESS. Commit: 3ec3da3
/LLM/release-1.3/L0_MergeRequest_PR pipeline #363 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@peihu-nv

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast --extra-stage "GB300-8_GPUs-2_Nodes-PyTorch-SingleNvlinkDomain-Post-Merge-1"

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #79014 [ run ] triggered by Bot. Commit: 3ec3da3 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #79014 [ run ] completed with state FAILURE. Commit: 3ec3da3
/LLM/release-1.3/L0_MergeRequest_PR pipeline #366 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@xxi-nv xxi-nv 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.

Approved based on [B] 6892493: [TensorRT-LLM][release/1.3]: accuracy/test_kimi3.py::TestKimiK3DSpark::test_gsm8k_tep8 got value error

@xxi-nv
xxi-nv requested a review from kaiyux October 19, 2026 23:26
@github-actions

Copy link
Copy Markdown

Automatically added "ci: full pre-merge approved" because this PR has satisfied the required GitHub review approvals. Unresolved review conversations and other required checks remain independent merge requirements.

@peihu-nv

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #79112 [ run ] triggered by Bot. Commit: 3ec3da3 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #79112 [ run ] completed with state FAILURE. Commit: 3ec3da3
/LLM/release-1.3/L0_MergeRequest_PR pipeline #384 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@peihu-nv

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #79197 [ run ] triggered by Bot. Commit: 3ec3da3 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #79197 [ run ] completed with state SUCCESS. Commit: 3ec3da3
/LLM/release-1.3/L0_MergeRequest_PR pipeline #396 completed with status: 'SUCCESS'

CI Report

Link to invocation

@peihu-nv

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast --extra-stage "GB300-8_GPUs-2_Nodes-PyTorch-SingleNvlinkDomain-Post-Merge-1"

@peihu-nv
peihu-nv force-pushed the fix/nvbug-6892493-kimi-tep-release-1.3 branch from 3ec3da3 to c854a3f Compare October 20, 2026 14:13
@peihu-nv

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast --extra-stage "GB300-8_GPUs-2_Nodes-PyTorch-SingleNvlinkDomain-Post-Merge-1"

@peihu-nv
peihu-nv enabled auto-merge (squash) October 20, 2026 14:14
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #79275 [ run ] triggered by Bot. Commit: c854a3f Link to invocation

@peihu-nv

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #79642 [ run ] triggered by Bot. Commit: cb49e39 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #79615 [ run ] completed with state ABORTED. Commit: c854a3f

Link to invocation

@schetlur-nv schetlur-nv 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.

rubber stamp for devs since this is a cherry pick from main

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #79642 [ run ] completed with state SUCCESS. Commit: cb49e39
/LLM/release-1.3/L0_MergeRequest_PR pipeline #466 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@peihu-nv

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #79708 [ run ] triggered by Bot. Commit: cb49e39 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #79708 [ run ] completed with state SUCCESS. Commit: cb49e39
/LLM/release-1.3/L0_MergeRequest_PR pipeline #479 completed with status: 'SUCCESS'

CI Report

Link to invocation

…uce past fused-comm MegaMoE

Backport the shared-expert all-reduce ordering from NVIDIA#19960 (e88d19c)
to release/1.3. With MEGAMOE_CUTEDSL under TEP, the fused-comm kernel runs
its own cross-rank exchange while the shared-expert all-reduce ran
concurrently on the aux stream, which deadlocks at CUDA-graph warmup.
The shared all-reduce now waits for the routed MoE. Only this ordering
change and its unit tests are taken; the rest of NVIDIA#19960 is Rubin
performance work and is not needed on release/1.3.

Signed-off-by: peihengh <259410613+peihu-nv@users.noreply.github.com>
Cherry-pick of NVIDIA#20055 to release/1.3. MegaMoE CuteDSL under TEP (attention
TP + MoE EP) was gated to MiniMax-style models because the fused kernel
returns a globally combined routed output that other model wrappers would
all-reduce again. ConfigurableMoE now exposes returns_global_routed_output,
callers opt in with accepts_global_routed_output, and FusedCommMoEScheduler
hands a rank partial to callers that reduce externally, so the gate is
removed. Kimi-K3 and MiniMax-M3 opt in. Strict MoE resolution failures now
include each candidate's rejection reason. Unwaive the Kimi-K3 DSpark TEP8
accuracy test.

Signed-off-by: peihengh <259410613+peihu-nv@users.noreply.github.com>
…adata in FusedCommMoEScheduler

With MegaMoE CuteDSL now allowed under TEP, a DSpark drafter without
attention DP passes all_rank_num_tokens=[num_tokens]. _strip_adp_padding
treated that as per-EP-rank metadata and indexed it by moe_ep_rank, so
ranks 1+ raised IndexError. Treat a single count as local metadata and
reject lists that do not hold one count per EP rank.

Backport of the FusedCommMoEScheduler fix and tests from NVIDIA#19959.

Signed-off-by: peihengh <259410613+peihu-nv@users.noreply.github.com>
@peihu-nv
peihu-nv force-pushed the fix/nvbug-6892493-kimi-tep-release-1.3 branch from cb49e39 to 73fcc67 Compare October 22, 2026 18:41
@peihu-nv

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #79949 [ run ] triggered by Bot. Commit: 73fcc67 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #79949 [ run ] completed with state FAILURE. Commit: 73fcc67
/LLM/release-1.3/L0_MergeRequest_PR pipeline #509 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@peihu-nv

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80041 [ run ] triggered by Bot. Commit: 73fcc67 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80041 [ run ] completed with state SUCCESS. Commit: 73fcc67
/LLM/release-1.3/L0_MergeRequest_PR pipeline #520 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@peihu-nv

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80177 [ run ] triggered by Bot. Commit: 73fcc67 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80177 [ run ] completed with state SUCCESS. Commit: 73fcc67
/LLM/release-1.3/L0_MergeRequest_PR pipeline #530 completed with status: 'SUCCESS'

CI Report

Link to invocation

@peihu-nv
peihu-nv merged commit 8ddb3ae into NVIDIA:release/1.3 Oct 23, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants