Repository navigation
[None][perf] Fuse FP8 quantization and GEMM for Mistral Large 4 low-M decode on SM107 - #22250
Merged
yt0428 merged 7 commits intoNov 16, 2026
Merged
Conversation
Add a CuTe DSL kernel that quantizes the activation to K128 FP8 and runs the FP8 GEMM in one launch, without a global activation scratch, and route the SM107 decode target's FP8 linears through it for 4-row TP8 steps. Signed-off-by: yt0428 <[email protected]>
The modeling_v2 claims gate requires every catalog entry that declares cells to have a test parametrized off its CELLS. Replace the hard-coded shape list in the fused FP8 block-scale linear test with test_certified_cells, driven from op.CELLS under certifying(op), keeping three input draws per cell. Signed-off-by: yt0428 <[email protected]>
Issue each CTA's FP8 weights and K128 weight-scale bytes before griddepcontrol.wait, up to eight K128 slots, refilling a register ring as slots are consumed. Each lane loads two 16-byte chunks per weight row per slot, and the activation fragment uses the same K permutation through a bank-conflict-free shared-memory layout. The slot loop is fully unrolled, and for M <= 8 MMA rows 8-15 are constant zeros. Weights and weight scales must not be written by the immediately preceding kernel; the tests create weights before activations. Signed-off-by: yt0428 <[email protected]>
…s ops The fused K128 quantization and FP8 GEMM entry is called only by the mistral_large_4_nvfp4__sm_107__tp4 target, so it moves from catalog/gemm/ to that target's ops/gemm/, following the modeling_v2 op-ownership rule. Its CuTe DSL kernel moves beside it as the private module _fused_fp8_quant_gemv.py instead of living in the shared cute_dsl_kernels/rubin/ library, and its test moves to the owned-entry path under models/mistral_large4/mistral_large_4_nvfp4__sm_107__tp4/. The decode target's _linear_fp8 now always calls the entry. The entry's tactic table already admits only the four M=4 TP8 per-rank shapes and runs the MXFP8 kernel at every other shape, so the tp_size == 8 and M == 4 check in the target duplicated it. Dispatch is unchanged for the TP4 and TP8 shapes. The dispatch test now selects the path by the wq projection's per-rank width (TP8 1024, TP4 2048) instead of tp_size. Signed-off-by: yt0428 <[email protected]>
… M up to 16 Extend the fused K128 quantization and FP8 GEMM table from the four TP8 M=4 shapes to every per-rank FP8 projection of the SM107 decode target at TP8 and TP4: wq, wo, the indexer's wq_b, the shared expert's gate/up and down, and the dense layer's gate/up and down, each at M = 1, 2, 4, 8, 12 and 16. One tactic per (N, K) serves every M. The TP8 tactics are the fastest M=4 configurations at the kernel's default prefetch depth in a probe of the weight-streaming kernel, averaged over L2-reused and cold weights. This retunes three of the four existing cells for that kernel: shared-expert gate/up (16, 8) -> (16, 4), shared-expert down (1, 8) -> (1, 4) and wo (4, 8) -> (1, 4). A partial M=8 probe of TP8 wq timed the same tactics between 3% faster and 12% slower than at M=4, and 41-49% below the M=8 baseline. The TP4-only shapes (wq 2048x6144, shared-expert gate/up 3072x6144, shared-expert down 6144x1536, wo 6144x2048, dense gate/up 12288x6144) were not probed. Each keeps the warps and, as nearly as K allows, the K128 slots per CTA of the nearest probed shape with the same N or K. None of these tactics has been through the weighted A/B gate, and M other than 4 and the TP4 shapes have no per-shape timing yet. Signed-off-by: yt0428 <[email protected]>
Replace the one-tactic-per-(N, K) table with one tactic per (M, N, K), each the fastest Split-K and warps count at the kernel's default prefetch depth in a VR200 sweep of every valid configuration (4320 CUDA-graph timings over the 72 TP8/TP4 cells, L2-resident and streamed weights). The fastest tactic depends on M: above M=8 it moves to eight warps and more Split-K slices. A cell is kept only where its tactic beats the MXFP8 kernel by at least 3% in both weight modes. 62 cells remain. The indexer's wq_b, the dense layer's down projection and the 6144x6144 shape above M=8, and the TP4 dense gate/up projection from M=4, now run the MXFP8 kernel; no fused tactic beat it there (down to -58% for TP4 dense gate/up at M=16). On VR200 (synthetic component timing; baseline MXFP8 tactics from the C1/TP8 and C4/TP4 autotuner caches): - Weighted 332-call A/B/AA gate: C1/TP8 (M=4) +41.1% / +40.8%, PASS; C4/TP4 (M=16) +7.5% / +7.6%, PASS (the previous table: -12.6%, FAIL). - Per cell: no cell slower than the MXFP8 kernel; median +31.7% with L2-resident and +30.9% with streamed weights. - First-call compile 0.2-0.4 s per shape: about 5 s per topology for the M=4..16 DSpark shapes. Largest per-call scratch 3.45 MiB. - The entry's unit tests pass (421) with this table. The dispatch test also checks a shape the table leaves to the MXFP8 kernel (wq_b at M=16). Signed-off-by: yt0428 <[email protected]>
yt0428
requested review from
Wanli-Jiang,
WeiHaocheng and
litaotju
as code owners
November 13, 2026 09:36
Collaborator
Author
|
/bot skip --comment "Format check only" |
Collaborator
|
PR_Github #84738 [ skip ] triggered by Bot. Commit: |
Collaborator
|
PR_Github #84738 [ skip ] completed with state |
Signed-off-by: tayuan <[email protected]>
Collaborator
Author
|
/bot skip --comment "Format check only" |
Collaborator
|
PR_Github #85105 [ skip ] triggered by Bot. Commit: |
Collaborator
|
PR_Github #85105 [ skip ] completed with state |
yizhang-nv
added a commit
to yizhang-nv/TensorRT-LLM
that referenced
this pull request
Nov 17, 2026
…M decode on SM107 Port of feat/mistral-large-4 416b15a (NVIDIA#22250) onto this branch, in the sm_107 tp target (mistral_large_4_nvfp4__sm_107__tp, NVIDIA#22250's __sm_107__tp4). The target-local entry falls back to the family's cute_dsl_fp8_block_scale_linear, where this branch keeps that entry. The decode target's K128 FP8 projections go through cute_dsl_fused_fp8_block_scale_linear: at the (M, N, K) shapes it has tuned (M = 1 to 16 rows at the TP4 and TP8 per-rank widths), the activation quantization is fused into a split-K GEMV; every other shape runs the Rubin MXFP8 kernel as before. The context path keeps the MXFP8 kernel. Signed-off-by: Yi Zhang <[email protected]>
yizhang-nv
added a commit
to yizhang-nv/TensorRT-LLM
that referenced
this pull request
Nov 17, 2026
The ops the SM107 decode ports bring (NVIDIA#22249, NVIDIA#22250, NVIDIA#22251, NVIDIA#22252) are tested on sm_107 only; feat/mistral-large-4 lists none of their tests. l0_gr100 now runs the split radix top-k test, the sparse MLA decode test (its global-split cases need sm_107) and the sm_107 tp target's test directory (low_m_cublas_mm and the fused FP8 GEMV). Signed-off-by: Yi Zhang <[email protected]>
1 task
yizhang-nv
added a commit
to yizhang-nv/TensorRT-LLM
that referenced
this pull request
Nov 20, 2026
…M decode on SM107 Port of feat/mistral-large-4 416b15a (NVIDIA#22250) onto this branch, in the sm_107 tp target (mistral_large_4_nvfp4__sm_107__tp, NVIDIA#22250's __sm_107__tp4). The target-local entry falls back to the family's cute_dsl_fp8_block_scale_linear, where this branch keeps that entry. The decode target's K128 FP8 projections go through cute_dsl_fused_fp8_block_scale_linear: at the (M, N, K) shapes it has tuned (M = 1 to 16 rows at the TP4 and TP8 per-rank widths), the activation quantization is fused into a split-K GEMV; every other shape runs the Rubin MXFP8 kernel as before. The context path keeps the MXFP8 kernel. Signed-off-by: Yi Zhang <[email protected]>
yizhang-nv
added a commit
to yizhang-nv/TensorRT-LLM
that referenced
this pull request
Nov 20, 2026
The ops the SM107 decode ports bring (NVIDIA#22249, NVIDIA#22250, NVIDIA#22251, NVIDIA#22252) are tested on sm_107 only; feat/mistral-large-4 lists none of their tests. l0_gr100 now runs the split radix top-k test, the sparse MLA decode test (its global-split cases need sm_107) and the sm_107 tp target's test directory (low_m_cublas_mm and the fused FP8 GEMV). 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
…M decode on SM107 Port of feat/mistral-large-4 416b15a (NVIDIA#22250) onto this branch, in the sm_107 tp target (mistral_large_4_nvfp4__sm_107__tp, NVIDIA#22250's __sm_107__tp4). The target-local entry falls back to the family's cute_dsl_fp8_block_scale_linear, where this branch keeps that entry. The decode target's K128 FP8 projections go through cute_dsl_fused_fp8_block_scale_linear: at the (M, N, K) shapes it has tuned (M = 1 to 16 rows at the TP4 and TP8 per-rank widths), the activation quantization is fused into a split-K GEMV; every other shape runs the Rubin MXFP8 kernel as before. The context path keeps the MXFP8 kernel. 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
The ops the SM107 decode ports bring (NVIDIA#22249, NVIDIA#22250, NVIDIA#22251, NVIDIA#22252) are tested on sm_107 only; feat/mistral-large-4 lists none of their tests. l0_gr100 now runs the split radix top-k test, the sparse MLA decode test (its global-split cases need sm_107) and the sm_107 tp target's test directory (low_m_cublas_mm and the fused FP8 GEMV). 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
…M decode on SM107 Port of feat/mistral-large-4 416b15a (NVIDIA#22250) onto this branch, in the sm_107 tp target (mistral_large_4_nvfp4__sm_107__tp, NVIDIA#22250's __sm_107__tp4). The target-local entry falls back to the family's cute_dsl_fp8_block_scale_linear, where this branch keeps that entry. The decode target's K128 FP8 projections go through cute_dsl_fused_fp8_block_scale_linear: at the (M, N, K) shapes it has tuned (M = 1 to 16 rows at the TP4 and TP8 per-rank widths), the activation quantization is fused into a split-K GEMV; every other shape runs the Rubin MXFP8 kernel as before. The context path keeps the MXFP8 kernel. 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
The ops the SM107 decode ports bring (NVIDIA#22249, NVIDIA#22250, NVIDIA#22251, NVIDIA#22252) are tested on sm_107 only; feat/mistral-large-4 lists none of their tests. l0_gr100 now runs the split radix top-k test, the sparse MLA decode test (its global-split cases need sm_107) and the sm_107 tp target's test directory (low_m_cublas_mm and the fused FP8 GEMV). 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
…M decode on SM107 Port of feat/mistral-large-4 416b15a (NVIDIA#22250) onto this branch, in the sm_107 tp target (mistral_large_4_nvfp4__sm_107__tp, NVIDIA#22250's __sm_107__tp4). The target-local entry falls back to the family's cute_dsl_fp8_block_scale_linear, where this branch keeps that entry. The decode target's K128 FP8 projections go through cute_dsl_fused_fp8_block_scale_linear: at the (M, N, K) shapes it has tuned (M = 1 to 16 rows at the TP4 and TP8 per-rank widths), the activation quantization is fused into a split-K GEMV; every other shape runs the Rubin MXFP8 kernel as before. The context path keeps the MXFP8 kernel. 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
The ops the SM107 decode ports bring (NVIDIA#22249, NVIDIA#22250, NVIDIA#22251, NVIDIA#22252) are tested on sm_107 only; feat/mistral-large-4 lists none of their tests. l0_gr100 now runs the split radix top-k test, the sparse MLA decode test (its global-split cases need sm_107) and the sm_107 tp target's test directory (low_m_cublas_mm and the fused FP8 GEMV). 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
…M decode on SM107 Port of feat/mistral-large-4 416b15a (NVIDIA#22250) onto this branch, in the sm_107 tp target (mistral_large_4_nvfp4__sm_107__tp, NVIDIA#22250's __sm_107__tp4). The target-local entry falls back to the family's cute_dsl_fp8_block_scale_linear, where this branch keeps that entry. The decode target's K128 FP8 projections go through cute_dsl_fused_fp8_block_scale_linear: at the (M, N, K) shapes it has tuned (M = 1 to 16 rows at the TP4 and TP8 per-rank widths), the activation quantization is fused into a split-K GEMV; every other shape runs the Rubin MXFP8 kernel as before. The context path keeps the MXFP8 kernel. 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
The ops the SM107 decode ports bring (NVIDIA#22249, NVIDIA#22250, NVIDIA#22251, NVIDIA#22252) are tested on sm_107 only; feat/mistral-large-4 lists none of their tests. l0_gr100 now runs the split radix top-k test, the sparse MLA decode test (its global-split cases need sm_107) and the sm_107 tp target's test directory (low_m_cublas_mm and the fused FP8 GEMV). Signed-off-by: Yi Zhang <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@coderabbitai summary
Description
Fuses the activation's K128 FP8 quantization and the FP8 block-scale GEMM into one CuTe DSL launch for the low-M decode projections of the Mistral Large 4 SM107 (VR200) decode target. It removes the separate quantization kernel and the global activation scratch between the two.
Kernel (
ops/gemm/_fused_fp8_quant_gemv.py)griddepcontrol.wait, up to eight K128 slots ahead, and refills a register ring as slots are consumed. This streams weights during the previous kernel's tail.Entry (
ops/gemm/cute_dsl_fused_fp8_block_scale_linear.py)cute_dsl_fp8_block_scale_linear), so the target's_linear_fp8calls the entry unconditionally.mistral_large_4_nvfp4__sm_107__tp4target's ownops/gemm/, notcatalog/, because only this target calls them. This follows the modeling_v2 op-ownership rule.Tactic selection
VR200 results (synthetic CUDA-graph component timing; the MXFP8 baseline uses tactics from the C1/TP8 and C4/TP4 autotuner caches)
Not measured yet: an end-to-end serving A/B with this table. Tactics were selected on the same sweep they are judged by, which carries about 1% selection bias.
Merge note: this PR and the LowM GEMM PR each add one import line at the same spot in the target's
modeling.py. Whichever merges second keeps both lines; nothing else overlaps. Both PRs add the sameops/__init__.pyandops/gemm/__init__.py.Test Coverage
tests/unittest/_torch/modeling_v2/models/mistral_large4/mistral_large_4_nvfp4__sm_107__tp4/gemm/test_modeling_v2_cute_dsl_fused_fp8_block_scale_linear.pytest_certified_cells: every one of the 62 table cells is driven fromop.CELLSundercertifying(op), with three input draws per cell.test_modeling_v2_claims.pygates (cells-driven test, no cross-target file sharing) cover the new owned entry.On VR200, 421 unit tests pass with this table. The untuned-shape dispatch case was added afterwards and has not run on GPU. The SM107 kernel tests skip on other GPUs.
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-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin 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