Skip to content

[None][fix] Pass num_fused_shared_experts in FP8 MoE fallback-tactic path - #17362

Closed
brnguyen2 wants to merge 2 commits into
NVIDIA:mainfrom
brnguyen2:fix/fp8-fallback-getvalidconfigs
Closed

[None][fix] Pass num_fused_shared_experts in FP8 MoE fallback-tactic path#17362
brnguyen2 wants to merge 2 commits into
NVIDIA:mainfrom
brnguyen2:fix/fp8-fallback-getvalidconfigs

Conversation

@brnguyen2

@brnguyen2 brnguyen2 commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Description

PR #15297 added a numFusedSharedExpert argument to
FP8BlockScaleMoERunner::getValidConfigs and updated the autotuner
get_valid_tactics call site, but not the memoized fallback-tactic path used
on autotuner cache misses. Any FP8 block-scale MoE forward that misses the
profiling cache now fails with:

RuntimeError: get_valid_configs() is missing value for argument '_6'.

Observed as a hard failure of
perf/test_perf_sanity.py::test_e2e[aggr_upload-host_perf_deepseek_v3_lite-v3lite_fp8_bs8_128_256]
on two independent pre-merge pipelines whose bases include #15297; the
failure is intermittent because it depends on hitting the autotuner
cache-miss path.

Fix: pass num_fused_shared_experts and include it in the memo key, matching
the get_valid_tactics call site on the same class (the valid-config set
depends on it, so it belongs in the key).

Test Coverage

Covered by the existing DeepSeek V3 Lite FP8 perf-sanity case, which
exercises the fallback path.

PR Checklist

  • PR title follows the [None][fix] convention

Dev Engineer Review

  • Updated the FP8 MoE fallback-tactic path in tensorrt_llm/_torch/custom_ops/trtllm_gen_custom_ops.py.
  • Passed num_fused_shared_experts to FP8BlockScaleMOERunner::getValidConfigs.
  • Added num_fused_shared_experts to the memoization key.
  • Kept fallback validation consistent with the autotuner path.
  • Prevented cache collisions between different fused shared-expert counts.
  • Fixed the missing _6 argument runtime error.
  • No public declarations, configuration files, or test-list files changed.
  • An initial CI run failed. A later fail-fast-disabled run passed with automatic test retries.

QA Engineer Review

No test changes.

…path

PR NVIDIA#15297 added a numFusedSharedExpert argument to
FP8BlockScaleMoERunner::getValidConfigs and updated the autotuner
get_valid_tactics call site, but not the memoized fallback-tactic path
used on autotuner cache misses. Any FP8 block-scale MoE forward that
misses the profiling cache fails with:

  RuntimeError: get_valid_configs() is missing value for argument '_6'.

Pass num_fused_shared_experts and include it in the memo key, matching
get_valid_tactics.

Signed-off-by: Brian Nguyen <brnguyen@nvidia.com>
@brnguyen2
brnguyen2 requested a review from a team as a code owner August 6, 2026 12:19
@brnguyen2

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #64333 [ run ] triggered by Bot. Commit: fcbed76 Link to invocation

@coderabbitai

coderabbitai Bot commented Aug 6, 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: c278091d-c046-44b1-b4e3-4fe353b1d0a8

📥 Commits

Reviewing files that changed from the base of the PR and between fcbed76 and 10c3fd7.

📒 Files selected for processing (1)
  • tensorrt_llm/_torch/custom_ops/trtllm_gen_custom_ops.py

Walkthrough

FP8 MoE autotuner identity and fallback-tactic validation keys now include num_fused_shared_experts. Configurations with different fused shared-expert counts use distinct cache entries.

Changes

FP8 MoE tactic caching

Layer / File(s) Summary
Include fused shared-expert count
tensorrt_llm/_torch/custom_ops/trtllm_gen_custom_ops.py
FP8BlockScaleMoERunner.unique_id and fallback-tactic validation now include num_fused_shared_experts.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Suggested reviewers: bowenfu

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the FP8 MoE fallback-tactic fix and follows the repository's ticket and type convention.
Description check ✅ Passed The description explains the failure, root cause, fix, test coverage, and includes the required sections.
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.

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

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@tensorrt_llm/_torch/custom_ops/trtllm_gen_custom_ops.py`:
- Around line 925-926: Update the unique_id() autotuner cache key to include
num_fused_shared_experts, matching the fallback key and get_valid_configs()
parameter validation. Add a regression test that verifies distinct fused
shared-expert counts produce distinct cache identities and do not reuse the same
autotuner entry.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: a41c22c7-f985-4817-9376-3ac92d9f9085

📥 Commits

Reviewing files that changed from the base of the PR and between 4aea8b1 and fcbed76.

📒 Files selected for processing (1)
  • tensorrt_llm/_torch/custom_ops/trtllm_gen_custom_ops.py

Comment thread tensorrt_llm/_torch/custom_ops/trtllm_gen_custom_ops.py

@leslie-fang25 leslie-fang25 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.

Duplicated with #17328?

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

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

@brnguyen2

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #64373 [ run ] triggered by Bot. Commit: fcbed76 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #64373 [ run ] completed with state SUCCESS. Commit: fcbed76
/LLM/main/L0_MergeRequest_PR pipeline #52264 completed with status: 'SUCCESS'
Pipeline passed with automatic retried tests. Check the rerun report for details.

CI Report

Link to invocation

Signed-off-by: Brian Nguyen <brnguyen@nvidia.com>
key = (self.top_k, hidden_size, self.intermediate_size,
self.local_num_experts, num_tokens)
key = (self.top_k, self.num_fused_shared_experts, hidden_size,
self.intermediate_size, self.local_num_experts, num_tokens)

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.

This tuple is both the memo key and the positional argument list for get_valid_configs(*key) on line 931 — which is why #15297 updated the explicit get_valid_tactics() call site but missed this one. Could the two be split (pass the arguments explicitly, keep key as just the key), so both call sites look the same to a grep? Fine as a follow-up.

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.

Agreed. That tuple doing double duty as memo key and positional argument list for get_valid_configs(*key) is exactly why #15297 updated the explicit call site but missed this one. Splitting them so both call sites spell out the arguments (and the key stays just a key) would make this greppable; worth doing as a follow-up. Since the identical fix already merged via #17328, this PR is being closed, so the split would go as a separate cleanup against main.

@brnguyen2

Copy link
Copy Markdown
Collaborator Author

Confirmed, @leslie-fang25#17328 carries the identical code change (same resulting file content for trtllm_gen_custom_ops.py) and merged first, so main already has the fix, plus the associated waive removals. This PR is superseded and can be closed.

@brnguyen2 brnguyen2 closed this Aug 7, 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.

4 participants