Skip to content

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

Merged
yifehuan merged 1 commit into
ROCm:mainfrom
mjkvaak-amd:qwen3-8-2p4t-a95b-bf16-gemm-flydsl
Sep 26, 2026
Merged

yifehuan merged 1 commit into
ROCm:mainfrom
mjkvaak-amd:qwen3-8-2p4t-a95b-bf16-gemm-flydsl

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 26 rows covering five of the bf16 GEMM families Qwen3.8-2.4T-A95B executes that AITER has no tuned entry for. Tuned on gfx950, cu_num=256 (MI355X), TP8.

Learned from an earlier PR #5183, no row uses hipBLASLt or opus. #5183 added 75 rows for the same model, of which 63 were hipBLASLt. Review asked for hipBLASLt to be dropped because its solution indices are library-build-specific.

N K rows Module
8192 256 12 MoE down-projection / GDN out_proj
4608 8192 4 Gated DeltaNet in_proj_qkvz, sharded TP8
512 8192 4 MoE router gate
32 8192 3 Gated DeltaNet in_proj_ba, sharded TP8
31040 8192 3 lm_head, vocab 248320 sharded 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. It lists all 81 swept shapes across seven families

Why these backends are safe to check in

backend rows dispatched by portable?
flydsl 19 kernelName yes — kernels live in AITER; falls through to default when a named kernel is absent from the build
asm 4 kernelName + splitK yes — kernels live in AITER
triton 3 solidx=0, kernelName=auto yes — nothing to index

hipblaslt (solidx into hipBLASLt) and opus (kernelId=int(solidx) into opus) are both excluded.

Every row beats the current fallback

Every row is required to beat, by at least 1.02x on the same build, so no shape can regress relative to today's behavior. Winners are the fastest candidate within err_ratio <= 0.005, not the fastest overall. The tuner's default --errRatio 0.05 which we felt was too loose. Shapes where nothing portable won are deliberately absent so the default path is kept.

family shapes swept rows kept best gain over fallback
N=8192, K=256 12 12 1.455x at M=32
N=512, K=8192 12 4 1.390x at M=8
N=4608, K=8192 12 4 1.223x at M=16384
N=32, K=8192 12 3 1.154x at M=4096
N=31040, K=8192 6 3 1.072x at M=8
N=1, K=8192 15 0 nothing portable beats the fallback
N=513, K=8192 12 0 nothing portable beats the fallback

23 of the 26 rows are exactly err_ratio 0.0. The three that are not are the three split-k rows, at 0.0020, 0.0037 and 0.0048 — all inside the bound, but not bit-exact:

M N K libtype splitK err_ratio
16 32 8192 flydsl 2 0.0020
8 512 8192 flydsl 2 0.0037
16 512 8192 flydsl 2 0.0048

Coverage

The lookup tries gl in [None, 0, 1]: exact M, then the two padded buckets from get_padded_m. Replaying that lookup against a production-shaped benchmark that logged 6,127 distinct (M, N, K) shapes (ISL/OSL of 8k/1k, 60k/1k and 128k/1k, all one key variant — torch.bfloat16 in and out, bias=False, scaleAB=False, bpreshuffle=False):

N K observed shapes served served %
8192 256 1,182 1,182 100.0%
32 8192 1,167 709 60.8%
512 8192 1,179 709 60.1%
31040 8192 232 99 42.7%
4608 8192 1,182 50 4.2%
1 8192 1,185 0 0.0%
total 6,127 2,749 44.9%

Tuning shapes were collected at max_num_batched_tokens=16384 and max_num_seqs=256.

End-to-end effect

Serving A/B under vLLM on amd/Qwen3.8-2.4T-A95B-Quark-MXFP4, TP8 on MI355X, 8k input / 1k output, arms differing only by this table.

Geometric mean output throughput +5.1%, geometric mean mean-TTFT −9.6%, geometric mean mean-TPOT −4.6%.

Conc Output tok/s Mean TTFT (ms) Mean TPOT (ms)
4 319.8 → 313.7 (−1.9%) 403.4 → 382.7 (−5.1%) +2.4%
8 460.0 → 467.9 (+1.7%) 450.0 → 487.2 (+8.3%) −2.1%
16 613.7 → 671.5 (+9.4%) 764.1 → 671.6 (−12.1%) −8.6%
32 922.5 → 972.1 (+5.4%) 1,594.6 → 1,383.3 (−13.3%) −4.8%
64 1,231.4 → 1,348.2 (+9.5%) 3,263.6 → 2,373.9 (−27.3%) −7.4%
128 1,673.1 → 1,711.3 (+2.3%) 6,001.4 → 5,731.1 (−4.5%) −2.0%
256 1,938.1 → 2,130.4 (+9.9%) 12,188.9 → 11,094.7 (−9.0%) −9.2%
geomean 854.5 → 898.0 (+5.1%) 1,762 → 1,594 (−9.6%) 34.40 → 32.81 (−4.6%)

c=4 cannot show a GEMM win. The table starts at M=8 and decode M is concurrency padded up to the smallest CUDA-graph capture size, which is 8. The −1.9% there is noise, not a GEMM regression.

…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]>
@mjkvaak-amd
mjkvaak-amd requested a review from a team September 25, 2026 05:52
@github-actions

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 5835 --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 changed the title [Config][Perf] Add tuned bf16 GEMM configs for Qwen3.8-2.4T-A95B on g… [Config] [Perf] Add tuned bf16 GEMM configs for Qwen3.8-2.4T-A95B on g… Sep 25, 2026
@mjkvaak-amd mjkvaak-amd changed the title [Config] [Perf] Add tuned bf16 GEMM configs for Qwen3.8-2.4T-A95B on g… [Config][Perf] Add tuned bf16 GEMM configs for Qwen3.8-2.4T-A95B on gfx950 Sep 25, 2026

@yifehuan yifehuan 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

@yifehuan
yifehuan merged commit 628e8ad into ROCm:main Sep 26, 2026
48 checks passed
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