Repository navigation
[Config] Add gfx950 a8w8 blockscale bpreshuffle GEMM tunings for Qwen3-14B-FP8 - #6862
Conversation
…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]>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
…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]>
Summary
On gfx950 (MI355X,
cu_num=256)gemm_a8w8_blockscale_bpreshufflehas no tuned rows for theqkv_projando_projshapes 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_projando_projget 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).gate_upanddownshare 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 inmodel_configs/. The existinga8w8_blockscale_tuned_gemm_qwen3_14b.csvis 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:
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 allsearches CK, CK-Tile and ASM: 81 of the kept rows are ASMfp8gemm_bf16_blockscale_BpreShufflekernels (all split-K), 48 CK and 29 CK-Tile, and every one has errRatio 0.0. The pre-run baseline ismain's merged tables, so a row is kept only if it beats whatmainruns 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_envrestores the env var but not theget_config_filecache; that gavegate_upanddowna 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_upM = 1, 2, 4, 8;downM = 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 productiongemm_a8w8_blockscale_bpreshuffle:For example,
o_projat M=4 drops from 24.6 µs to 14.0 µs, andqkv_projat M=1024 from 80.0 µs to 57.5 µs. The 24gate_upanddownrows sit at M values the Qwen3.8-27B table does not list (gate_up6, 12, 168, 176, 416;down72–480), wheremainpads 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_projis 1.76× ando_proj1.71× faster,gate_up1.00× anddown1.02×. Five shapes read 3–8% slower thanmainthere:o_projM=128 and 192 anddownM=72, which the tuner measured at least 3% faster, anddownM=496 andgate_upM=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 callgemm_a8w8_blockscale_bpreshufflefor these four shapes. Both servers use aiter at SGLang's pinned e7d2453, which looks up and dispatches FP32-scale rows the same way asmainand runs every kernel in these rows; they differ only inAITER_CONFIG_GEMM_A8W8_BLOCKSCALE_BPRESHUFFLE,main's merged tables with or without the 158 rows: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 moremainruns afterwards read 6827 and 6866. TPOT moves with throughput and TTFT does not, so the gain is in decode, whereqkv_projando_projrun at M ≤ 64; withAITER_LOG_TUNED_CONFIG=1themainserver logs about 150not found tuned configmisses per run, all for those two shapes, and the PR server none. GSM8K islm_eval5-shot over 1319 questions, greedy,max_gen_toks=256, radix cache off. The PR run differs frommainby less than twomainruns differ from each other (83.4% vs 81.7% identical generations, 98.9% same verdict).Test plan
a8w8_blockscale_bpreshuffletablemainreads: 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) andtest_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 holdingmain's 3421 rows plus these 158.op_tests/tuning_testswith 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.pyandtest_tune_pipeline.pyhit the cap both ways; their other families do not read these files. The failures common to both runs need a newerflydslthan the image has (test_asm_splitk_guard, the gfx1250 case oftest_a16w16_tuned_config_lookup) or are three a8w8 cases oftest_tune_pipeline.Hyperloom found the gap while optimizing
Qwen/Qwen3-14B-FP8on MI355X.Powered by Hyperloom, with human review, writing and testing.