Skip to content

[Config] [Perf] Add tuned bf16 GEMM configs for Qwen3.8-2.4T-A95B on gfx950 - #5183

Closed
mjkvaak-amd wants to merge 1 commit into
ROCm:mainfrom
mjkvaak-amd:qwen3-8-2p4t-a95b-bf16-gemm-configs
Closed

mjkvaak-amd wants to merge 1 commit into
ROCm:mainfrom
mjkvaak-amd:qwen3-8-2p4t-a95b-bf16-gemm-configs

Conversation

@mjkvaak-amd

Copy link
Copy Markdown
Contributor

What this adds

One tuned table, aiter/configs/model_configs/qwen3_8_2p4t_a95b_bf16_tuned_gemm.csv, with 75 rows covering the seven bf16 GEMM families Qwen3.8-2.4T-A95B executes that AITER has no tuned entry for. Tuned on gfx950, cu_num=256 (MI355X), TP8.

The matching qwen3_8_2p4t_a95b_bf16_untuned_gemm.csv shape list is included so the table can be re-tuned without reconstructing the shapes by hand. The get_config_file glob skips any name containing untuned, so it is documentation and does not affect lookup.

N K rows Module
4608 8192 12 Gated DeltaNet in_proj_qkvz, sharded TP8
32 8192 12 Gated DeltaNet in_proj_ba, sharded TP8
31040 8192 6 lm_head, vocab 248320 sharded TP8
512 8192 6 MoE router, M>=512 only (see TTFT below)
1 8192 15 shared-expert gate (unfused)
8192 256 12 MoE down-projection
513 8192 12 fused shared-expert gate, 512 routed + 1 shared (for FSE quantized model)

Why these shapes

They are the shapes real serving runs logged as misses:

[aiter] shape is M:64, N:4608, K:8192 dtype='torch.bfloat16' ... not found tuned
        config in /tmp/aiter_configs/bf16_tuned_gemm.csv, will use default config!

Two sweeps on two checkpoints contributed: an 18-case MoE-MXFP4 sweep (1,618 distinct shapes) and an 18-case Quark-MXFP4 sweep (custom, non-public checkpoint; 461 distinct shapes). Every miss in both falls into the seven families above. 65 of the model's 92 layers are linear_attention, so the two GDN projections run on nearly every forward pass.

Why 75 rows covers thousands of shapes

The lookup tries gl in [None, 0, 1]: exact M, then the two padded buckets from get_padded_m. Tuning the power-of-two bucket representatives serves every M that pads onto them.

Verified against a full production-shaped benchmark, not just the tuning sweep. A run covering ISL/OSL of 8k/1k, 60k/1k and 128k/1k logged 6,127 distinct (M, N, K) shapes, all in one key variant (torch.bfloat16 in and out, bias=False, scaleAB=False, bpreshuffle=False). Replaying AITER's lookup against every one of them:

6,070 of 6,127 served, by 59 rows. No family outside the seven above appeared, and the thousand-plus distinct M values per family collapse onto a dozen rows each:

N K distinct observed M rows
1 8192 1,185 15
4608 8192 1,182 12
8192 256 1,182 12
512 8192 1,179 6 (57 shapes below M=512 left to the fallback, deliberately)
32 8192 1,167 12
31040 8192 232 6

The 57 unserved shapes are the one deliberate gap: MoE-router GEMMs below M=512, excluded because tuned entries there measurably hurt TTFT. They keep AITER's current behavior, so nothing regresses relative to today.

We collected the untuned shapes at max_num_batched_tokens=16384 and max_num_seqs=256. Raising either past those values is a configuration change that would put shapes outside the tuned table.

Per-shape gain over the current fallback

Best speedup over AITER's torch/rocBLAS fallback, per family, measured from the tuner's own profile output and restricted to numerically-clean candidates (below):

family shapes beating the fallback best
N=1, K=8192 15/15 3.16x at M=1
N=32, K=8192 12/12 1.38x at M=128
N=512, K=8192 6/6 1.28x at M=1024
N=513, K=8192 12/12 1.37x at M=8
N=4608, K=8192 11/12 1.56x at M=256
N=8192, K=256 12/12 1.49x at M=256
N=31040, K=8192 6/6 1.14x at M=64

