Skip to content

[https://nvbugs/6175060][fix] Fix B300 MegaMoE test selection#14362

Merged
xxi-nv merged 2 commits into
NVIDIA:mainfrom
xxi-nv:dev-xxi-bug6175060-bot
May 21, 2026
Merged

[https://nvbugs/6175060][fix] Fix B300 MegaMoE test selection#14362
xxi-nv merged 2 commits into
NVIDIA:mainfrom
xxi-nv:dev-xxi-bug6175060-bot

Conversation

@xxi-nv

@xxi-nv xxi-nv commented May 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Fix MegaMoEDeepGemm.can_implement() to accept the SM100 family (SM100/SM103), matching the underlying DeepGEMM fp8_fp4_mega_moe architecture gating.
  • Keep DGX_B300 MegaMoEDeepGemm test-list entries instead of removing them.
  • Remove the affected MoE MEGAMOE_DEEPGEMM waives. The source branch did not contain a literal 6175059 waive entry; the matching MoE waives were linked to 6175060 and are removed here.
  • Drop the previous tests/unittest/_torch/visual_gen/test_flux_pipeline.py and tests/unittest/_torch/modules/moe/test_moe_backend.py source changes.

Root Cause

The failing post-merge signal for NVBug 6175059 is the B300 MoE selector:

unittest/_torch/modules/moe/test_moe_module.py::test_configurable_moe_multi_gpu_eplb -k "MEGAMOE_DEEPGEMM"

The failure was caused by B300/SM103 being filtered out by a Python-side sm == 100 gate in MegaMoEDeepGemm.can_implement(), so pytest selectors for MEGAMOE_DEEPGEMM selected zero tests.

DeepGEMM itself handles the SM100 family path: the MegaMoE C++ API dispatches on arch_major == 10, the JIT chooses SM100 family arch for major 10 devices, and the CUDA kernel guard accepts __CUDA_ARCH__ >= 1000. B300 reports SM103.

Validation

  • python3 -m py_compile tensorrt_llm/_torch/modules/fused_moe/mega_moe/mega_moe_deepgemm.py
  • git diff --check
  • B300 YAML parse: 82 tests, 3 MEGAMOE_DEEPGEMM entries
  • B300 probe: device=NVIDIA B300 SXM6 AC, capability=(10, 3), get_sm_version=103, is_sm_100f=True, MegaMoEDeepGemm.can_implement=True
  • B300 collect-only:
    • test_configurable_moe_multi_gpu -k MEGAMOE_DEEPGEMM: 4 collected
    • test_configurable_moe_single_gpu -k MEGAMOE_DEEPGEMM: 28 collected
    • test_configurable_moe_multi_gpu_eplb -k MEGAMOE_DEEPGEMM: 1 collected
  • Pre-commit hooks during amend: passed

One additional single-GPU smoke failed in the non-DeepGEMM reference path because the temporary container's TRT-LLM custom ops were not compiled for B300. That does not affect the can_implement() fix or selector validation.

@xxi-nv
xxi-nv requested review from a team as code owners May 20, 2026 13:04
@xxi-nv
xxi-nv requested a review from yuxianq May 20, 2026 13:04
@coderabbitai

coderabbitai Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR expands MegaMoEDeepGemm backend GPU support from strictly SM100 to the SM100 family (SM100/SM103) using a new helper function, documents the change, adds validation tests, and improves distributed test reliability by adding automatic port-conflict retry logic for multiprocessing worker spawning.

Changes

MegaMoEDeepGemm SM100-family support

Layer / File(s) Summary
Capability check implementation
tensorrt_llm/_torch/modules/fused_moe/mega_moe/mega_moe_deepgemm.py
Import is_sm_100f utility and update MegaMoEDeepGemm.can_implement to accept SM100-family GPUs instead of only SM100, with updated rejection messaging.
Documentation and clarification
tensorrt_llm/_torch/modules/fused_moe/create_moe.py, tensorrt_llm/_torch/modules/fused_moe/MOE_DEVELOPER_GUIDE.md
Update comments in create_moe.py to clarify SM family terminology and refresh the MoE developer guide to document SM100/SM103 support in backend capability and quantization support matrices.
Capability validation tests
tests/unittest/_torch/modules/moe/test_moe_backend.py
Add test_megamoe_can_implement_accepts_sm100_family and test_megamoe_can_implement_rejects_non_sm100_family to verify the capability check correctly accepts SM100-family targets and rejects non-SM100-family GPUs.
MoE integration test waivers
tests/integration/test_lists/waives.txt
Remove MEGAMOE_DEEPGEMM and partial MoE waivers while retaining specific CUTLASS and TRTLLM multi-GPU configuration waivers.

Distributed test reliability improvements

Layer / File(s) Summary
Port conflict retry helpers
tests/unittest/_torch/visual_gen/test_flux_pipeline.py
Add ProcessRaisedException import, _is_port_conflict_error() detection function, and _spawn_distributed_worker() wrapper that retries mp.spawn() with fresh free ports on detected EADDRINUSE/rendezvous failures.
Distributed test integration and waiver removal
tests/unittest/_torch/visual_gen/test_flux_pipeline.py, tests/integration/test_lists/waives.txt
Update Ulysses and combined-optimizations distributed tests to use _spawn_distributed_worker() for automatic port retry, and remove the flux pipeline combined-optimization test waiver from the integration skip list.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • NVIDIA/TensorRT-LLM#14119: Both PRs modify the MOE/MEGAMOE_DEEPGEMM section in tests/integration/test_lists/waives.txt, adding and removing SKIP waivers for W4A8_MXFP4_MXFP8-related multi- and single-GPU configuration tests.
  • NVIDIA/TensorRT-LLM#14282: Both PRs expand MoE/DeepGEMM handling for SM100-family GPUs (SM100/SM103) via is_sm_100f-gated logic, with this PR widening capability constraints and the related PR making backend routing quantization-aware.

Suggested reviewers

  • leslie-fang25
  • dongxuy04
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 58.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Description check ✅ Passed PR description is well-structured with clear summary, root cause analysis, and validation details matching the template's key sections.
Title check ✅ Passed The title directly relates to the main objective: fixing B300 MegaMoE test selection by accepting the SM100 family (SM100/SM103) in the backend capability gating.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

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

🧹 Nitpick comments (2)
tests/unittest/_torch/modules/moe/test_moe_backend.py (2)

214-245: QA list update is unnecessary for this PR scope.

These are unit-test additions only; no integration test definitions were introduced, so QA list file changes are optional/not required here.

As per coding guidelines: “If the PR only touches unittest/ or narrow unit scope, say explicitly whether QA list updates are unnecessary or optional.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unittest/_torch/modules/moe/test_moe_backend.py` around lines 214 -
245, The PR adds only unit tests
(test_megamoe_can_implement_accepts_sm100_family and
test_megamoe_can_implement_rejects_non_sm100_family in
tests/unittest/_torch/modules/moe/test_moe_backend.py) so explicitly state in
the PR description or commit message that QA list updates are
unnecessary/optional for this change because it only touches unit tests under
tests/unittest/ and does not introduce integration or system-level changes;
include the two test names to make the rationale clear.

214-229: ⚡ Quick win

Cover both supported SM-family members in the acceptance test.

The contract is SM100-family support (SM100 and SM103), but the positive path currently asserts only SM103. Parametrizing this test over both values will prevent regressions on SM100.

Proposed change
+@pytest.mark.parametrize("sm_version", [100, 103], ids=["sm100", "sm103"])
-def test_megamoe_can_implement_accepts_sm100_family(monkeypatch):
+def test_megamoe_can_implement_accepts_sm100_family(monkeypatch, sm_version):
     import tensorrt_llm._torch.modules.fused_moe.mega_moe.mega_moe_deepgemm as megamoe_module

-    monkeypatch.setattr(megamoe_module, "get_sm_version", lambda: 103)
+    monkeypatch.setattr(megamoe_module, "get_sm_version", lambda: sm_version)
     monkeypatch.setattr(megamoe_module, "_import_deep_gemm", lambda: object())

     can_implement, reason = MegaMoEDeepGemm.can_implement(
         QuantAlgo.W4A8_MXFP4_MXFP8,
         dtype_activation=torch.bfloat16,
         hidden_size=512,
         intermediate_size=512,
     )

     assert can_implement
     assert reason is None
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unittest/_torch/modules/moe/test_moe_backend.py` around lines 214 -
229, The test test_megamoe_can_implement_accepts_sm100_family should cover both
SM100 and SM103; change the test to iterate or parametrize over SM family values
(100 and 103) when monkeypatching megamoe_module.get_sm_version and asserting
that MegaMoEDeepGemm.can_implement returns (True, None); keep the existing
monkeypatch of _import_deep_gemm and the same can_implement call/assertions but
run them for each SM value to prevent regressions for SM100.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@tests/unittest/_torch/modules/moe/test_moe_backend.py`:
- Around line 214-245: The PR adds only unit tests
(test_megamoe_can_implement_accepts_sm100_family and
test_megamoe_can_implement_rejects_non_sm100_family in
tests/unittest/_torch/modules/moe/test_moe_backend.py) so explicitly state in
the PR description or commit message that QA list updates are
unnecessary/optional for this change because it only touches unit tests under
tests/unittest/ and does not introduce integration or system-level changes;
include the two test names to make the rationale clear.
- Around line 214-229: The test test_megamoe_can_implement_accepts_sm100_family
should cover both SM100 and SM103; change the test to iterate or parametrize
over SM family values (100 and 103) when monkeypatching
megamoe_module.get_sm_version and asserting that MegaMoEDeepGemm.can_implement
returns (True, None); keep the existing monkeypatch of _import_deep_gemm and the
same can_implement call/assertions but run them for each SM value to prevent
regressions for SM100.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 505337b2-a56d-475a-889e-d1c97b35e4e5

📥 Commits

Reviewing files that changed from the base of the PR and between a173761 and df66828.

📒 Files selected for processing (6)
  • tensorrt_llm/_torch/modules/fused_moe/MOE_DEVELOPER_GUIDE.md
  • tensorrt_llm/_torch/modules/fused_moe/create_moe.py
  • tensorrt_llm/_torch/modules/fused_moe/mega_moe/mega_moe_deepgemm.py
  • tests/integration/test_lists/waives.txt
  • tests/unittest/_torch/modules/moe/test_moe_backend.py
  • tests/unittest/_torch/visual_gen/test_flux_pipeline.py
💤 Files with no reviewable changes (1)
  • tests/integration/test_lists/waives.txt

@xxi-nv
xxi-nv force-pushed the dev-xxi-bug6175060-bot branch from df66828 to f912557 Compare May 20, 2026 13:15
@xxi-nv xxi-nv changed the title [NVBug 6175060][fix] Fix post-merge test selection failures [NVBug 6175059][fix] Fix B300 MegaMoE test selection May 20, 2026
@xxi-nv
xxi-nv removed the request for review from a team May 20, 2026 13:18
@xxi-nv
xxi-nv force-pushed the dev-xxi-bug6175060-bot branch from f912557 to 21264b1 Compare May 20, 2026 13:19
@xxi-nv

xxi-nv commented May 20, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49435 [ run ] triggered by Bot. Commit: 21264b1 Link to invocation

@xxi-nv xxi-nv changed the title [NVBug 6175059][fix] Fix B300 MegaMoE test selection [https://nvbugs/6175059][fix] Fix B300 MegaMoE test selection May 20, 2026
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49435 [ run ] completed with state SUCCESS. Commit: 21264b1
/LLM/main/L0_MergeRequest_PR pipeline #39080 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 May 20, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49503 [ run ] triggered by Bot. Commit: 21264b1 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49503 [ run ] completed with state SUCCESS. Commit: 21264b1
/LLM/main/L0_MergeRequest_PR pipeline #39140 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 May 21, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49558 [ run ] triggered by Bot. Commit: 21264b1 Link to invocation

Comment thread tests/integration/test_lists/waives.txt Outdated
@yuxianq

yuxianq commented May 21, 2026

Copy link
Copy Markdown
Collaborator

Please update the nvbug link in title to 6175060

@xxi-nv xxi-nv changed the title [https://nvbugs/6175059][fix] Fix B300 MegaMoE test selection [https://nvbugs/6175060][fix] Fix B300 MegaMoE test selection May 21, 2026

@xxi-nv xxi-nv left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the catch, update the tile and actually 6175060 and 6175059 are duplicated bugs.

Comment thread tests/integration/test_lists/waives.txt Outdated
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49558 [ run ] completed with state SUCCESS. Commit: 21264b1
/LLM/main/L0_MergeRequest_PR pipeline #39186 completed with status: 'ABORTED'

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

Link to invocation

@xxi-nv

xxi-nv commented May 21, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49596 [ run ] triggered by Bot. Commit: 21264b1 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49596 [ run ] completed with state SUCCESS. Commit: 21264b1
/LLM/main/L0_MergeRequest_PR pipeline #39220 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 May 21, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49658 [ run ] triggered by Bot. Commit: 21264b1 Link to invocation

@xxi-nv

xxi-nv commented May 21, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49672 [ run ] triggered by Bot. Commit: a37554f Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49658 [ run ] completed with state ABORTED. Commit: 21264b1

Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49672 [ run ] completed with state SUCCESS. Commit: a37554f
/LLM/main/L0_MergeRequest_PR pipeline #39283 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 May 21, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49769 [ run ] triggered by Bot. Commit: a37554f Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49769 [ run ] completed with state SUCCESS. Commit: a37554f
/LLM/main/L0_MergeRequest_PR pipeline #39367 completed with status: 'SUCCESS'

CI Report

Link to invocation

@xxi-nv
xxi-nv merged commit 1b10531 into NVIDIA:main May 21, 2026
7 checks passed
KleinBlueC pushed a commit to KleinBlueC/TensorRT-LLM that referenced this pull request May 26, 2026
bmarimuthu-nv pushed a commit to nv-auto-deploy/TensorRT-LLM that referenced this pull request May 28, 2026
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.

3 participants