Repository navigation
[Config] Add Gemma-4-31B TP1 a4w4 blockscale GEMM tunings for gfx950 - #5928
prashant182 wants to merge 2 commits into
Conversation
44 tuned rows for the six (N, K) widths Gemma-4-31B (Quark MXFP4 W4A4) drives at TP1 on gfx950 / cu_num=256: qkv 16384x5376 and 20480x5376, gate_up 43008x5376, o_proj 5376x8192 and 5376x16384, down 5376x21504, at M in 16..16384. The untuned CSV is the shape list they were tuned from. Only rows beating the default by >= 3% are kept.
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
| 16,5376,21504 | ||
| 16,20480,5376 | ||
| 16,5376,16384 | ||
| 32,16384,5376 |
There was a problem hiding this comment.
32,16384,5376 not in tuned gemm csv. is this expected?
There was a problem hiding this comment.
Yes, that's expected. For (32, 16384, 5376) the tuner's best candidate was slower than the default: 15.98 µs against 15.53 µs (0.97x; the tuner's --compare row is below). That fails the >= 3% rule from #5421, so the row was dropped. It is one of 22 shapes in the untuned list with no tuned row.
(32, 16384, 5376) | 15.53 | 15.98 | 0.97x | OK
The missing row does not change dispatch. The lookup tries M = 32 as is, then getPaddedM at gl 0 (32) and gl 1 (nextPow2, 32). None of those has a row, so the call keeps main's default, the same as without this file. The re-time on main agrees: 34.28 µs without this file and 35.24 µs with it, the same default kernel within noise.
|
End to end on vLLM's current ROCm nightly. I applied this PR's file alone to the
One caveat: these two engines ran side by side on different GPUs of one box, where the GPU-to-GPU spread is about 3.5%. The same-GPU A/B in the description (vLLM @yzhou103, the M=32 question is answered inline. Let me know if you would like anything else changed. |
Adds 44 tuned
a4w4_blockscalerows for Gemma-4-31B at TP1 on gfx950 /cu_num=256, plus the untuned shape list they were tuned from.What this adds
The rows cover the six GEMM widths that Gemma-4-31B (AMD Quark MXFP4 W4A4,
amd/gemma-4-31B-it-MXFP4) drives at TP1:M covers 16 to 16384 in powers of two.
gemma4_31b_a4w4_blockscale_untuned_gemm.csvholds the 66 shapes they were tuned from.Without these rows, every Gemma 4 a4w4 call logs "not found tuned config" and falls back to the default.
Results
Re-timed on one MI355X (gfx950) against
main(330f127). Each of the 66 Gemma 4 shapes was run throughaiter.gemm_a4w4(..., bpreshuffle=True)with the input quantized byper_1x32_f4_quant_hip, taking the median of 20 calls. The only difference between the two runs is this file inmodel_configs/.main's default, by 1.03x to 1.82x.downando_projat M 16 to 512 (1.12x to 1.44x) and at M >= 8192 (1.11x to 1.19x).qkv(N 20480) improves 1.76x at M 512 and 1.82x at M 1024.Selected rows, in µs:
mainIn vLLM (
v0.30.0, aiterv0.1.21.post2, TP1), with this file as the only variable on top of the other Gemma 4 changes, prefill with 16 concurrent 10K-token prompts went from 3.99 to 4.00 req/s without it to 4.16 req/s with it (+4%). GSM8K (250 problems) was unchanged at 98.8%.Method and validation
Tuning.
csrc/ck_gemm_a4w4_blockscale/gemm_a4w4_blockscale_tune.py -i <untuned> --compareon one MI355X (about 15 minutes).get_padded_mmaps M > 4096 to the 8192 row, so the tuned rows cover every prefill chunk size.Validation.
csrc/ck_gemm_a4w4_blockscale/validate_tuned_csv.py: PASS on 44 rows (41 ASM, 3 CK), max errRatio 0.0, TFLOPS consistent with µs. The only warning is thegfxextra column, which every model config carries.op_tests/tuning_tests/test_csv_validation.py: 17 passed.op_tests/tuning_tests/test_config_shape_collision.py: skipped locally because it needs a ROCm install. I ran the equivalent check by hand: zero duplicate(gfx, cu_num, M, N, K)keys against the 2,526 rows in the five a4w4 sources thatmainmerges at runtime.kernelNameexists onmain: the 41 ASM names are inhsa/gfx950/f4gemm/*.csv, and CK instance 14 (256x32x128x128_...) is ingemm_a4w4_blockscale_common.py.Scope and caveats
v0.1.21.post2and re-timed onmain(above). They name kernels bykernelName, and every name is present onmain.Submission Checklist