Every winner is numerically exact

All 75 rows have err_ratio 0.0000 against the reference.

This is worth stating because the tuner's default --errRatio 0.05 does not give you that. Selecting on speed alone, flydsl split-k kernels won six N=512 shapes at err_ratio 0.015–0.030, while hipblaslt, opus, torch and triton all reached 0.000 on the identical shape. Those winners were re-picked as the fastest candidate within err_ratio <= 0.005.

End-to-end effect

Serving A/B under vLLM on the public amd/Qwen3.8-2.4T-A95B-Quark-MXFP4, TP8, three repeats per case, arms differing only by this table.

Geometric mean output throughput +2.25%, mean TPOT +2.23%, mean TTFT +1.38%
(all concurrencies clean in both arms):

Conc Output tok/s Mean TTFT Mean TPOT
4 251.7 → 251.5 (−0.1%) 316.0 → 319.6 (−1.1%) −0.0%
16 671.2 → 700.7 (+4.4%) 830.8 → 835.4 (−0.6%) +4.4%
32 1,049.1 → 1,079.6 (+2.9%) 1,209.6 → 1,159.9 (+4.1%) +2.8%
64 1,660.0 → 1,696.1 (+2.2%) 1,695.2 → 1,663.6 (+1.9%) +2.1%
128 2,462.4 → 2,509.4 (+1.9%) 2,564.7 → 2,501.2 (+2.5%) +1.8%

N=513 gate rows, measured separately on the fused shared-expert path:
+0.4% geometric mean, TPOT −0.3% to −1.3%, directionally consistent across six
cases.

Accuracy

GSM8K, 5-shot, all 1319 problems, greedy, on amd/Qwen3.8-2.4T-A95B-Quark-MXFP4, compared per-problem against the stock arm on the same vLLM build (v0.27.2rc1.dev150+g311b3513a) with the same eval settings:

baseline tuned delta McNemar p
strict-match 0.9333 0.9265 −0.0068 0.391
flexible-extract 0.9318 0.9272 −0.0045 0.594

No detectable accuracy change.


Co-authored-by: Cursor

…fx950

Qwen3.8-2.4T-A95B served at TP8 executes seven bf16 GEMM families that have
no tuned entry, so every one of them falls back to rocBLAS. Add 75 rows
covering them, tuned on gfx950 / cu_num=256.

  N=4608  K=8192  12 rows  Gated DeltaNet in_proj_qkvz
  N=32    K=8192  12 rows  Gated DeltaNet in_proj_ba
  N=31040 K=8192   6 rows  lm_head, vocab 248320 sharded TP8
  N=512   K=8192   6 rows  MoE router, M>=512 only (see below)
  N=1     K=8192  15 rows  shared-expert gate, unfused
  N=8192  K=256   12 rows  MoE down-projection
  N=513   K=8192  12 rows  fused shared-expert gate, 512 routed + 1 shared

Every row has err_ratio 0.0000 against the reference. Winners were selected
as the fastest candidate within err_ratio <= 0.005 rather than on speed
alone: at the tuner's default 0.05 tolerance, flydsl split-k kernels win
several N=512 shapes with err_ratio 0.015-0.030 while hipBLASLt, torch and
triton all reach 0.000 on the identical shape.

The MoE router is tuned only at M>=512 by choice. Leaving those shapes to the
existing fallback is faster than tuned alternatives.

Measured under vLLM on amd/Qwen3.8-2.4T-A95B-Quark-MXFP4, TP8, three repeats
per case, arms differing only by this table: geometric mean
output throughput +2.25%, mean TPOT +2.23%, mean TTFT +1.38%. GSM8K 5-shot
over all 1319 problems shows no detectable accuracy change.

Coverage was verified by replaying AITER's get_padded_m lookup against a
long-context benchmark (ISL/OSL 8k/1k, 60k/1k, 128k/1k) that logged 6127
distinct (M, N, K) shapes: 6070 are served, the remaining 57 being the
deliberate sub-M=512 router gap.

No family here appears in any bf16 tuned table currently on main,
and no row duplicates an existing shape key.

