Skip to content

[Config] Add gfx950 a8w8 blockscale bpreshuffle GEMM tunings for Qwen3-14B-FP8 - #6862

Merged
yifehuan merged 1 commit into
ROCm:mainfrom
lishuoshuo-amd:qwen3-14b-gfx950-bpreshuffle-tuned
Oct 23, 2026
Merged

yifehuan merged 1 commit into
ROCm:mainfrom
lishuoshuo-amd:qwen3-14b-gfx950-bpreshuffle-tuned

Conversation

@lishuoshuo-amd

Copy link
Copy Markdown
Contributor

Summary

On gfx950 (MI355X, cu_num=256) gemm_a8w8_blockscale_bpreshuffle has no tuned rows for the qkv_proj and o_proj shapes of Qwen3-14B-FP8 at TP1, so every M runs the CK default instance (256x64x64x128, intrawave v1). This PR adds 158 rows for the model's four block-FP8 linear shapes, plus the 268-shape untuned list they were tuned from. qkv_proj and o_proj get 1.17–1.87× faster than the default (geometric mean 1.42× and 1.47×), and SGLang's output throughput on Qwen3-14B-FP8 goes up 8.8% (6847 → 7449 tok/s).

model layer (N, K) rows
Qwen3-14B qkv (7168, 5120) 67
Qwen3-14B o (5120, 5120) 67
Qwen3-14B gate_up (34816, 5120) 5
Qwen3-14B down (5120, 17408) 19

gate_up and down share their shapes with Qwen3.8-27B, whose rows already serve them, so only the M values where a new kernel beats that dispatch by at least 3% are added. No existing file changes and no new key collides with a row in model_configs/. The existing a8w8_blockscale_tuned_gemm_qwen3_14b.csv is the gfx942 non-preshuffled table and is unrelated.

How the configs were made

On this repo's main (e47b98d), one MI355X node with 4 GPUs:

python3 csrc/ck_gemm_a8w8_blockscale/gemm_a8w8_blockscale_tune.py \
  -i aiter/configs/model_configs/a8w8_blockscale_bpreshuffle_untuned_gemm_qwen3_14b.csv \
  -o /tmp/qwen3_14b_bpreshuffle_tuned.csv --preshuffle --libtype all --mp 4 --batch 300 \
  --compare --update_improved --min_improvement_pct 3

The untuned list is the four shapes at M = 1, 2, 4, 6, 12, every multiple of 8 up to 256, every multiple of 16 up to 512, 1024, 2048, 4096 and every multiple of 1024 from 6144 to 16384. --libtype all searches CK, CK-Tile and ASM: 81 of the kept rows are ASM fp8gemm_bf16_blockscale_BpreShuffle kernels (all split-K), 48 CK and 29 CK-Tile, and every one has errRatio 0.0. The pre-run baseline is main's merged tables, so a row is kept only if it beats what main runs today by at least 3%.

All 268 shapes run as one compare batch. With the default batch size of 100, the pre-tune benchmark of batches 2 and 3 reads the previous batch's compare CSV instead of main's tables, because _restore_config_env restores the env var but not the get_config_file cache; that gave gate_up and down a CK-default baseline and overstated their gain. 28 shapes whose pre-run had failed against a production module left over from that earlier run were re-run after a clean rebuild. 6 tuned keys that already exist in the Qwen3.8-27B table (gate_up M = 1, 2, 4, 8; down M = 80, 512) are left out.

Results (MI355X, gfx950, ROCm 10.0)

Speedup over main's dispatch, from the tuner's pre-run and post-run through the production gemm_a8w8_blockscale_bpreshuffle:

(N, K) M=1 M=4 M=16 M=64 M=256 M=1024 M=4096 M=16384
(7168, 5120) 1.67× 1.61× 1.69× 1.55× 1.17× 1.39× 1.53× 1.78×
(5120, 5120) 1.82× 1.76× 1.84× 1.58× 1.22× 1.18× 1.66× 1.70×

For example, o_proj at M=4 drops from 24.6 µs to 14.0 µs, and qkv_proj at M=1024 from 80.0 µs to 57.5 µs. The 24 gate_up and down rows sit at M values the Qwen3.8-27B table does not list (gate_up 6, 12, 168, 176, 416; down 72–480), where main pads onto a neighbouring row; they are 1.03–1.29× faster than that.

Re-timed outside the tuner (hot weights, 50 calls per shape), all 268 shapes resolve to their rows and match a dequantized fp32 reference (max relative error 0.78%, as on main); summed per shape, qkv_proj is 1.76× and o_proj 1.71× faster, gate_up 1.00× and down 1.02×. Five shapes read 3–8% slower than main there: o_proj M=128 and 192 and down M=72, which the tuner measured at least 3% faster, and down M=496 and gate_up M=400, which have no row and pad onto one.

