Skip to content

[Config] [Perf] MiniMax-M3.1 MXFP8 GEMM tunings (gfx950) - #7772

Merged
azaidy merged 5 commits into
mainfrom
vinayak/m3-mxfp8-gemm-tunings
Nov 18, 2026
Merged

azaidy merged 5 commits into
mainfrom
vinayak/m3-mxfp8-gemm-tunings

Conversation

@vgokhale

@vgokhale vgokhale commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

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) calls gemm_a8w8_blockscale_bpreshuffle, which does not read the mxfp8 table.

Changes

  • QKV 2560x6144 and o_proj 6144x2048 (TP4): 30 new M rows, 4 changed rows.
  • Shared expert 1536x6144 and 6144x768 (TP4): 64 new rows.
  • Full-weight SP 6144x6144 and 6144x3072: 16 new rows.
  • mxscale table: 86 new rows and 59 changed rows, none removed, for qkv 2560x6144, o_proj 6144x2048, dense 6144x6144 and 6144x3072, shared expert 1536x6144 and 6144x768, and the DSpark drafter's qkv 2304x6144 and context K/V 1280x6144. They are the winning mxfp8-table rows above (converted) plus new rows tuned for prefill M where the table had no row (for example qkv M 1152 to 1536).
  • Rows of other models do not change. All kernel names parse with main's gfx950 parsers.

Results (MI355X, us per call, CUDA graph, cold weights)

Shape M Before After Change
2560 x 6144 40 8.10 7.22 -10.9%
2560 x 6144 288 20.02 14.85 -25.8%
6144 x 2048 32 5.20 4.79 -7.9%
6144 x 2048 320 13.12 11.51 -12.2%
1536 x 6144 64 11.81 7.58 -35.8%
6144 x 768 256 9.79 6.64 -32.2%
6144 x 6144 1536 71.27 62.30 -12.6%

mxscale table, as vLLM main uses it (AiterFlyDSLMxfp8LinearKernel, same process, us per call; before = main's table):

Shape M Before After Change
2560 x 6144 8 6.3 5.2 -17%
2560 x 6144 1208 40.4 32.7 -19%
2560 x 6144 5120 120.7 70.2 -42%
6144 x 2048 16 4.7 4.2 -11%
6144 x 3072 2560 67.6 43.1 -36%
1280 x 6144 2304 39.6 32.6 -18%

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 (head d7d4f81e3): 114 passed, 0 failed (checkAllclose, MI355X, the image's AITER).
  • Every added or changed row: cold A/B against the row that main's lookup uses, on the image's AITER (same kernels and table as main). Each row is at least 2% faster.
  • The A/B removed 9 SP rows that were not 2% faster.
  • mxscale table: same-process A/B through vLLM main's 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.py and test_config_shape_collision.py at head d5cca3cc6: 52 passed.

Limitations

  • gfx950 with 256 CUs only.

PR Self-Review

Reviewed revision

d5cca3c

Behavior and intent

The PR adds and changes gfx950 rows in minimax_m3_a8w8_mxfp8_bpreshuffle_tuned_gemm.csv for 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.py on the 114 added or changed rows at head d7d4f81 (MI355X): 114 passed, 0 failed (checkAllclose).
  • Each added or changed row: a cold A/B against the row that main's lookup selects, with the same kernels and table as main. The A/B removed 9 rows that were not 2% faster.
  • mxscale table: same-process A/B through vLLM main's MXFP8 linear kernel at 26 grid M and 74 prefill M per shape; test_csv_validation.py and test_config_shape_collision.py at d5cca3c: 52 passed.
  • Unverified: GPUs with a CU count other than 256 (the rows use cu_num 256), and other models (they have no rows here).

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.

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]>
@vgokhale vgokhale self-assigned this Nov 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter standard tests on MI35X
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:mi300x Run Aiter standard tests on MI300X in PRs; main branch always runs them
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs (added automatically when gfx942 configs change); main branch always runs both MI35X and MI300X
ci:triton-355 Run the full Triton test suite on MI35X, not only the tests the change affects
ci:windows Windows JIT op smoke test on the Radeon R9700 ROCm runner
ci:multi-gpu Aiter multi-GPU tests on the 8-GPU runner
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: DeepSeek-V4-Pro, MiniMax-M3-MXFP4
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 7772 --add-label <label>

One backend per PR:
A PR changes one kernel backend: [Triton/Gluon] (Triton and Gluon count as one), [HIP], [ASM], [CK], [OPUS] or [FlyDSL]. If the title ends up with two backend tags, split the PR -- as stacked pull requests when one part cannot merge without the other.

PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to stop the title rewrites; labels stay in sync either way.

Reviews:
A reviewer is usually assigned within one working day after the PR is ready for review (see Code Review Process). If nobody has responded for about a week, mention the area contact listed in CONTACTS.md. Want to help review? See REVIEWERS.md.

@vgokhale
vgokhale marked this pull request as ready for review November 10, 2026 22:06
@vgokhale
vgokhale requested a review from a team November 10, 2026 22:06
@aiter-bot

aiter-bot commented Nov 10, 2026 •

Copy link
Copy Markdown

READY FOR HUMAN REVIEW

PR Self-Review

Revision d5cca3cc6ad9 · mode shadow

Author self-review accepted. Readiness report:

Author answers

  • PASS — current-SHA answers are present and structurally specific
Show the author's self-review answers

Behavior and intent

The PR adds and changes gfx950 rows in `minimax_m3_a8w8_mxfp8_bpreshuffle_tuned_gemm.csv` for 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.py` on the 114 added or changed rows at head d7d4f81e3 (MI355X): 114 passed, 0 failed (`checkAllclose`).
- Each added or changed row: a cold A/B against the row that main's lookup selects, with the same kernels and table as main. The A/B removed 9 rows that were not 2% faster.
- mxscale table: same-process A/B through vLLM main's MXFP8 linear kernel at 26 grid M and 74 prefill M per shape; `test_csv_validation.py` and `test_config_shape_collision.py` at d5cca3cc6: 52 passed.
- Unverified: GPUs with a CU count other than 256 (the rows use cu_num 256), and other models (they have no rows here).

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.

PR state

  • PASS — pull request is marked ready for review

Copilot findings

  • PASS — no active Copilot finding lacks a substantive author reply
  • ADVISORY — Copilot did not review the current head SHA

Code and op-test hygiene

  • PASS — no committed artifact or conflict marker detected

Required CI

  • PASS — Black: passed
  • PASS — Ruff: passed
  • PASS — Repository dependency: passed
  • PASS — Aiter Test Gate: passed

Shadow mode reports what would block but keeps the status successful. Set AITER_PR_SELF_REVIEW_MODE=enforce only after reviewing real false positives.

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]>
@zufayu
zufayu requested a review from yifehuan November 11, 2026 00:52
vgokhale added a commit to vgokhale/vllm that referenced this pull request Nov 11, 2026
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]>

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

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants