Skip to content

[None][perf] Overlap the Mistral Large 4 SM107 decode shared expert with the routed experts - #22253

Merged
yizhang-nv merged 1 commit into
NVIDIA:feat/mistral-large-4from
yt0428:codex/ml4-vr200-pr-shared-expert-aux
Nov 16, 2026
Merged

yizhang-nv merged 1 commit into
NVIDIA:feat/mistral-large-4from
yt0428:codex/ml4-vr200-pr-shared-expert-aux

Conversation

@yt0428

@yt0428 yt0428 commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

@coderabbitai summary

Description

In the Mistral Large 4 SM107 (VR200) TP4/TP8 decode target, each MoE layer's shared expert now runs on a side stream, overlapped with the routed-expert path.

  • The shared expert is FP8 gate/up, SiLU-and-mul, then FP8 down.
  • Meanwhile the main stream runs the router GEMM, the routing, the NVFP4 quantization and the routed-expert runner.
  • The two partial sums join before the layer's closing all-reduce.

What changes (mistral_large_4_nvfp4__sm_107__tp4/modeling.py only)

  • DecodeTarget._mlp splits into routed() and shared() closures, run through maybe_execute_in_parallel with a per-target side stream and fork/join events.
  • maybe_execute_in_parallel uses the side stream only under CUDA graph capture, so eager and context steps are unchanged. Dense layers are also unchanged.
  • TRTLLM_MODELING_V2_SERIAL_SHARED_EXPERT=1, read at launch in every rank, keeps the shared expert on the main stream for A/B comparison. Both orders compute the same bits.

VR200 results

This end-to-end A/B ran on top of the other VR200 decode optimizations (split Top-K, fused FP8 linear, LowM GEMM and SparseMLA global split), not on this PR's base alone. Setup: DSpark K3 with a synthetic acceptance length of 2.772, 20 min per point, stream_interval=1, one run per point.

Point 1/ITL p50 (tok/s/user) Total tok/s/GPU OK / errors
TP4 c=1 253.6 → 279.5 (+10.2%) +3.9% 138/1 → 145/1
TP4 c=4 +9.9% +1.0% 242/0 → 244/0
TP4 c=8 +8.7% +5.5% 423/0 → 457/0
TP8 c=1 288.4 → 303.7 (+5.3%) +2.1% 146/1 → 146/1
TP8 c=4 +10.3% +4.8% 244/0 → 245/0
TP8 c=8 +8.0% +1.6% 459/0 → 464/0
  • The derived step saving is about 1.0–1.1 ms on TP4 and 0.5–1.0 ms on TP8.
  • TTFT p90 is mixed; at TP8 c=8 it went from 1.18 s to 1.31 s.
  • The single c=1 error also occurs on the baseline.

Not measured yet

  • A GPU numerics or acceptance-rate check.
  • A post-change nsys trace.
  • An A/B with TRTLLM_MODELING_V2_SERIAL_SHARED_EXPERT=1 on the same build.

Test Coverage

No new unit tests: the change only reorders the work across streams inside the decode target, and the computed values are unchanged. TRTLLM_MODELING_V2_SERIAL_SHARED_EXPERT=1 restores the previous serial order for bisecting.

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.

🤖 Generated with Claude Code

…ed experts

In the SM107 tp4/tp8 decode target, run each MoE layer's shared expert
(FP8 gate/up, SiLU-and-mul, FP8 down) on a side stream while the main
stream runs the router GEMM, the routing, the NVFP4 quantization and
the routed-expert runner. The two partial sums join before the closing
all-reduce. The side stream is used only under CUDA-graph capture, via
maybe_execute_in_parallel; eager and context steps are unchanged.

TRTLLM_MODELING_V2_SERIAL_SHARED_EXPERT=1 keeps the shared expert on the
main stream for A/B comparison.

Signed-off-by: yt0428 <[email protected]>
@yt0428

yt0428 commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator Author

/bot skip --comment "Format check only"

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #84736 [ skip ] triggered by Bot. Commit: e5b4bd4 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #84736 [ skip ] completed with state SUCCESS. Commit: e5b4bd4
Skipping testing for commit e5b4bd4

Link to invocation

@yizhang-nv
yizhang-nv merged commit 061ec01 into NVIDIA:feat/mistral-large-4 Nov 16, 2026
10 checks passed
yizhang-nv added a commit to yizhang-nv/TensorRT-LLM that referenced this pull request Nov 17, 2026
…with the routed experts

