Skip to content

[TRTLLM-14609][chore] Remove legacy MoE path in TRTLLMGenFusedMoE - #16862

Merged
xxi-nv merged 3 commits into
NVIDIA:mainfrom
xxi-nv:xxi/moe-rm-legacy-trtllmgen
Jul 29, 2026
Merged

[TRTLLM-14609][chore] Remove legacy MoE path in TRTLLMGenFusedMoE#16862
xxi-nv merged 3 commits into
NVIDIA:mainfrom
xxi-nv:xxi/moe-rm-legacy-trtllmgen

Conversation

@xxi-nv

@xxi-nv xxi-nv commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator

Description

For the sake of MoE code health, this PR removes the legacy (pre-ConfigurableMoE) communication construction and forward path from TRTLLMGenFusedMoE.

ConfigurableMoE has been the default MoE path for months (ENABLE_CONFIGURABLE_MOE defaults to "1"), which means the backend-internal communication setup and the backend-internal forward pipeline are no longer reachable in the default flow. Keeping them around costs review time, obscures the real control flow, and makes the upcoming MoE refactor harder.

What is removed (tensorrt_llm/_torch/modules/fused_moe/fused_moe_trtllm_gen.py)

  • The legacy if not without_comm: communication-construction block in __init__. It is replaced by an unconditional minimal initialization, mirroring the CutlassFusedMoE change.
  • select_alltoall_method_type()
  • forward_impl()

Net effect: 5 insertions, 375 deletions in a single file.

What is deliberately preserved

  • The live contract called by ConfigurableMoE / MoEScheduler is untouched: run_moe() and supports_moe_output_in_alltoall_workspace().
  • The without_comm constructor parameter is kept as a vestigial argument for API compatibility.

Test Coverage

Verified on OCI GB200 (1 node, 4 GPUs) with the container pinned by jenkins/current_image_tags.properties, running tests/unittest/_torch/modules/moe/test_moe_module.py filtered to this backend:

Scope Result
test_configurable_moe_single_gpu 56 passed
test_configurable_moe_multi_gpu 76 passed
test_configurable_moe_multi_gpu_eplb 6 passed

138 passed, 0 failed.

PR Checklist

  • PR title follows [JIRA/NVBUG][type] description
  • Commit is signed off (DCO)
  • Tests pass for the affected backend

Dev Engineer Review

  • Updated TRTLLMGenFusedMoE to remove legacy all-to-all communication construction, select_alltoall_method_type(), and forward_impl(), leaving a minimal disabled all-to-all state in __init__ (NotEnabled, workspaces set to None, low-precision combine disabled, and moe_a2a = None).
  • Preserved API compatibility via the without_comm parameter and retained the run_moe() / supports_moe_output_in_alltoall_workspace() contracts.
  • Ensured forward_fake() remains in place with its prior bfloat16/fp4 fake-output behavior for do_finalize modes.
  • Adjusted tensorrt_llm/tools/layer_wise_benchmarks/runner.py to simplify MoE patching during Runner.scaled_from_ctx: removed unittest.mock usage and the CutlassFusedMoE dependency, and now patches only WideEPMoE.select_alltoall_method_type (with proper restoration of load_pretrained_config).
  • Reported OCI GB200 validation for the covered scenarios: 138 passed, 0 failed.

QA Engineer Review

No test changes.

…om TRTLLMGenFusedMoE

ConfigurableMoE has been the default MoE path for months (ENABLE_CONFIGURABLE_MOE defaults to 1); it owns communication via CommunicationFactory and drives compute through backend.run_moe. The TRTLLMGenFusedMoE self-built alltoall workspace/MoeAlltoAll construction and the legacy forward_impl are dead code on that path. Remove them and the now-unused select_alltoall_method_type. The without_comm constructor param is kept (vestigial) so create_moe_backend is untouched; the backend now unconditionally records the not-enabled alltoall state so run_moe internal-alltoall stays off, matching prior without_comm=True behavior. run_moe and the live ConfigurableMoE contract (quantize_input, supports_moe_output_in_alltoall_workspace, forward_fake, enable_alltoall) are unchanged.

Signed-off-by: xxi <xxi@nvidia.com>
@xxi-nv
xxi-nv force-pushed the xxi/moe-rm-legacy-trtllmgen branch from d0214ff to b9c5e8b Compare July 26, 2026 23:44
@xxi-nv
xxi-nv marked this pull request as ready for review July 26, 2026 23:58
@xxi-nv

xxi-nv commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run

@xxi-nv
xxi-nv requested a review from a team as a code owner July 26, 2026 23:58
@xxi-nv
xxi-nv requested review from leslie-fang25 and sunnyqgg July 26, 2026 23:58
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: e8af8c14-1273-4f43-89f2-d5db350e6ab2

📥 Commits

Reviewing files that changed from the base of the PR and between b9c5e8b and 77b5e43.

📒 Files selected for processing (1)
  • tensorrt_llm/tools/layer_wise_benchmarks/runner.py

