Repository navigation
[Config] [Perf] MiniMax-M3.1 TP2 MXFP8 GEMM: qkv_proj rows and 8-wave picks at large M on gfx950 - #8191
[Config] [Perf] MiniMax-M3.1 TP2 MXFP8 GEMM: qkv_proj rows and 8-wave picks at large M on gfx950#8191vorapolsiloai wants to merge 2 commits into
Conversation
…=4992 K=6144) on gfx950 Add 18 rows (M 1 to 32768) for the MiniMax-M3.1 fused qkv + indexer projection at TP2 (N=4992, K=6144, 1x32 e8m0 weight scales) to the gfx950 MiniMax-M3 MXFP8 blockscale bpreshuffle table. The table had no rows for this shape. vLLM uses the AITER FlyDSL MXFP8 GEMM only for shapes that AITER has tuned, so this projection ran on the vLLM Triton dot_scaled fallback. All rows use FlyDSL bmm kernels that the table already uses for other MiniMax-M3 shapes, except one tile (M=32). The rows come from a local FlyDSL bmm sweep on MI355X (256 CUs, amd-aiter 0.1.28.post1), not from the AITER tuner, so the us, tflops, bw and errRatio cells do not compare with the cells of the rows the tuner wrote. The rows are appended to the end of the file, as in ROCm#7829. Signed-off-by: Vorapol Assavasangthong <[email protected]>
…L 8-wave GEMM on gfx950 Move 10 rows of the gfx950 MiniMax-M3 MXFP8 blockscale bpreshuffle table from FlyDSL bmm kernels to the FlyDSL 8-wave MXFP8 GEMM (TP2 shapes): - o_proj (N=6144 K=4096): M=8192, M=16384 - shared expert gate_up (N=3072 K=6144): M=4096, M=8192, M=16384 - shared expert down (N=6144 K=1536): M=8192, M=16384 - qkv_proj (N=4992 K=6144): M=2048, M=8192, M=16384 The three qkv_proj rows come from the previous commit, so this commit stacks on it. A re-measure on MI350X (256 CUs) timed the candidates at the M values that each row serves: one CUDA graph of 20 calls per candidate, 7 rounds in shuffled order, median. A row moves only if its summed time is at least 3% lower and no M value is more than 1% slower. The moved rows are 8.5% to 23.7% faster on MI350X. The same comparison on MI355X (the old pick through the production lookup against the new pick, same operands) found all 40 served M values faster, 0.4% to 22.8% (4.8% to 22.8% at the row's own M), with outputs bit-identical to those of the previous kernels. The us, tflops, bw and errRatio cells of these rows are from that MI355X comparison at the row's M, not from the AITER tuner: us is the median of the 7 rounds; tflops = 2*M*N*K/us; bw = (M*K + N*K + 2*M*N)/us in GB/s, as for the qkv_proj rows; errRatio is the fraction of outputs outside isclose(rtol=1e-2, atol=1e-2) of the bf16 reference of the dequantized operands, as for the qkv_proj rows (the 7 rows replaced here carried 0.0). They do not compare with the cells of rows the tuner wrote. Signed-off-by: Vorapol Assavasangthong <[email protected]>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
Summary
MiniMax-M3.1 TP2 MXFP8 GEMM table: adds 18 qkv_proj rows (N=4992, K=6144) that vLLM otherwise serves with its Triton fallback, and moves 10 large-M rows from FlyDSL bmm to the 8-wave MXFP8 kernel. Output is bit-identical; no code change.
MI350X MiniMax-M3.1-Flash TP2 output tok/s: qkv rows +1.87% (std), +2.41% (DSpark K=7); 8-wave picks a further +1.82%, +1.84%. MI355X: 8-wave rows 0.4% to 22.8% faster at all 40 served M; no end-to-end A/B on MI355X for them.
Full summary
MiniMax-M3.1 at TP2 runs four dense MXFP8 GEMMs per layer through
gemm_a8w8_blockscale_bpreshuffle, which reads the e8m0 mxscale table. This PR adds the 18 rows that table lacks for the fused qkv + indexer projection (N=4992, K=6144, which vLLM otherwise serves with its Triton fallback) and moves 10 large-M rows (7 existing o_proj, shared-expert gate_up and down rows, and 3 of the new qkv rows) from FlyDSL bmm kernels to the FlyDSL 8-wave MXFP8 GEMM: 4.8% to 22.8% faster at each row's M on MI355X (8.5% to 23.7% on MI350X), with bit-identical output.MI350X, MiniMax-M3.1-Flash TP2, 8 image workloads, output tok/s: qkv rows +1.87% (std) and +2.41% (DSpark K=7); 8-wave picks a further +1.82% and +1.84%. MI355X end to end: qkv rows +1.8% (4 rows, pooled) and +0.4% (8 rows, inside a 2.3% A/A spread). MI355X kernel check: all 40 served M of the 8-wave picks are faster (0.4% to 22.8%); there is no end-to-end A/B for the 8-wave picks on MI355X.
Motivation
Without a table row, vLLM's mxfp8 linear kernel skips the shape. At M 2048 to 16384 these GEMMs are compute bound (36% to 50% of MXFP8 peak with the 8-wave picks); below M of about 300 the qkv weight read bounds them.
Why the table path, roofline, earlier tuner rows
AiterFlyDSLMxfp8LinearKerneltakes a shape only ifget_mxscale_bpreshuffle_config(m, N, K, "1x32")has a row at M = 1 and M = 8192 (vllm/_aiter_ops.py,is_mxfp8_bpreshuffle_gemm_tuned), and runs it throughaiter.gemm_a8w8_blockscale_bpreshuffle, which for E8M0 1x32 scales calls_gemm_mxscale_bpreshuffleand reads this table (aiter/ops/gemm_op_a8w8.py). The..._a8w8_mxfp8_bpreshuffle_tuned_gemm.csvtable is not read on this path (as [Config] [Perf] MiniMax-M3.1 MXFP8 GEMM tunings (gfx950) #7772 states). No table on main has a row for (4992, 6144), so vLLM runsRocmDotScaledMxfp8LinearKernelthere.usis 9.0% to 11.3% below the bmm rows it replaced) and at M = 8320 for six other shapes ([Config] Add M=8320 MiniMax-M3 MXFP8 GEMM rows for gfx950 #7829). The 7 existing rows this PR moves were added by [HIP] [OPUS] [FlyDSL] gfx950 MXFP8 bmm: 1x32 weight scales, grouped XCD order, MiniMax-M3 configs #6060, a bmm-only sweep made before the 8-wave kernel was a candidate.Changes
minimax_m3_a8w8_blockscale_mxscale_bpreshuffle_tuned_gemm.csv: 18 rows appended, 10 rows changed in place (bmm to mxfp8). The rows come from a local FlyDSL sweep, not the tuner.Rows, previous and new kernels, how chosen
aiter/configs/model_configs/minimax_m3_a8w8_blockscale_mxscale_bpreshuffle_tuned_gemm.csv, two commits, no code change. Net against main: 18 rows added, 7 rows changed.gfx950,cu_num256, 1x32, flydsl bmm, M = every power of 2 from 1 to 32768 plus 12288 and 24576. 9 of the 10 kernel names are already in the file; the new tile isflydsl_bmm_mxfp8_mfma_t32x64x256_w1x4_nb6_sk2_bd2(M=32). Source: a local FlyDSL bmm sweep on MI355X (amd-aiter 0.1.28.post1, 2026-11-10); the cells come from that sweep, not from the tuner.kernelIdbmm -> mxfp8, same keys; 7 rows from [HIP] [OPUS] [FlyDSL] gfx950 MXFP8 bmm: 1x32 weight scales, grouped XCD order, MiniMax-M3 configs #6060, 3 from item 1): o_proj M=8192 and 16384; shared gate_up M=4096, 8192, 16384; shared down M=8192 and 16384; qkv_proj M=2048, 8192, 16384.The 10 rows (previous and new kernel, gains), how they were chosen, and what the cells are
flydsl_bmm_mxfp8_mfma_...)flydsl_mxfp8_8w_256x256x128_F8_F8_B16_...)t256x256x128_w1x4_nb2_sk1_bd1_xcd43x4t256x256x128_w1x4_nb2_sk1_bd1_xcd41x8t256x192x128_w1x4_nb3_sk1_bd2_xcd4_sps4x4t128x256x128_w1x4_nb3_sk1_bd2_xcd41x4t256x256x128_w1x4_nb2_sk1_bd1_xcd44x8t256x256x128_w1x4_nb2_sk1_bd1_xcd41x4t256x256x128_w1x4_nb2_sk1_bd1_xcd43x4t256x192x128_w1x4_nb2_sk1_bd1_xcd42x0t192x192x128_w1x4_nb3_sk1_bd2_xcd2x4t192x192x128_w1x4_nb3_sk1_bd2_xcd2x4How the 10 rows were chosen (MI350X, 1 GPU, amd-aiter 0.1.28.post1, 2026-11-14): for each row, the M values of MiniMax-M3.1 serving that the lookup maps to it (for the o_proj 8192 row: 4349 to 14464). Each candidate config gets its own CUDA graph of 20 calls on the same operands; 7 rounds in shuffled order; median; each output compared bit for bit with the current pick. A row moves only if its summed time is at least 3% lower and no M is more than 1% slower. On MI350X every M of the 10 rows is 7% or more faster. On MI355X (check below) every one of the 40 served M is faster, 0.4% to 22.8%; the shared gate_up 8192 row is the thinnest (+18.4% at M=4349, +0.4% at 5440, +2.0% at 7232, +4.8% at 8192; 5.3% lower summed over its four M). The other 6 rows at M >= 2048 stay on bmm. Cells:
us,tflops,bwanderrRatioof the 10 rows come from the MI355X check below at the row's M, not from the tuner:usis the median of 7 rounds of a 20-call CUDA graph,tflops= 2MNK/us,bw= (MK + NK + 2MN)/us in GB/s (as in the qkv rows),errRatiothe fraction of outputs outside isclose(rtol=1e-2, atol=1e-2) of the bf16 reference of the dequantized operands (the 7 rows replaced carried 0.0). They do not compare with the cells of tuner rows.Performance (if applicable)
Not claimed: no MI355X end-to-end A/B isolates the 8-wave rows; the rows are not tuner output; nothing ran on main's code (amd-aiter 0.1.28.post1 only).
Table, commands, MI355X kernel check
MiniMax-M3.1-Flash (
amd/MiniMax-M3.1-Flash-Quark-MXFP4), vLLM TP2, the 8 image rows (one image per request, ISL 256 to 8192, OSL 64, c4 to c256), A B B A on one GPU pair, output tok/s, geomean over the 8 rows of the arm means. A = vLLM nightly 083fbac0 + #65995 #64928 #65016 #64930 #65479 with amd-aiter 0.1.28.post1; B = A + the rows. The 8-wave step is measured on top of the qkv rows.Per-row results, commands and the MI355X kernel check
MI355X kernel check (one GPU, gfx950, 256 CUs, torch 2.13.0+rocm10.0.0, amd-aiter 0.1.28.post1). Operands as the tuner's
generate_data(fp8 around N(0, 2), e8m0 1x32 scales 2^-3 to 2^3, weight preshuffled (16, 16)). Old = the production path under the previous table; new = the kernel the new row names, called directly. Production lookups under the branch table returned the named kernel at all 58 probes (18 qkv row M and 40 served M); under main's table 18 qkv probes and 13 of the 40 served probes have no row.The in-tree equivalent that also writes the CSV is the tuner (
--compare, command under Testing).Part 1, the 18 qkv rows (4992, 6144) at their M, row against the bmm heuristic:
flydsl_bmm_mxfp8_mfma_...)t16x32x512_w1x2_nb6_sk1_bd2_xcdt16x32x512_w1x2_nb6_sk1_bd2_xcdt16x32x512_w1x2_nb6_sk1_bd2_xcdt16x32x512_w1x2_nb6_sk1_bd2_xcdt16x32x512_w1x2_nb6_sk1_bd2_xcdt32x64x256_w1x4_nb6_sk2_bd2t64x64x128_w1x4_nb6_sk2_bd2t48x64x256_w1x4_nb6_sk1_bd2_xcdt96x64x128_w1x4_nb6_sk1_bd2_xcdt96x128x128_w1x4_nb4_sk1_bd2_xcd4t96x128x128_w1x4_nb3_sk1_bd2_xcd4t256x192x128_w1x4_nb2_sk1_bd1_xcd4t96x128x128_w1x4_nb3_sk1_bd2_xcd4t192x192x128_w1x4_nb3_sk1_bd2_xcdt256x192x128_w1x4_nb3_sk1_bd2_xcd4_spst192x192x128_w1x4_nb3_sk1_bd2_xcdt192x192x128_w1x4_nb3_sk1_bd2_xcdt256x192x128_w1x4_nb3_sk1_bd2_xcd4_spsPart 2, the 10 8-wave rows at every served M (percent faster than the replaced bmm kernel, bits identical at all 40):
8w ...)8w 3x48w 1x88w 4x48w 1x48w 4x88w 1x48w 3x48w 2x08w 2x48w 2x4Testing
CPU guard tests and the A/B runs are described in the self-review.
Details
To do before ready, on a dev install of main: the repo tuner for these keys,
python3 csrc/gemm_a8w8_mxfp8_bpreshuffle/gemm_a8w8_mxfp8_bpreshuffle_tune.py --mxscale_table -i <shapes csv with M, N, K, w_scale_block 1x32> -o aiter/configs/model_configs/minimax_m3_a8w8_blockscale_mxscale_bpreshuffle_tuned_gemm.csv --compare --update_improved(an attempt on MI350X took more than 30 minutes at M=1 alone; about 8 hours for the 18 qkv keys).Documentation
Tuned-config rows only.
Details
Tuned-config rows only.
Dependencies
No code dependency.
Related PRs
No code dependency. #7498 and #7829 (merged, in the base) changed other keys of this file: none of this PR's 25 keys is among their rows. #7772 (open, TP4 shapes of the same file): no shared key, and the text merge with this branch is clean in both orders (
git merge-tree, #7772 at d5cca3c), so whichever lands second rebases mechanically. #6605 (open, 64-bit stores in the 8-wave epilogue, 2.7% to 8.5%) changes the speed of the kernel the 10 rows move to; the rows were measured without it, on amd-aiter 0.1.28.post1 (tagv0.1.28.post1, ad0554a) with FlyDSL 0.4.2 (main pins 0.5.0), so re-run the check after #6605 lands.Breaking Changes
None. Only gfx950 calls with 1x32 scales and these (N, K, M) change kernel.
Bit-exactness details
None. Only gfx950 (256 CUs) calls with 1x32 weight scales and these (N, K, M) change kernel. The 8-wave output is bit-identical to the previous kernel at every re-measured M (48 points on MI350X, 40 on MI355X). The qkv rows replace the vLLM Triton fallback (not compared bit for bit) and AITER's bmm heuristic (the same bits at 17 of 18 row M on MI355X; at M=64 another split-K tile, error ratio 0.074% against 0.075%).
PR Self-Review
Self-review (revision, scope, checks, unverified scope)
Reviewed revision
The branch head before push.
Behavior and intent
For (4992, 6144) on gfx950 the merged mxscale table now has 18 rows, so
is_mxfp8_bpreshuffle_gemm_tuned(4992, 6144)is true and vLLM runs the projection on FlyDSL kernels; 10 rows name the 8-wave GEMM (run_gemm_a8w8_mxfp8_gfx950), which accepts these shapes on main (K a multiple of 256; out-of-range N columns dropped; 1x32 scales supported). The math is the same MXFP8 with e8m0 scales.Validation and unverified scope
CPU checks and what is not verified
ROCm container, torch 2.13, pandas; the branch changes no code, so main's code runs against this branch's CSV (a stub loads the
AITER_CONFIGclass ofaiter/jit/core.pyand the FlyDSL name parsers).python3 -m unittest op_tests.tuning_tests.test_csv_validationop_tests/tuning_tests/test_config_shape_collision.pyaiter.opspackage, which the stub lacks (same on main)model_configs/file, no env var)AITER_CONFIG.get_config_fileparse_bmm_kernel_name+check_bmm_config,parse_mxfp8_8wave_kernel_nameus,tflops,bw,errRatioonly (refreshed); kernel and split-K equal at 75 of 75Not verified: nothing ran on main's code; the end-to-end A/B, the re-measure and the MI355X kernel check ran on amd-aiter 0.1.28.post1. The 8-wave rows have MI350X end-to-end numbers only. The rows did not come from the repo tuner (command above). Accuracy only at stack level for the qkv rows (MMMU 0.573 and 0.596 std, 0.588 and 0.608 DSpark, stderr 0.016).
PR-specific question
To answer when the automated PR Self-Review comment is posted.
Changed op tests
None.