Repository navigation
[Config] [Perf] MiniMax-M3.1 MXFP8 GEMM tunings (gfx950) - #7772
Conversation
Add tuned gfx950 rows for the MiniMax-M3.1 MXFP8 GEMMs to minimax_m3_a8w8_mxfp8_bpreshuffle_tuned_gemm.csv: - QKV 2560x6144 and o_proj 6144x2048 (TP4): decode M rows. Each row is at least 2% faster than the row that main's lookup uses for that M. - Shared-expert gate/up 1536x6144 and down 6144x768 (TP4): new shapes. Main uses the FlyDSL heuristic kernel for them. - Full-weight SP shapes 6144x6144 and 6144x3072: rows for more M. Rows of other models do not change. Signed-off-by: Vinayak Gokhale <[email protected]>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
READY FOR HUMAN REVIEWPR Self-ReviewRevision Author self-review accepted. Readiness report: Author answers
Show the author's self-review answersBehavior and intentValidation and unverified scopePR-specific questionChanged op testsPR state
Copilot findings
Code and op-test hygiene
Required CI
Shadow mode reports what would block but keeps the status successful. Set |
A cold A/B against main's table (old = the row that main's lookup uses, new = the added row, through the live lookup) removes 9 rows that are not at least 2% faster: - 6144x3072: M = 125, 192, 768 and the changed M = 4096 row. - 6144x6144: M = 125, 192, 640, 768, 3599. All 64 shared-expert rows (1536x6144, 6144x768) stay: they are 14% to 70% faster than the FlyDSL heuristic kernel that main uses. Signed-off-by: Vinayak Gokhale <[email protected]>
On gfx950, RocmDotScaledMxfp8LinearKernel now runs AITER's
gemm_a8w8_mxfp8_bpreshuffle instead of the Triton dot_scaled GEMM for
the weight shapes and M ranges where AITER was measured at least 3%
faster with the same output (to 1e-2), both for pre-quantized MXFP8
input and for bf16 input above 16 rows (up to 16 rows the quant stays
fused into the Triton GEMM). The ranges are a built-in table per
(N, K), measured on MI355X for the MiniMax-M3.1 TP4 linears:
qkv + indexer (2560, 6144): M 8-1024, 2048-32768
o_proj (6144, 2048): M 8-32768
dense FFN (6144, 6144): 24-32768; (6144, 3072): 24-48, 64-1024,
1536-32768
shared expert (1536, 6144) and (6144, 768): several ranges from 24
Examples (us, AITER vs Triton): qkv M 64 8.3 vs 11.6, M 512 20.7 vs
34.4; o_proj M 128 7.5 vs 9.7, M 1024 20.0 vs 36.3; dense gate/up
M 512 32.9 vs 67.6.
AITER is used only when its tuned table has FlyDSL rows for (N, K) on
this device (an untuned shape would run AITER's heuristic tile, which
was not measured), the kernel and shuffle_weight import, and the
caller is not being traced by torch.compile. Otherwise nothing changes.
A layer AITER serves keeps a (16, 16)-preshuffled copy of its FP8
weight (one more copy of those weights in memory).
The ranges were measured with AITER's MiniMax-M3 tuned rows plus those
of ROCm/aiter#7772; the stock table already has the qkv, o_proj and
dense FFN shapes, the shared-expert shapes come with vllm-project#7772.
Signed-off-by: Vinayak Gokhale <[email protected]>
…P4 linears vLLM's AiterFlyDSLMxfp8LinearKernel (vllm-project/vllm#65479) runs every MiniMax-M3.1 MXFP8 linear through gemm_a8w8_blockscale_bpreshuffle, so it reads this table (AITER_CONFIG_GEMM_A8W8_BLOCKSCALE_MXSCALE_ BPRESHUFFLE), whose M3 rows are bmm-only at power-of-two M. The mxpsh / 8-wave rows tuned for the same shapes in the mxfp8 table (#7772 and the rows before it) are never read on that path. Rows, gfx950 / 256 CUs, 1x32 w_scale, TP4 shapes qkv 2560x6144, o_proj 6144x2048, dense FFN 6144x6144 / 6144x3072, shared expert 1536x6144 / 6144x768, DSpark drafter qkv 2304x6144 and context K/V 1280x6144 (86 added, 59 replaced, none removed): - mxfp8-table rows (kernelId "mxfp8" or "bmm") where every measured M they serve here is at least 3% faster (median) than this table's row and none is more than 3% slower; - rows tuned with the --mxscale_table candidate set (mxpsh, 8-wave and bmm kernels; pruned search, cold weights) where the next power of two serves badly: qkv / drafter qkv M 1152-1536 and 2560-6144, 12288-24576; o_proj 1280-6144; dense FFN 2560; drafter context K/V 2560-3584 and 12288-24576; - on qkv and drafter qkv (M 1088-1536) and drafter context K/V (M 2112-3072), a row at each multiple of 64 with the kernel of the nearest tuned M at or above it, since the padded-M lookup only reaches a row there from M that pad onto it; each checked to stay one wave. Measured on MI355X in one process (CUDA graph, weights cold, pre- quantized MXFP8 input, us; this file vs main's / vLLM's Triton dot_scaled GEMM): qkv M 8 5.2 vs 6.3 / 6.7; M 48 7.2 vs 8.2 / 11.1; M 1208 32.7 vs 40.4 / 37.3; M 5120 70.2 vs 120.7 / 128.3 o_proj M 16 4.2 vs 4.7 / 5.0; M 5120 58.8 vs 63.2 / 100.5 dense gate/up M 1152 62.2 vs 71.3; down M 2560 43.1 vs 67.6 drafter context K/V M 2304 32.6 vs 39.6 / 36.4 Geometric mean over 74 prefill M (320-32768), main's / this file: qkv 1.08, o_proj 1.04, dense 1.11 / 1.07, shared 1.06 / 1.02, drafter 1.06 / 1.03; decode M (multiples of 8 up to 256) 1.00-1.09. No measured M is more than 4% slower than main's file. The rows here give the same bits as vLLM's Triton GEMM at every measured point. Signed-off-by: Vinayak Gokhale <[email protected]>
Summary
This PR adds gfx950 rows for the MiniMax-M3.1 MXFP8 GEMMs to
minimax_m3_a8w8_mxfp8_bpreshuffle_tuned_gemm.csv. The rows cover decode M values between the powers of 2, and two TP4 shapes that use the FlyDSL heuristic today.It also adds MiniMax-M3.1 rows to
minimax_m3_a8w8_blockscale_mxscale_bpreshuffle_tuned_gemm.csv. That is the table vLLM main reads for these linears:AiterFlyDSLMxfp8LinearKernel(vllm#65479) callsgemm_a8w8_blockscale_bpreshuffle, which does not read the mxfp8 table.Changes
Results (MI355X, us per call, CUDA graph, cold weights)
mxscale table, as vLLM main uses it (
AiterFlyDSLMxfp8LinearKernel, same process, us per call; before = main's table):Over prefill M 320 to 32768 the geometric-mean speedup per shape is 1.02 to 1.11, and at decode M 1.00 to 1.09. No measured M is more than 4% slower than with main's table.
Testing
op_tests/test_gemm_a8w8_mxfp8_bpreshuffle.py(same file on main) on the 114 added or changed rows, with this table (headd7d4f81e3): 114 passed, 0 failed (checkAllclose, MI355X, the image's AITER).AiterFlyDSLMxfp8LinearKernel(CUDA graph, cold weights) at 26 grid M and 74 prefill M per shape. Every output is within 1.7e-3 of an fp32 reference (test threshold 5e-3). The dense check removed 6 rows that lost more than 4%.op_tests/tuning_tests/test_csv_validation.pyandtest_config_shape_collision.pyat headd5cca3cc6: 52 passed.Limitations
PR Self-Review
Reviewed revision
d5cca3c
Behavior and intent
The PR adds and changes gfx950 rows in
minimax_m3_a8w8_mxfp8_bpreshuffle_tuned_gemm.csvfor the MiniMax-M3.1 MXFP8 GEMMs. Before, M values between the powers of 2 and two TP4 shapes used the FlyDSL heuristic or the row of another M, which is slower. Each new or changed row is at least 2% faster than the row that main selects, and up to 36% faster. It also adds rows to the mxscale table that vLLM main reads for these linears, where main's table has no row for an M or a slower one. No code changes.Validation and unverified scope
op_tests/test_gemm_a8w8_mxfp8_bpreshuffle.pyon the 114 added or changed rows at head d7d4f81 (MI355X): 114 passed, 0 failed (checkAllclose).test_csv_validation.pyandtest_config_shape_collision.pyat d5cca3c: 52 passed.PR-specific question
The lookup key is (cu_num 256, M, N, K) for these N x K shapes only: 2560 x 6144 and 6144 x 2048 (QKV and o_proj at TP4), 1536 x 6144 and 6144 x 768 (shared expert at TP4), and 6144 x 6144 and 6144 x 3072 (full weights for sequence-parallel prefill). The diff changes no row with another N or K, and the lookup needs an exact key, so all other shapes keep their previous selection. The mxscale rows use the same exact key for the same shapes plus the drafter's 2304 x 6144 and 1280 x 6144.
Changed op tests
None.