End to end in SGLang 0.5.21 (lmsysorg/sglang-rocm:v0.5.21-rocm10-mi35x-20261008), TP1, where gfx950 block-FP8 linears call gemm_a8w8_blockscale_bpreshuffle for these four shapes. Both servers use aiter at SGLang's pinned e7d2453, which looks up and dispatches FP32-scale rows the same way as main and runs every kernel in these rows; they differ only in AITER_CONFIG_GEMM_A8W8_BLOCKSCALE_BPRESHUFFLE, main's merged tables with or without the 158 rows:

GSM8K strict out tok/s TPOT mean / median TTFT mean / median
main 0.8901 (repeat 0.8848) 6847 9.25 / 9.25 ms 104.7 / 104.9 ms
this PR 0.8901 7449 (+8.8%) 8.49 / 8.49 ms 104.1 / 107.6 ms

Throughput is 320 random prompts, 1024 in / 1024 out, concurrency 64, --kv-cache-dtype fp8_e4m3, a fresh server per run, four runs per arm on one GPU with the first discarded: 6857 / 6843 / 6847 → 7449 / 7435 / 7451 tok/s, and two more main runs afterwards read 6827 and 6866. TPOT moves with throughput and TTFT does not, so the gain is in decode, where qkv_proj and o_proj run at M ≤ 64; with AITER_LOG_TUNED_CONFIG=1 the main server logs about 150 not found tuned config misses per run, all for those two shapes, and the PR server none. GSM8K is lm_eval 5-shot over 1319 questions, greedy, max_gen_toks=256, radix cache off. The PR run differs from main by less than two main runs differ from each other (83.4% vs 81.7% identical generations, 98.9% same verdict).

Test plan

  • Merged with every a8w8_blockscale_bpreshuffle table main reads: 11 files, 3579 rows, no duplicate (gfx, cu_num, M, N, K) key, identical headers.
  • op_tests/tuning_tests/test_csv_validation.py (19 passed) and test_config_shape_collision.py (26 passed) with the files in place.
  • test_run_config.py::TestRunConfig::test_a8w8_blockscale_bpreshuffle, which runs every merged row through the production op: passed, with its merged table holding main's 3421 rows plus these 158.
  • The rest of op_tests/tuning_tests with and without the files, file by file with a 30-minute cap per file: every case that finished has the same result both ways. test_run_config.py and test_tune_pipeline.py hit the cap both ways; their other families do not read these files. The failures common to both runs need a newer flydsl than the image has (test_asm_splitk_guard, the gfx1250 case of test_a16w16_tuned_config_lookup) or are three a8w8 cases of test_tune_pipeline.

Hyperloom found the gap while optimizing Qwen/Qwen3-14B-FP8 on MI355X.


Powered by Hyperloom, with human review, writing and testing.

…3-14B-FP8

158 tuned rows for the four (N, K) widths Qwen3-14B-FP8 (128x128 block
scales) drives at TP1 on gfx950 / cu_num=256: qkv 7168x5120 and o_proj
5120x5120 (67 rows each), gate_up 34816x5120 (5) and down 5120x17408
(19), at M in 1..16384. The untuned CSV is the 268-shape list.

Tuned on main with gemm_a8w8_blockscale_tune.py --preshuffle --libtype
all --compare --update_improved --min_improvement_pct 3, so each row
beats main's current dispatch by at least 3%. Keys already present in
the Qwen3.8-27B table are left out, so no existing file changes.

SGLang TP1, ISL/OSL 1024/1024, concurrency 64 on MI355X: output
throughput 6847 -> 7449 tok/s (+8.8%), median TPOT 9.25 -> 8.49 ms,
TTFT flat. GSM8K 5-shot strict-match 0.8901 -> 0.8901 (base repeat
0.8848).

Generated-by: Hyperloom
Signed-off-by: lishuoshuo-amd <[email protected]>
@lishuoshuo-amd
lishuoshuo-amd requested a review from a team October 23, 2026 07:57
@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 (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 gfx1201 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 6862 --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.

@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 18946ab into ROCm:main Oct 23, 2026
56 checks passed
yifehuan pushed a commit that referenced this pull request Oct 27, 2026
…unings for Qwen3-14B-FP8 (#6898)

Retuned with --splitK, which #6862 left out, so its ASM candidates only ran at splitK=1.

Signed-off-by: xiaofei.zheng <[email protected]>
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