Walkthrough

The TRTLLMGen fused MoE module now uses disabled all-to-all state, removes its native forward implementation, and retains fake forwarding. Layer-wise benchmarks simplify MoE patching to the WideEPMoE selector.

Changes

TRTLLMGen fused MoE changes

Layer / File(s) Summary
Simplify all-to-all state and routing support
tensorrt_llm/_torch/modules/fused_moe/fused_moe_trtllm_gen.py
Imports and all-to-all initialization are reduced, method selection is removed, and separated-routing support remains.
Remove native forward implementation
tensorrt_llm/_torch/modules/fused_moe/fused_moe_trtllm_gen.py
The native routing, quantization, communication, combination, and reduce-scatter flow is deleted; forward_fake remains.
Simplify benchmark MoE patching
tensorrt_llm/tools/layer_wise_benchmarks/runner.py
Mock and Cutlass-specific patching are removed, leaving a WideEPMoE.select_alltoall_method_type override in scaled_from_ctx.

Estimated code review effort: 4 (Complex) | ~45 minutes

Suggested reviewers: bowenfu

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: removing the legacy MoE path from TRTLLMGenFusedMoE.
Description check ✅ Passed The description follows the template with Description, Test Coverage, and PR Checklist sections and includes concrete test results.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61757 [ run ] triggered by Bot. Commit: b9c5e8b Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61757 [ run ] completed with state SUCCESS. Commit: b9c5e8b
/LLM/main/L0_MergeRequest_PR pipeline #49959 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

@sunnyqgg sunnyqgg 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.

LGTM

@xxi-nv

xxi-nv commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61817 [ run ] triggered by Bot. Commit: b9c5e8b Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61817 [ run ] completed with state FAILURE. Commit: b9c5e8b
/LLM/main/L0_MergeRequest_PR pipeline #50019 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 commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61887 [ run ] triggered by Bot. Commit: b9c5e8b Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61887 [ run ] completed with state SUCCESS. Commit: b9c5e8b
/LLM/main/L0_MergeRequest_PR pipeline #50076 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 commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61895 [ run ] triggered by Bot. Commit: b9c5e8b Link to invocation

@xxi-nv

xxi-nv commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61905 [ run ] triggered by Bot. Commit: 88fef19 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61895 [ run ] completed with state ABORTED. Commit: b9c5e8b

Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61905 [ run ] completed with state FAILURE. Commit: 88fef19
/LLM/main/L0_MergeRequest_PR pipeline #50096 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 commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61930 [ run ] triggered by Bot. Commit: 88fef19 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61930 [ run ] completed with state FAILURE. Commit: 88fef19
/LLM/main/L0_MergeRequest_PR pipeline #50121 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 commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61984 [ run ] triggered by Bot. Commit: 88fef19 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62124 [ run ] completed with state ABORTED. Commit: 77b5e43

Link to invocation

@xxi-nv

xxi-nv commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62191 [ run ] triggered by Bot. Commit: 77b5e43 Link to invocation

@xxi-nv

xxi-nv commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62245 [ run ] triggered by Bot. Commit: 77b5e43 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62191 [ run ] completed with state ABORTED. Commit: 77b5e43

Link to invocation

@xxi-nv

xxi-nv commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62260 [ run ] triggered by Bot. Commit: 77b5e43 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62245 [ run ] completed with state ABORTED. Commit: 77b5e43

Link to invocation

@xxi-nv

xxi-nv commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62269 [ run ] triggered by Bot. Commit: 77b5e43 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62260 [ run ] completed with state ABORTED. Commit: 77b5e43

Link to invocation

@xxi-nv

xxi-nv commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62281 [ run ] triggered by Bot. Commit: 77b5e43 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62269 [ run ] completed with state ABORTED. Commit: 77b5e43

Link to invocation

@xxi-nv

xxi-nv commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62296 [ run ] triggered by Bot. Commit: 77b5e43 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62281 [ run ] completed with state ABORTED. Commit: 77b5e43

Link to invocation

@xxi-nv

xxi-nv commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62307 [ run ] triggered by Bot. Commit: 77b5e43 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62296 [ run ] completed with state ABORTED. Commit: 77b5e43

Link to invocation

@xxi-nv

xxi-nv commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62307 [ run ] completed with state FAILURE. Commit: 77b5e43
/LLM/main/L0_MergeRequest_PR pipeline #50478 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

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62316 [ run ] triggered by Bot. Commit: 77b5e43 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62316 [ run ] completed with state SUCCESS. Commit: 77b5e43
/LLM/main/L0_MergeRequest_PR pipeline #50486 completed with status: 'SUCCESS'

CI Report

Link to invocation

@xxi-nv
xxi-nv merged commit cb44a40 into NVIDIA:main Jul 29, 2026
10 checks passed
@xxi-nv
xxi-nv deleted the xxi/moe-rm-legacy-trtllmgen branch July 29, 2026 00:40
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.

5 participants