Signed-off-by: Mikko Tukiainen <[email protected]>
Co-authored-by: Cursor <[email protected]>
@mjkvaak-amd
mjkvaak-amd requested a review from a team September 1, 2026 13:15
@github-actions github-actions Bot changed the title [Config][Perf] Add tuned bf16 GEMM configs for Qwen3.8-2.4T-A95B on gfx950 [Config] [Perf] Add tuned bf16 GEMM configs for Qwen3.8-2.4T-A95B on gfx950 Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

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

Extended tests (opt-in via labels):

Label Tests
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; main branch always runs both MI35X and MI300X
multigpu 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: GPT-OSS-120B, DeepSeek-R1-0528, Kimi-K2.5
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 5183 --add-label <label>

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 opt this PR out.

@github-actions github-actions Bot added the Config label Sep 1, 2026
@zufayu
zufayu requested a review from yifehuan September 2, 2026 01:21
gfx950,256,1,1,8192,False,torch.bfloat16,torch.bfloat16,False,False,skinny,2,0,3.2932,sol2,0.0,0.0,9.95
gfx950,256,2,1,8192,False,torch.bfloat16,torch.bfloat16,False,False,skinny,2,0,4.0563,sol2,0.0,0.01,12.12
gfx950,256,4,1,8192,False,torch.bfloat16,torch.bfloat16,False,False,skinny,2,0,5.6019,sol2,0.0,0.01,14.63
gfx950,256,8,1,8192,False,torch.bfloat16,torch.bfloat16,False,False,hipblaslt,439633,0,6.4201,Cijk_Alik_Bljk_BBS_BH_Bias_HA_S_SAV_UserArgs_MT16x16x512_MI16x16x1_SN_LDSB0_AFC0_AFEM1_AFEM1_ASEM1_CLR1_CADS0_DTLA1_DTLB1_DTVA0_DTVB0_EPS0_FDSI0_GRPM1_GRVWA8_GRVWB8_GSU0_GSUAMB_GLS0_ISA950_IU1_K1_LDSTI0_LBSPPA1024_LBSPPB1024_LBSPPM0_LPA16_LPB16_LPM0_LRVW8_LWPMn1_MIAV0_MIWT1_1_MO40_NTn1_NTA7_NTB2_NTC2_NTD0_NTM0_NEPBS4_NLCA1_NLCB1_ONLL1_PGR2_PLR1_PKA1_SIA3_SS0_SPO1_SRVW0_SSO0_SVW1_SK3_SKFTR0_SKXCCM0_TLDS1_ULSGRO0_USL1_UIOFGRO0_USFGRO1_VSn1_VWA1_VWB1_WSGRA0_WSGRB0_WS64_WG16_4_4,0.0,0.02,22.97

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.

Please exclude hipblaslt from the checked-in tuned configs. This table contains 63 hipBLASLt entries whose solution indices are library-version dependent and should not be shipped in the shared configs. Please reselect the best candidates from the remaining backends, retain the default fallback where appropriate, and update the performance results.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yifehuan The hipBLASLt (and Opus) -free table is 15 rows and results in+0.35% uplift, against the 75-row table's +2.25%. I will close the PR as a dud.

@mjkvaak-amd mjkvaak-amd closed this Sep 9, 2026
mjkvaak-amd added a commit to mjkvaak-amd/aiter that referenced this pull request Sep 25, 2026
…fx950

Qwen3.8-2.4T-A95B served at TP8 executes seven bf16 GEMM families that have
no tuned entry, so every one of them falls back to rocBLAS. Add 26 rows
covering the five families where a portable backend is measurably faster
than that fallback, tuned on gfx950 / cu_num=256.

  N=8192  K=256   12 rows  MoE down-projection / GDN out_proj
  N=4608  K=8192   4 rows  Gated DeltaNet in_proj_qkvz
  N=512   K=8192   4 rows  MoE router gate
  N=32    K=8192   3 rows  Gated DeltaNet in_proj_ba
  N=31040 K=8192   3 rows  lm_head, vocab 248320 sharded TP8