Port of feat/mistral-large-4 061ec01 (NVIDIA#22253) onto this branch, in the
sm_107 tp target (mistral_large_4_nvfp4__sm_107__tp, NVIDIA#22253's
__sm_107__tp4).

Under CUDA-graph capture the MoE layer's shared expert runs on a side stream
(maybe_execute_in_parallel) while the main stream runs the router, the NVFP4
quantization and the routed experts. Both orders compute the same bits.
TRTLLM_MODELING_V2_SERIAL_SHARED_EXPERT=1 keeps the shared expert on the main
stream.

Signed-off-by: Yi Zhang <[email protected]>
@yt0428
yt0428 deleted the codex/ml4-vr200-pr-shared-expert-aux branch November 18, 2026 02:52
yizhang-nv added a commit to yizhang-nv/TensorRT-LLM that referenced this pull request Nov 20, 2026
…with the routed experts

Port of feat/mistral-large-4 061ec01 (NVIDIA#22253) onto this branch, in the
sm_107 tp target (mistral_large_4_nvfp4__sm_107__tp, NVIDIA#22253's
__sm_107__tp4).

Under CUDA-graph capture the MoE layer's shared expert runs on a side stream
(maybe_execute_in_parallel) while the main stream runs the router, the NVFP4
quantization and the routed experts. Both orders compute the same bits.
TRTLLM_MODELING_V2_SERIAL_SHARED_EXPERT=1 keeps the shared expert on the main
stream.

Signed-off-by: Yi Zhang <[email protected]>
yizhang-nv added a commit to yizhang-nv/TensorRT-LLM that referenced this pull request Nov 23, 2026
…with the routed experts

Port of feat/mistral-large-4 061ec01 (NVIDIA#22253) onto this branch, in the
sm_107 tp target (mistral_large_4_nvfp4__sm_107__tp, NVIDIA#22253's
__sm_107__tp4).

Under CUDA-graph capture the MoE layer's shared expert runs on a side stream
(maybe_execute_in_parallel) while the main stream runs the router, the NVFP4
quantization and the routed experts. Both orders compute the same bits.
TRTLLM_MODELING_V2_SERIAL_SHARED_EXPERT=1 keeps the shared expert on the main
stream.

Signed-off-by: Yi Zhang <[email protected]>
yizhang-nv added a commit to yizhang-nv/TensorRT-LLM that referenced this pull request Nov 23, 2026
…with the routed experts

Port of feat/mistral-large-4 061ec01 (NVIDIA#22253) onto this branch, in the
sm_107 tp target (mistral_large_4_nvfp4__sm_107__tp, NVIDIA#22253's
__sm_107__tp4).

Under CUDA-graph capture the MoE layer's shared expert runs on a side stream
(maybe_execute_in_parallel) while the main stream runs the router, the NVFP4
quantization and the routed experts. Both orders compute the same bits.
TRTLLM_MODELING_V2_SERIAL_SHARED_EXPERT=1 keeps the shared expert on the main
stream.

Signed-off-by: Yi Zhang <[email protected]>
yizhang-nv added a commit to yizhang-nv/TensorRT-LLM that referenced this pull request Nov 24, 2026
…with the routed experts

Port of feat/mistral-large-4 061ec01 (NVIDIA#22253) onto this branch, in the
sm_107 tp target (mistral_large_4_nvfp4__sm_107__tp, NVIDIA#22253's
__sm_107__tp4).

Under CUDA-graph capture the MoE layer's shared expert runs on a side stream
(maybe_execute_in_parallel) while the main stream runs the router, the NVFP4
quantization and the routed experts. Both orders compute the same bits.
TRTLLM_MODELING_V2_SERIAL_SHARED_EXPERT=1 keeps the shared expert on the main
stream.

Signed-off-by: Yi Zhang <[email protected]>
yizhang-nv added a commit to yizhang-nv/TensorRT-LLM that referenced this pull request Nov 26, 2026
…with the routed experts

Port of feat/mistral-large-4 061ec01 (NVIDIA#22253) onto this branch, in the
sm_107 tp target (mistral_large_4_nvfp4__sm_107__tp, NVIDIA#22253's
__sm_107__tp4).

Under CUDA-graph capture the MoE layer's shared expert runs on a side stream
(maybe_execute_in_parallel) while the main stream runs the router, the NVFP4
quantization and the routed experts. Both orders compute the same bits.
TRTLLM_MODELING_V2_SERIAL_SHARED_EXPERT=1 keeps the shared expert on the main
stream.

Signed-off-by: Yi Zhang <[email protected]>
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