This supersedes ROCm#5183, which shipped 75 rows of which 63 were hipBLASLt.
Review asked for hipBLASLt to be dropped because its solution indices are
build-specific. Re-picking from that PR's tuning data left 15 rows worth
only +0.35% end to end, so ROCm#5183 was closed. Re-tuning against the gfx950
A16W16 FlyDSL kernels added in ROCm#5145 changes the answer: 26 rows, +5.1%.

No row uses hipBLASLt or opus. Both dispatch on an integer index into an
external library (hipblaslt solidx, opus kernelId), which is the fragility
the review objected to. flydsl and asm are looked up by kernelName and the
kernels live in AITER itself; flydsl additionally falls through to the
default when a named kernel is absent from the build. triton is solidx=0
with kernelName=auto.

Every row is required to beat the kernel AITER picks with no tuned entry,
measured on the same build, so no row can be slower than today's behaviour.
Shapes where nothing portable beat the fallback are deliberately left out
rather than filled in. That is why 26 rows replace 75.

Winners were selected as the fastest candidate within err_ratio <= 0.005
rather than on speed alone; the tuner's default 0.05 would have picked
split-k kernels an order of magnitude further from the reference. 23 of the
26 rows are exactly 0.0; the three split-k rows are 0.0020-0.0048.

Measured under vLLM on amd/Qwen3.8-2.4T-A95B-Quark-MXFP4, TP8, MI355X,
8k/1k at concurrency 4-256, arms differing only by this table: geometric
mean output throughput +5.1%, geometric mean mean-TTFT -9.6%.

Signed-off-by: Mikko Tukiainen <[email protected]>
Co-authored-by: Cursor <[email protected]>
yifehuan pushed a commit that referenced this pull request Sep 26, 2026
…fx950 (#5835)

Qwen3.8-2.4T-A95B served at TP8 executes seven bf16 GEMM families that have
no tuned entry, so every one of them falls back to rocBLAS. Add 26 rows
covering the five families where a portable backend is measurably faster
than that fallback, tuned on gfx950 / cu_num=256.

  N=8192  K=256   12 rows  MoE down-projection / GDN out_proj
  N=4608  K=8192   4 rows  Gated DeltaNet in_proj_qkvz
  N=512   K=8192   4 rows  MoE router gate
  N=32    K=8192   3 rows  Gated DeltaNet in_proj_ba
  N=31040 K=8192   3 rows  lm_head, vocab 248320 sharded TP8

This supersedes #5183, which shipped 75 rows of which 63 were hipBLASLt.
Review asked for hipBLASLt to be dropped because its solution indices are
build-specific. Re-picking from that PR's tuning data left 15 rows worth
only +0.35% end to end, so #5183 was closed. Re-tuning against the gfx950
A16W16 FlyDSL kernels added in #5145 changes the answer: 26 rows, +5.1%.

No row uses hipBLASLt or opus. Both dispatch on an integer index into an
external library (hipblaslt solidx, opus kernelId), which is the fragility
the review objected to. flydsl and asm are looked up by kernelName and the
kernels live in AITER itself; flydsl additionally falls through to the
default when a named kernel is absent from the build. triton is solidx=0
with kernelName=auto.

Every row is required to beat the kernel AITER picks with no tuned entry,
measured on the same build, so no row can be slower than today's behaviour.
Shapes where nothing portable beat the fallback are deliberately left out
rather than filled in. That is why 26 rows replace 75.

Winners were selected as the fastest candidate within err_ratio <= 0.005
rather than on speed alone; the tuner's default 0.05 would have picked
split-k kernels an order of magnitude further from the reference. 23 of the
26 rows are exactly 0.0; the three split-k rows are 0.0020-0.0048.

Measured under vLLM on amd/Qwen3.8-2.4T-A95B-Quark-MXFP4, TP8, MI355X,
8k/1k at concurrency 4-256, arms differing only by this table: geometric
mean output throughput +5.1%, geometric mean mean-TTFT -9.6%.

Signed-off-by: Mikko Tukiainen <[email protected]>
Co-authored-by: Cursor <[email protected]>
akii96 added a commit to akii96/aiter that referenced this pull request Sep 27, 2026
Adds `minimax_m3_bf16_tuned_gemm.csv` (78 rows) covering the bf16 GEMM
families MiniMax-M3 executes that had no tuned entry, across TP8, TP4 and
TP2. Tuned on gfx950, cu_num=256 (MI355X).

The shipped `minimax_m3_mxfp4_bf16_tuned_gemm.csv` covers M=16..512 at
TP8 only, so decode is served but every prefill M is unserved, and TP4/TP2
are largely unserved. On an 8k/1k workload prefill is the majority of the
tokens, so those shapes fall back to `torch solution:0`.

Following the review of ROCm#5183/ROCm#5835, no row uses hipblaslt or opus: their
solution indices are library-build-specific. Backends are flydsl (75) and
triton (3), both dispatched by kernelName and portable.

Winners are the fastest candidate within err_ratio <= 0.005 rather than the
tuner's default 0.05, which is loose enough to select split-k kernels an
order of magnitude further from the reference. 75 of 78 rows are exactly
0.0; the remaining three are 0.0049, 0.0050 and 0.0050. 76 rows are
splitK=1.

Families covered (per-rank N,K):

  TP8   1536x6144 sparse qkv+index proj   1280x6144 dense qkv
        6144x1024 o_proj                  3072x6144 dense gate_up
        6144x1536 dense down              25008x6144 lm_head
  TP4   2560x6144, 2304x6144, 6144x2048, 6144x6144, 6144x3072, 50016x6144
  TP2   5120x6144, 4608x6144, 6144x4096, 12288x6144, 100032x6144

The matching `minimax_m3_bf16_untuned_gemm.csv` shape list is included so
the table can be re-tuned without reconstructing the shapes by hand.

Shapes were derived from the architecture (hidden 6144, 64 q heads, 4 kv
heads, 4 index heads, head_dim 128, dense_intermediate 12288, vocab
200064) rather than captured, and validated against the existing table:
the TP8 derivations land exactly on its 1280x6144 and 1536x6144 entries.
Note 4 kv heads and 4 index heads are replicated rather than split at TP8.

Not measured end to end.
akii96 added a commit to akii96/aiter that referenced this pull request Sep 27, 2026
Replaces the 78 tuned rows with 265 tuned against the M values the workload
actually issues, covering TP8, TP4 and TP2. gfx950, cu_num=256.

The previous rows were tuned at assumed prefill sizes (2048, 4096, 8192,
16384, 32768). Chunked prefill does not produce those: the real M values are
526, 746, 757, 8192, 8244, 8248, 16854, 16932, 16946, 16976, 24581, 24601,
24673, 24675, 25057, 25321, 32768, and lm_head runs at M=6..16. Only 8192 and
32768 ever coincided, and 8248 does not reach 8192 through the padded-M
lookup, so an end-to-end run with the old table recorded 56 lookups and 0
hits. This table is keyed on the observed values.

Every row beats the current fallback by at least 1.02x on the same build, so
no shape can regress. Winners are the fastest candidate within err_ratio
<= 0.005 rather than the tuner default of 0.05, which is loose enough to
select split-k kernels an order of magnitude further from the reference.
All 265 rows are exactly 0.0, and no row uses split-k.

Following the review of ROCm#5183/ROCm#5835, no row uses hipblaslt or opus, whose
solution indices are specific to a library build. Backends are flydsl (202)
and triton (63), both dispatched by kernelName.

Per-rank families, 17 M values each (11 for lm_head):

  TP8   1536x6144 sparse qkv+index proj   1280x6144 dense qkv
        6144x1024 o_proj                  3072x6144 dense gate_up
        6144x1536 dense down              25008x6144 lm_head
  TP4   2560x6144, 2304x6144, 6144x2048, 6144x6144, 6144x3072, 50016x6144
  TP2   5120x6144, 4608x6144, 6144x4096, 12288x6144, 100032x6144

Shapes were mined from 11 vLLM serve logs at TP8; M is a token count and does
not scale with tensor parallelism, so the TP4 and TP2 rows reuse the same M
values with N and K derived from the architecture. The TP8 derivations
reproduce the six families seen in the logs. Note 4 kv heads and 4 index
heads are replicated rather than split at TP8.

Not measured end to end.
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.

2 participants