Skip to content

[Config] [Perf] Retune 48 large-batch BF16 GEMM rows for gfx950 - #8317

Merged
yifehuan merged 1 commit into
ROCm:mainfrom
iraj465:config/bf16-gemm-gfx950-large-m-library-rows
Nov 26, 2026
Merged

yifehuan merged 1 commit into
ROCm:mainfrom
iraj465:config/bf16-gemm-gfx950-large-m-library-rows

Conversation

@iraj465

@iraj465 iraj465 commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Retunes 48 gfx950 (256 CU) rows of the BF16 GEMM tables, in place. All 48 are large-batch rows (M from 1984 to 66576) that name a FlyDSL kernel on main. At these sizes a library kernel is faster, so 44 rows move to torch (hipBLASLt) and 4 to the asm kernel bf16gemm_bf16_tn_256x256. Rows only: no code change, and no key is added or removed.

On MI355X the production call aiter.tuned_gemm.gemm_a16w16 gets 1.32x faster at these shapes (geometric mean; 1.04x to 2.10x). On MI350X one tuner run measures 1.33x for the same rows (1.04x to 2.05x), and a replay of the production call gives 1.29x (1.02x to 2.10x); no row and no sampled call size is slower than main there.

Served through vLLM 0.33.0 at tensor-parallel 1, a model of the Llama-3.3-70B architecture prefills 3.7% to 4.5% faster when a prefill step holds 1,025 to 2,048 token rows, and is unchanged at the other step sizes (details under Performance).

Motivation

The gfx950 BF16 tables hold many FlyDSL rows for large batches: at main e359f953d, where this work started, 422 rows with M >= 1536 named a FlyDSL or Triton kernel. Those tiles are strong at decode sizes. At prefill sizes a number of the rows are slower than the library path that an untuned shape takes anyway (torch). Example: minimax_m3_eagle, M = 32768, N = 2304, K = 6144 takes 1408 us with main's row and 673.5 us with torch.

These rows are reached from serving. With AITER enabled on gfx950, vLLM sends unquantized linear layers to aiter.tuned_gemm.tgemm.mm (read at vLLM main 52fae19fb), and there M is the number of token rows in the batch, so these sizes are prefill batches.

#5159 reports the same for three gptoss rows, and #7479 for the Llama-3.1-405B table.

Changes

  • 48 rows replaced in place in 8 files under aiter/configs/model_configs/: minimax_m3_mxfp4_bf16_tuned_gemm.csv (23), minimax_m3_eagle_bf16_tuned_gemm.csv (10), llama70B_bf16_tuned_gemm.csv (5), dsv4_bf16_tuned_gemm.csv (3), kimik3_bf16_tuned_gemm.csv (3), glm5_bf16_tuned_gemm.csv (2), gptoss_bf16_tuned_gemm.csv (1), qwen32B_bf16_tuned_gemm.csv (1).
  • Before: FlyDSL in all 48. After: torch 44, asm 4 (bf16gemm_bf16_tn_256x256).
  • In each row only libtype, solidx, splitK, us, kernelName, err_ratio, tflops and bw change. Every other line of the 8 files is byte-identical, and no key is added or removed.
  • Which calls change: gfx950 with 256 CUs, BF16 in and out, at the 48 (M, N, K, bias) keys, and at the other M that the lookup pads to these rows. 23 of the rows serve only their own M; 25 also serve other M (listed under Performance).
  • Left out on purpose:
    • 8 rows of llama405B_bf16_tuned_gemm.csv that qualify the same way. [Config] [Perf] Retune Llama-3.1-405B BF16 GEMM config for gfx950 #7479 retunes that whole table, so this PR does not touch the file.
    • 14 rows that are faster on MI355X but slower than main's row on MI350X. Both devices read the same gfx950 / 256 CU key.
    • 6 rows that win at their own M but whose new kernel is slower than main's at another M that the same row serves (the lookup pads that M to the row), so the change would make those calls slower.
    • 1 row that came out below 1.03x at its own M in the last A/B.

Performance (if applicable)

Production call aiter.tuned_gemm.gemm_a16w16(x, w, bias, otype) on random data. Before = main 8eed98cce. After = that main with this PR's rows. Each arm runs in its own process, the arms take turns, 5 rounds. A CUDA graph holds 2 to 50 calls (about 20 ms) and is timed two ways: one buffer set replayed ("warm"), and rotating copies of all inputs as aiter.test_common makes them ("cold", which is what the tuner measures). Per round the time is the median of 5 repeats of 8 replays, and a round counts only when that median is within 3% of its fastest repeat. The ratio is the median over the rounds.
At 8 of the 598 timed cases the repeats of one arm differ by more than 3% in every round (the kernel itself varies), so no round passes that filter. For those the ratio is taken over all rounds; main's fastest repeat against the new row's slowest repeat is still at least 1.00x there.

Hardware Workload/configuration Before After Change
MI355X (gfx950, 256 CUs) 48 retuned shapes, warm: geometric mean (smallest to largest) - - 1.32x (1.04x to 2.10x)
MI355X (gfx950, 256 CUs) 48 retuned shapes, cold: geometric mean (smallest to largest) - - 1.36x (1.03x to 2.11x)
MI355X (gfx950, 256 CUs) 550 other M served by 25 of the rows, warm - - 1.46x (1.03x to 2.74x)
MI355X (gfx950, 256 CUs) 550 other M served by 25 of the rows, cold - - 1.47x (1.03x to 2.87x)
MI355X (gfx950, 256 CUs) 48 retuned shapes, tuner --compare, median of three runs - - 1.33x (1.04x to 2.09x)
MI350X (gfx950, 256 CUs) 48 retuned shapes, tuner, one run - - 1.33x (1.04x to 2.05x)
MI350X (gfx950, 256 CUs) 48 retuned shapes, production call, warm replay - - 1.29x (1.02x to 2.10x)
MI350X (gfx950, 256 CUs) 48 retuned shapes, production call, cold replay - - 1.31x (1.01x to 2.09x)
MI350X (gfx950, 256 CUs) 200 other call sizes M that 25 of the rows serve, warm replay - - 1.43x (1.01x to 2.75x)
MI355X (gfx950, 256 CUs) minimax_m3_eagle: 32768 x 2304 x 6144, warm 1408 us 673.5 us 2.10x
MI355X (gfx950, 256 CUs) llama70B: 16384 x 8192 x 3584, warm 1137 us 631.0 us 1.80x
MI355X (gfx950, 256 CUs) kimik3: 2048 x 20480 x 7168, warm 726.5 us 421.5 us 1.72x
MI355X (gfx950, 256 CUs) qwen32B: 2048 x 12800 x 5120, warm 327.1 us 203.3 us 1.61x
MI355X (gfx950, 256 CUs) minimax_m3_mxfp4: 2997 x 6144 x 24576 with bias, warm 926.9 us 603.3 us 1.54x
MI355X (gfx950, 256 CUs) glm5: 8192 x 160 x 6144, warm 41.8 us 32.5 us 1.29x
MI355X (gfx950, 256 CUs) gptoss: 2048 x 201088 x 2880, warm 2363 us 1945 us 1.21x
MI355X (gfx950, 256 CUs) dsv4: 14336 x 2048 x 7168, warm 300.8 us 277.1 us 1.09x

By table (geometric means):

Table Rows MI355X warm MI355X cold MI355X tuner MI350X tuner
minimax_m3_mxfp4 23 1.22x 1.28x 1.25x 1.30x
minimax_m3_eagle 10 1.53x 1.60x 1.57x 1.47x
llama70B 5 1.48x 1.50x 1.46x 1.42x
dsv4 3 1.07x 1.06x 1.05x 1.05x
kimik3 3 1.55x 1.50x 1.44x 1.44x
glm5 2 1.16x 1.17x 1.06x 1.16x
gptoss 1 1.21x 1.22x 1.22x 1.13x
qwen32B 1 1.61x 1.50x 1.50x 1.49x
All 48 rows

Times are the warm replay on MI355X. "Tuner" is main's row against the new row in the tuner's own --compare (MI355X: median of three runs; MI350X: one run).

Table M N K bias Kernel on main New row Before After Warm Cold Tuner MI355X Tuner MI350X
dsv4 1984 2048 4096 no t128x128x64x4_ks1_w4x4x1_bias0_ktail0_gm0_pft torch 36.8 us 35.2 us 1.05x 1.03x 1.04x 1.08x
dsv4 14336 2048 4096 no t256x256x64x2_ks1_w2x4x1_bias0_ktail0_gm4_pht torch 173.3 us 159.9 us 1.08x 1.08x 1.06x 1.04x
dsv4 14336 2048 7168 no t256x256x64x2_ks1_w2x4x1_bias0_ktail0_gm4_pht torch 300.8 us 277.1 us 1.09x 1.06x 1.05x 1.04x
glm5 8192 160 6144 no t128x32x64x4_ks1_w2x1x1_bias0_ktail0_gm4_pft torch 41.8 us 32.5 us 1.29x 1.31x 1.08x 1.07x
glm5 3072 38720 6144 no t256x256x64x2_ks1_w2x4x1_bias0_ktail0_gm4_pht torch 1100 us 1054 us 1.04x 1.04x 1.04x 1.25x
gptoss 2048 201088 2880 no t128x128x64x2_ks1_w2x2x1_bias0_ktail0_gm4_pft torch 2363 us 1945 us 1.21x 1.22x 1.22x 1.13x
kimik3 4096 896 3584 no t128x128x64x3_ks1_w4x4x1_bias0_ktail0_gm0_pft torch 38.8 us 29.7 us 1.31x 1.18x 1.08x 1.26x
kimik3 10240 7168 3584 no t256x64x128x2_ks1_w2x2x1_bias0_ktail0_gm0_pht asm 256x256 626.7 us 379.8 us 1.65x 1.69x 1.66x 1.55x
kimik3 2048 20480 7168 no t64x256x64x2_ks1_w2x4x1_bias0_ktail0_gm4_pft torch 726.5 us 421.5 us 1.72x 1.70x 1.68x 1.51x
llama70B 32768 1280 8192 no t256x256x64x2_ks1_w2x4x1_bias0_ktail0_gm4_pht torch 524.0 us 475.2 us 1.10x 1.09x 1.08x 1.13x
llama70B 4096 8192 3584 no t256x128x64x2_ks1_w2x2x1_bias0_ktail0_gm0_pht torch 229.1 us 161.9 us 1.42x 1.48x 1.43x 1.34x
llama70B 16384 8192 3584 no t128x128x128x2_ks1_w2x2x1_bias0_ktail0_gm4_pft torch 1137 us 631.0 us 1.80x 1.85x 1.79x 1.77x
llama70B 32768 8192 3584 no t128x128x64x5_ks1_w2x2x1_bias0_ktail0_gm4_pft asm 256x256 2201 us 1305 us 1.69x 1.70x 1.67x 1.55x
llama70B 2048 10240 8192 no t128x128x128x2_ks1_w2x2x1_bias0_ktail0_gm0_pht torch 342.6 us 232.1 us 1.48x 1.52x 1.46x 1.38x
minimax_m3_eagle 32768 128 6144 no t64x64x128x4_ks1_w2x2x1_bias0_ktail0_gm0_pft torch 138.0 us 78.4 us 1.76x 1.76x 1.75x 1.38x
minimax_m3_eagle 4096 2304 6144 no t128x128x64x4_ks1_w4x2x1_bias0_ktail0_gm0_pft torch 147.0 us 88.4 us 1.66x 1.69x 1.67x 1.88x
minimax_m3_eagle 16384 2304 6144 no t128x128x64x2_ks1_w2x4x1_bias0_ktail0_gm4_pft torch 440.8 us 331.7 us 1.33x 1.40x 1.38x 1.37x
minimax_m3_eagle 32768 2304 6144 no t64x256x128x2_ks1_w4x4x1_bias0_ktail0_gm0_pft torch 1408 us 673.5 us 2.10x 2.11x 2.09x 2.05x
minimax_m3_eagle 4096 2560 6144 no t256x64x64x3_ks1_w4x1x1_bias0_ktail0_gm4_pft torch 180.7 us 94.3 us 1.92x 1.96x 1.87x 1.95x
minimax_m3_eagle 32768 2560 6144 no t256x256x64x2_ks1_w2x4x1_bias0_ktail0_gm4_pht torch 700.8 us 671.2 us 1.04x 1.04x 1.06x 1.04x
minimax_m3_eagle 4096 6144 2048 no t128x128x64x2_ks1_w2x4x1_bias0_ktail0_gm4_pht torch 96.8 us 79.7 us 1.21x 1.43x 1.35x 1.11x
minimax_m3_eagle 4096 6144 3072 no t128x128x64x2_ks1_w2x2x1_bias0_ktail0_gm4_pht torch 138.7 us 111.4 us 1.24x 1.42x 1.39x 1.22x
minimax_m3_eagle 8192 6144 3072 no t64x256x64x4_ks1_w2x4x1_bias0_ktail0_gm0_pft torch 358.7 us 210.3 us 1.71x 1.82x 1.76x 1.66x
minimax_m3_eagle 32768 6144 3072 no t128x128x64x4_ks1_w2x2x2_bias0_ktail0_gm0_pft asm 256x256 1431 us 880.4 us 1.62x 1.63x 1.64x 1.42x
minimax_m3_mxfp4 3996 1280 1280 yes t128x256x64x3_ks1_w4x4x1_bias1_ktail0_gm0_pft torch 21.1 us 17.2 us 1.22x 1.23x 1.20x 1.13x
minimax_m3_mxfp4 7992 1280 1280 yes t96x128x64x2_ks1_w2x2x1_bias1_ktail0_gm4_pft torch 34.6 us 26.7 us 1.30x 1.48x 1.40x 1.44x
minimax_m3_mxfp4 8322 1280 1280 yes t256x256x64x2_ks1_w2x4x1_bias1_ktail0_gm0_pht torch 28.8 us 24.8 us 1.16x 1.23x 1.16x 1.12x
minimax_m3_mxfp4 19980 1280 1280 yes t128x256x64x2_ks1_w2x4x1_bias1_ktail0_gm0_pht torch 78.8 us 65.4 us 1.20x 1.41x 1.30x 1.47x
minimax_m3_mxfp4 27972 1280 1280 yes t128x256x64x2_ks1_w2x4x1_bias1_ktail0_gm0_pht torch 102.7 us 83.0 us 1.24x 1.44x 1.40x 1.45x
minimax_m3_mxfp4 31968 1280 1280 yes t256x256x64x2_ks1_w2x4x1_bias1_ktail0_gm0_pht torch 101.2 us 92.3 us 1.10x 1.15x 1.14x 1.29x
minimax_m3_mxfp4 66576 1280 1280 yes t128x256x64x3_ks1_w4x4x1_bias1_ktail0_gm0_pft torch 273.6 us 201.8 us 1.36x 1.36x 1.34x 1.48x
minimax_m3_mxfp4 3996 1280 5120 yes t128x128x64x2_ks1_w2x4x1_bias1_ktail0_gm4_pft torch 61.9 us 48.3 us 1.28x 1.30x 1.29x 1.30x
minimax_m3_mxfp4 19980 1280 5120 yes t256x256x64x2_ks1_w2x4x1_bias1_ktail0_gm0_pht torch 213.9 us 194.8 us 1.10x 1.15x 1.13x 1.34x
minimax_m3_mxfp4 23976 1280 5120 yes t256x256x64x2_ks1_w2x4x1_bias1_ktail0_gm0_pht torch 245.1 us 213.6 us 1.15x 1.09x 1.08x 1.39x
minimax_m3_mxfp4 31968 1280 5120 yes t256x256x64x2_ks1_w2x4x1_bias1_ktail0_gm0_pht torch 353.8 us 293.7 us 1.20x 1.18x 1.16x 1.38x
minimax_m3_mxfp4 7992 3840 1280 yes t128x256x64x3_ks1_w4x4x1_bias1_ktail0_gm0_pft torch 97.2 us 73.0 us 1.33x 1.33x 1.33x 1.68x
minimax_m3_mxfp4 27972 3840 1280 yes t128x128x64x2_ks1_w2x2x1_bias1_ktail0_gm0_pft torch 295.6 us 231.1 us 1.28x 1.36x 1.32x 1.23x
minimax_m3_mxfp4 3996 5120 1280 yes t256x256x64x2_ks1_w2x4x1_bias1_ktail0_gm4_pht torch 56.6 us 48.1 us 1.18x 1.33x 1.23x 1.30x
minimax_m3_mxfp4 7992 5120 1280 yes t128x128x64x2_ks1_w4x2x1_bias1_ktail0_gm4_pft torch 110.1 us 92.9 us 1.19x 1.28x 1.23x 1.17x
minimax_m3_mxfp4 7992 6144 1280 yes t128x256x64x2_ks1_w2x4x1_bias1_ktail0_gm4_pht torch 123.0 us 103.2 us 1.19x 1.30x 1.29x 1.09x
minimax_m3_mxfp4 2592 6144 6144 yes t128x256x64x2_ks1_w2x4x1_bias1_ktail0_gm4_pht torch 159.2 us 138.5 us 1.15x 1.22x 1.21x 1.20x
minimax_m3_mxfp4 2997 6144 6144 yes t256x256x64x2_ks1_w2x4x1_bias1_ktail0_gm4_pht torch 227.0 us 158.3 us 1.44x 1.40x 1.34x 1.47x
minimax_m3_mxfp4 3564 6144 6144 yes t128x256x64x2_ks1_w2x4x1_bias1_ktail0_gm4_pht torch 225.4 us 183.6 us 1.23x 1.35x 1.26x 1.26x
minimax_m3_mxfp4 3888 6144 6144 yes t128x256x64x2_ks1_w2x4x1_bias1_ktail0_gm0_pht torch 228.3 us 205.1 us 1.11x 1.28x 1.26x 1.12x
minimax_m3_mxfp4 3996 6144 6144 yes t256x256x64x2_ks1_w2x4x1_bias1_ktail0_gm4_pht torch 232.7 us 205.6 us 1.13x 1.12x 1.14x 1.10x
minimax_m3_mxfp4 14256 6144 6144 yes t256x256x64x2_ks1_w2x4x1_bias1_ktail0_gm4_pht torch 779.7 us 727.9 us 1.07x 1.08x 1.09x 1.18x
minimax_m3_mxfp4 2997 6144 24576 yes t256x256x64x2_ks1_w2x4x1_bias1_ktail0_gm0_pht torch 926.9 us 603.3 us 1.54x 1.54x 1.57x 1.54x
qwen32B 2048 12800 5120 no t128x256x64x3_ks1_w4x4x1_bias0_ktail0_gm0_pft asm 256x256 327.1 us 203.3 us 1.61x 1.50x 1.50x 1.49x

Other M. A call whose M has no row of its own is padded by the lookup (getPaddedM, fine step first, then the next power of two; above 8192 with N > 4096 it uses the M = 8192 row). So 25 of the 48 rows also serve M values other than their own. For each of them I timed 22 such M, evenly spread over the range it serves up to M = 65536, with the same method. A row is in this PR only if none of its sampled M is slower than main in either timing.

Other M served by 25 rows
Table Row (M x N x K) Other M it serves Sampled Warm: geometric mean (smallest) Cold: geometric mean (smallest)
dsv4 1984 x 2048 x 4096 1921 to 1983 22 1.05x (1.04x) 1.05x (1.03x)
dsv4 14336 x 2048 x 4096 14209 to 14335 22 1.05x (1.03x) 1.08x (1.06x)
dsv4 14336 x 2048 x 7168 14209 to 14335 22 1.09x (1.07x) 1.06x (1.06x)
glm5 8192 x 160 x 6144 4097 to 8191 22 1.96x (1.39x) 2.00x (1.38x)
glm5 3072 x 38720 x 6144 3009 to 3071 22 1.04x (1.03x) 1.03x (1.03x)
gptoss 2048 x 201088 x 2880 1025 to 2047 22 2.13x (1.21x) 2.11x (1.21x)
kimik3 4096 x 896 x 3584 2049 to 4095 22 1.25x (1.15x) 1.20x (1.12x)
kimik3 10240 x 7168 x 3584 10113 to 10239 22 1.62x (1.59x) 1.70x (1.68x)
kimik3 2048 x 20480 x 7168 1025 to 2047 22 1.74x (1.44x) 1.77x (1.50x)
llama70B 32768 x 1280 x 8192 16385 to 32767 22 1.17x (1.08x) 1.17x (1.08x)
llama70B 4096 x 8192 x 3584 2049 to 4095 22 1.47x (1.32x) 1.51x (1.37x)
llama70B 16384 x 8192 x 3584 16257 to 16383 22 1.71x (1.63x) 1.76x (1.67x)
llama70B 32768 x 8192 x 3584 32641 to 32767 22 1.68x (1.67x) 1.70x (1.69x)
llama70B 2048 x 10240 x 8192 1025 to 2047 22 1.55x (1.41x) 1.53x (1.31x)
minimax_m3_eagle 32768 x 128 x 6144 16385 to 32767 22 1.66x (1.45x) 1.75x (1.58x)
minimax_m3_eagle 4096 x 2304 x 6144 2049 to 4095 22 1.43x (1.21x) 1.46x (1.23x)
minimax_m3_eagle 16384 x 2304 x 6144 8193 to 16383 22 1.41x (1.31x) 1.49x (1.36x)
minimax_m3_eagle 32768 x 2304 x 6144 16385 to 32767 22 2.22x (2.09x) 2.20x (2.08x)
minimax_m3_eagle 4096 x 2560 x 6144 2049 to 4095 22 1.85x (1.44x) 1.73x (1.39x)
minimax_m3_eagle 32768 x 2560 x 6144 16385 to 32767 22 1.08x (1.03x) 1.07x (1.03x)
minimax_m3_eagle 4096 x 6144 x 2048 2049 to 4095 22 1.27x (1.17x) 1.32x (1.22x)
minimax_m3_eagle 4096 x 6144 x 3072 2049 to 4095 22 1.28x (1.17x) 1.34x (1.22x)
minimax_m3_eagle 8192 x 6144 x 3072 4097 to 8191 and every larger M without a row of its own 22 1.69x (1.49x) 1.71x (1.51x)
minimax_m3_eagle 32768 x 6144 x 3072 32641 to 32767 22 1.64x (1.63x) 1.64x (1.61x)
qwen32B 2048 x 12800 x 5120 1025 to 2047 22 1.37x (1.20x) 1.34x (1.23x)

Serving. The Llama-3.3-70B-Instruct architecture (BF16; random weights, so this is a timing run only) under vLLM 0.33.0 with VLLM_ROCM_USE_AITER=1, tensor-parallel 1 on one MI355X, prefix caching off. The released image (amd-aiter 0.1.26) names the same kernels as main in the five llama70B rows of this PR, so one server ran and its BF16 table was switched between the image's rows (before) and the rows of this PR (after) from phase to phase: 16 phases in the order A B B A; the change is the mean over the 8 adjacent pairs with its standard error. A request is a prompt of an exact number of token ids and one generated token.

Hardware Workload/configuration Before After Change
MI355X (gfx950, 256 CUs) one 1,500-token prompt, latency 204.0 ms 195.2 ms 1.045x ± 0.0015
MI355X (gfx950, 256 CUs) one 2,048-token prompt, latency 248.2 ms 239.4 ms 1.037x ± 0.0006
MI355X (gfx950, 256 CUs) one 6,000-token prompt with --max-num-batched-tokens 2048, latency 874.9 ms 843.8 ms 1.037x ± 0.0004
MI355X (gfx950, 256 CUs) 48 prompts of 2,000 tokens at once with --max-num-batched-tokens 2048, prompt tokens per second 7,551 7,833 1.037x ± 0.0006
MI355X (gfx950, 256 CUs) control: one 1,000-token prompt, latency 153.5 ms 153.6 ms 0.999x ± 0.0005
MI355X (gfx950, 256 CUs) control: one 3,000-token prompt, latency 356.6 ms 356.5 ms 1.000x ± 0.0008
MI355X (gfx950, 256 CUs) control: 48 prompts of 2,000 tokens at once at the default budget of 16,384 tokens per step, prompt tokens per second 9,451 9,462 1.001x ± 0.0004

At tensor-parallel 1 one GEMM per layer is on a changed row, the QKV projection, and only in prefill steps of 1,025 to 2,048 token rows. The controls are step sizes that no changed row serves. In the first run 17,280 lookups per arm resolved to a changed row, FlyDSL before and torch after.

At tensor-parallel 8 the changed rows are the down projection (2,049 to 4,096, 16,257 to 16,384 and 32,641 to 32,768 rows) and the QKV projection (16,385 to 32,768 rows). That configuration was not served. The four GEMMs of one layer (QKV, O, gate_up, down) through tgemm.mm on one MI355X, with the same two tables:

Hardware Workload/configuration Before After Change
MI355X (gfx950, 256 CUs) tensor-parallel 8 shard, 4,096 rows 969.9 us 835.4 us 1.16x
MI355X (gfx950, 256 CUs) tensor-parallel 8 shard, 16,384 rows (vLLM's default step budget) 3308 us 2817 us 1.17x
MI355X (gfx950, 256 CUs) tensor-parallel 8 shard, 32,768 rows 6209 us 5278 us 1.18x
MI355X (gfx950, 256 CUs) tensor-parallel 1, 2,048 rows (the served case above) 3172 us 3014 us 1.05x

Testing

  • Unit tests added or updated
  • Performance benchmarks run
  • Tested on MI250X
  • Tested on MI300X

Measured on MI355X and MI350X (gfx950, 256 CUs); the rows are gfx950 rows with cu_num 256, so MI250X and MI300X do not read them.
python3 -m unittest op_tests.tuning_tests.test_csv_validation op_tests.tuning_tests.test_config_shape_collision: 52 tests OK on this branch and on main at 8eed98cce.

Documentation

  • Docstrings updated
  • User guide updated
  • Performance guide updated
  • No documentation change is needed, with the reason stated below

Tuned-config rows only. The table format and the lookup are unchanged.

Dependencies

  • No new third-party dependencies added
  • New dependencies are listed and justified below

Breaking Changes

None. The results at these shapes change in the last bits because another kernel computes them; against a float32 reference the new rows are not less accurate than main's rows at any measured shape (see Validation).

PR Self-Review

Reviewed revision

c972232

Behavior and intent

Configuration only. For gfx950 with 256 CUs, 48 BF16 GEMM rows with M from 1984 to 66576 named a FlyDSL kernel that is slower at that size than a library kernel. The rows now name torch (44) or the asm 256x256 kernel (4), which is what upstream's tuner picks when every library type races. The existing behavior is insufficient because a tuned row should not be slower than the path an untuned shape takes, and here it was, by 1.04x to 2.10x on MI355X. No dispatch code changes and no key changes, so the lookup returns a row for exactly the same calls as before.

Validation and unverified scope

How the rows were chosen, every step with upstream's tuner or the production call:

  1. Start: the 422 gfx950 / 256 CU rows of main e359f953d with M >= 1536 that name a FlyDSL or Triton kernel.
  2. python3 csrc/gemm_a16w16/gemm_a16w16_tune.py -i <shapes> -o <scratch table> --libtype torch,asm --b-non-temporal auto --all --compare --shape_grouped --mp 1 -o2 <profile> on MI355X, three runs: in 172 rows at least one run would update the row.
  3. The same command with --libtype all for those 172, three runs, every shape on three different GPUs: the tuner would update 114 rows in all three runs (its own 3% rule, main's row against the winner in the production-call benchmark).
  4. Replay A/B of the production call for the 114 (method under Performance): 92 are at least 1.03x in warm and in cold. Of these, 5 new FlyDSL split-K rows are less accurate than main's row and are dropped. 87 remain.
  5. MI350X, one run of the command of step 2 at main 7c2fa4dae: 63 of the 87 are at least 1.03x there. 14 are slower than main's row on MI350X, 3 are within 3%, and 7 FlyDSL winners were not raced there; all of these are left out.
  6. The 8 llama405B rows are left to [Config] [Perf] Retune Llama-3.1-405B BF16 GEMM config for gfx950 #7479: 55 candidates.
  7. Replay A/B again at main 8eed98cce, with and without this PR's rows, 5 rounds, at the rows' own M and at the other M they serve (8 per row first, then 22 per row for the rows still in). A row stays if it is at least 1.03x at its own M and no sampled other M is below 1.00x, warm and cold: 48 rows.

Main's row is the same row at 7c2fa4dae, e359f953d and 8eed98cce for every one of these keys, so the three sets of measurements describe the same change.

Rebased onto main 73960daf4 on 20 November, which carries the fix of tests/test_ar_rmsnorm_routing.py (#8313), a test that was broken on the previous base; the diff is unchanged. Main did not change aiter/configs, the BF16 lookup or the tuning tests between 8eed98cce and that commit, so the tables that were measured and tested are the tables of this head.

Software: MI355X runs use the public image vllm/vllm-openai-rocm:v0.33.0 (amd-aiter 0.1.26, torch 2.13.0+rocm10.0.0) with main's aiter/ and csrc/ laid over the installed package and FlyDSL 0.5.0; the asm kernel and its launcher are unchanged between v0.1.26 and main. The MI350X tuner run used amd-aiter 0.1.25 with main's sources laid over, torch 2.12.0+rocm10.0.0 and FlyDSL 0.5.0. The MI350X replay (23 November) used the same image and overlay as the MI355X runs: main 8eed98cce against that main with this PR's rows, each arm in its own process, the arms in turn, 3 rounds on four devices, the 48 rows' own M and 200 other call sizes that they serve; in every case the call resolved to main's row in one arm and to the new row in the other, and the output check passed.

Checks:

  • In every A/B record the lookup resolved to main's row in the "before" arm and to the new row in the "after" arm (48 cases at the rows' own M, 550 at other M).
  • Accuracy against a float32 reference (F.linear on the same inputs), share of elements outside rtol = atol = 0.01: at most 0.0486 with main's rows and 0.0000 with the new rows; outside rtol = atol = 0.05 (the tuner's tolerance): at most 0.0043 and 0.0000.
  • The tables were edited by a script that replaces a row only when its key occurs exactly once in the table family and keeps every other line byte for byte: git diff --numstat shows 48 insertions and 48 deletions in 8 files.
  • python3 -m unittest op_tests.tuning_tests.test_csv_validation op_tests.tuning_tests.test_config_shape_collision: 52 tests OK on this branch and on main at 8eed98cce, none skipped.
  • op_tests.tuning_tests.test_a16w16_tuned_config_lookup: 14 of its 15 tests pass on this branch and on main at 8eed98cce. test_gfx1250_legacy_wrapper_routing fails the same way on both in my setup (main's sources over the 0.1.26 build): ValueError: A and B must be on the same ROCm device. It is a gfx1250 routing test and does not read these rows.
  • Open pull requests: I looked for open PRs that change these tables or the llama405B table and found 25. Only [Config] [Perf] Retune Llama-3.1-405B BF16 GEMM config for gfx950 #7479 touches keys of the candidates (the llama405B rows, left out); the others edit other rows of the same files.

Unverified: served accuracy (the serving run uses random weights); serving at tensor-parallel 8 (layer timing only); M values between the sampled ones for the rows that also serve other M, and M above 65536 for the 1 row that serves every larger M; gfx950 partitions with another cu_num, gfx942 and gfx1250 (they have their own rows, which this PR does not touch).

PR-specific question

Keys consumed: gfx950, cu_num 256, dtype and outdtype bf16, no scale, no bpreshuffle, at the 48 (M, N, K, bias) keys listed under Performance. Readers: (1) get_GEMM_A16W16_tuned_config in aiter/tuned_gemm.py, for gemm_a16w16 and tgemm.mm calls with the row's own M or with an M that pads to it; (2) the AOT replay aiter/aot/flydsl/gemm.py, which compiles the FlyDSL kernels that rows name and now has 48 fewer rows to compile for; (3) the tuner, which reads the table as its base. aiter/ops/opus/policy.py reads only OPUS rows of this family, and none of these rows was or is an OPUS row. Evidence that unrelated shapes keep their selection: the lookup key contains N, K, bias and the dtypes unpadded, and M only through the padded-M walk, so a row can serve only calls of its own (N, K, bias) group. No key is added or removed, so the mapping from a call to a row is unchanged for every call; only the content of these 48 rows differs. All other lines of the 8 files are byte-identical, and the collision guard passes on the merged family. For the calls that do change, the M values that pad to a changed row were enumerated by replaying the walk on the table family and are measured in the "Other M" table.

Changed op tests

None.

@iraj465
iraj465 requested a review from a team November 19, 2026 18:30
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

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

Extended tests (opt-in via labels):

Label Tests
ci:mi300x Run Aiter standard tests on MI300X in PRs; main branch always runs them
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 Radeon R9700 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 8317 --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.

Reviews:
A reviewer is usually assigned within one working day after the PR is ready for review (see Code Review Process). If nobody has responded for about a week, mention the area contact listed in CONTACTS.md. Want to help review? See REVIEWERS.md.

@iraj465

iraj465 commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

@yzhou103 @demonsan could you take a look when you have a moment? This only swaps the kernel in existing gfx950 BF16 GEMM rows; the description has the per-row numbers on MI355X and MI350X, including the other M values each row serves. It is a fork PR, so the workflows need a maintainer's approval to start. Thanks!

For 48 gfx950 (256 CU) shapes with M from 1984 to 66576 the tuned BF16 GEMM
row names a FlyDSL kernel that is slower at that size than a library
kernel. Replace those rows in place with the tuner's winner: torch
(hipBLASLt) for 44 shapes and the asm 256x256 kernel for 4.

Rows only. No key is added or removed, and every other line of the 8
tables is unchanged.

Signed-off-by: Saptarshi Majumder <[email protected]>
@iraj465
iraj465 force-pushed the config/bf16-gemm-gfx950-large-m-library-rows branch from 518c7d3 to c972232 Compare November 20, 2026 06:26
@aiter-bot

aiter-bot commented Nov 20, 2026 •

Copy link
Copy Markdown

READY FOR HUMAN REVIEW

PR Self-Review

Revision c972232e02d6 · mode shadow

Author self-review accepted. Readiness report:

Author answers

  • PASS — current-SHA answers are present and structurally specific
Show the author's self-review answers

Behavior and intent

Configuration only. For gfx950 with 256 CUs, 48 BF16 GEMM rows with M from 1984 to 66576 named a FlyDSL kernel that is slower at that size than a library kernel. The rows now name `torch` (44) or the asm 256x256 kernel (4), which is what upstream's tuner picks when every library type races. The existing behavior is insufficient because a tuned row should not be slower than the path an untuned shape takes, and here it was, by 1.04x to 2.10x on MI355X. No dispatch code changes and no key changes, so the lookup returns a row for exactly the same calls as before.

Validation and unverified scope

How the rows were chosen, every step with upstream's tuner or the production call:

1. Start: the 422 gfx950 / 256 CU rows of main `e359f953d` with M >= 1536 that name a FlyDSL or Triton kernel.
2. `python3 csrc/gemm_a16w16/gemm_a16w16_tune.py -i <shapes> -o <scratch table> --libtype torch,asm --b-non-temporal auto --all --compare --shape_grouped --mp 1 -o2 <profile>` on MI355X, three runs: in 172 rows at least one run would update the row.
3. The same command with `--libtype all` for those 172, three runs, every shape on three different GPUs: the tuner would update 114 rows in all three runs (its own 3% rule, main's row against the winner in the production-call benchmark).
4. Replay A/B of the production call for the 114 (method under Performance): 92 are at least 1.03x in warm and in cold. Of these, 5 new FlyDSL split-K rows are less accurate than main's row and are dropped. 87 remain.
5. MI350X, one run of the command of step 2 at main `7c2fa4dae`: 63 of the 87 are at least 1.03x there. 14 are slower than main's row on MI350X, 3 are within 3%, and 7 FlyDSL winners were not raced there; all of these are left out.
6. The 8 llama405B rows are left to #7479: 55 candidates.
7. Replay A/B again at main `8eed98cce`, with and without this PR's rows, 5 rounds, at the rows' own M and at the other M they serve (8 per row first, then 22 per row for the rows still in). A row stays if it is at least 1.03x at its own M and no sampled other M is below 1.00x, warm and cold: 48 rows.

Main's row is the same row at `7c2fa4dae`, `e359f953d` and `8eed98cce` for every one of these keys, so the three sets of measurements describe the same change.

Rebased onto main `73960daf4` on 20 November, which carries the fix of `tests/test_ar_rmsnorm_routing.py` (#8313), a test that was broken on the previous base; the diff is unchanged. Main did not change `aiter/configs`, the BF16 lookup or the tuning tests between `8eed98cce` and that commit, so the tables that were measured and tested are the tables of this head.

Software: MI355X runs use the public image `vllm/vllm-openai-rocm:v0.33.0` (amd-aiter 0.1.26, torch 2.13.0+rocm10.0.0) with main's `aiter/` and `csrc/` laid over the installed package and FlyDSL 0.5.0; the asm kernel and its launcher are unchanged between v0.1.26 and main. The MI350X tuner run used amd-aiter 0.1.25 with main's sources laid over, torch 2.12.0+rocm10.0.0 and FlyDSL 0.5.0. The MI350X replay (23 November) used the same image and overlay as the MI355X runs: main `8eed98cce` against that main with this PR's rows, each arm in its own process, the arms in turn, 3 rounds on four devices, the 48 rows' own M and 200 other call sizes that they serve; in every case the call resolved to main's row in one arm and to the new row in the other, and the output check passed.

Checks:

- In every A/B record the lookup resolved to main's row in the "before" arm and to the new row in the "after" arm (48 cases at the rows' own M, 550 at other M).
- Accuracy against a float32 reference (`F.linear` on the same inputs), share of elements outside rtol = atol = 0.01: at most 0.0486 with main's rows and 0.0000 with the new rows; outside rtol = atol = 0.05 (the tuner's tolerance): at most 0.0043 and 0.0000.
- The tables were edited by a script that replaces a row only when its key occurs exactly once in the table family and keeps every other line byte for byte: `git diff --numstat` shows 48 insertions and 48 deletions in 8 files.
- `python3 -m unittest op_tests.tuning_tests.test_csv_validation op_tests.tuning_tests.test_config_shape_collision`: 52 tests OK on this branch and on main at `8eed98cce`, none skipped.
- `op_tests.tuning_tests.test_a16w16_tuned_config_lookup`: 14 of its 15 tests pass on this branch and on main at `8eed98cce`. `test_gfx1250_legacy_wrapper_routing` fails the same way on both in my setup (main's sources over the 0.1.26 build): `ValueError: A and B must be on the same ROCm device`. It is a gfx1250 routing test and does not read these

[truncated in readiness report; see the PR description for the full answer]

PR-specific question

Keys consumed: gfx950, cu_num 256, dtype and outdtype bf16, no scale, no bpreshuffle, at the 48 (M, N, K, bias) keys listed under Performance. Readers: (1) `get_GEMM_A16W16_tuned_config` in `aiter/tuned_gemm.py`, for `gemm_a16w16` and `tgemm.mm` calls with the row's own M or with an M that pads to it; (2) the AOT replay `aiter/aot/flydsl/gemm.py`, which compiles the FlyDSL kernels that rows name and now has 48 fewer rows to compile for; (3) the tuner, which reads the table as its base. `aiter/ops/opus/policy.py` reads only OPUS rows of this family, and none of these rows was or is an OPUS row. Evidence that unrelated shapes keep their selection: the lookup key contains N, K, bias and the dtypes unpadded, and M only through the padded-M walk, so a row can serve only calls of its own (N, K, bias) group. No key is added or removed, so the mapping from a call to a row is unchanged for every call; only the content of these 48 rows differs. All other lines of the 8 files are byte-identical, and the collision guard passes on the merged family. For the calls that do change, the M values that pad to a changed row were enumerated by replaying the walk on the table family and are measured in the "Other M" table.

Changed op tests

None.

PR state

  • PASS — pull request is marked ready for review

Copilot findings

  • PASS — no active Copilot finding lacks a substantive author reply
  • ADVISORY — Copilot did not review the current head SHA

Code and op-test hygiene

  • PASS — no committed artifact or conflict marker detected

Required CI

  • PASS — Black: passed
  • PASS — Ruff: passed
  • PASS — Repository dependency: passed
  • PASS — Aiter Test Gate: passed

Shadow mode reports what would block but keeps the status successful. Set AITER_PR_SELF_REVIEW_MODE=enforce only after reviewing real false positives.

@iraj465
iraj465 marked this pull request as draft November 20, 2026 20:08
@iraj465
iraj465 marked this pull request as ready for review November 20, 2026 20:08
@iraj465

iraj465 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

@yifehuan could you take a look at this one when you have a moment? It is the same kind of change as #8423: it only swaps the kernel in 48 existing gfx950 BF16 GEMM rows (large-batch rows go from FlyDSL to torch or the asm 256x256 kernel, 1.32x on the production call on MI355X; the per-row numbers are in the description). It comes from a fork, so the workflows need an approval before CI can run. Thanks!

@iraj465

iraj465 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

@yifehuan @yzhou103 one gap of the description is closed (description only, the head is unchanged): I replayed the production call on an MI350X with main's rows and with these 48 rows, 3 rounds on four devices. The 48 shapes are 1.29x faster (geometric mean, 1.02x to 2.10x), the 200 sampled other call sizes that 25 of the rows serve are 1.43x faster (1.01x to 2.75x), and nothing is slower than main there. Before this the MI350X evidence was one tuner run.

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

@iraj465

iraj465 commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

@demonsan thanks for the review, and @yifehuan thanks for starting the workflows. The one red shard of the Aiter Test (Standard Tests 8/0) did not fail in a test: its runner dropped out at 17:59 UTC ("The self-hosted runner lost communication with the server"), in the same minute as shards of other pull requests, so there is no log for it. The other seven shards, Checks, Triton Test and OPUS Test passed. Could one of you re-run the failed job? Nothing needs to change in the branch.

@iraj465

iraj465 commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

@demonsan @yifehuan thanks for the re-run. It is green now: all eight standard shards and the gate have passed, next to Checks, Triton Test and OPUS Test. Could one of you help merge it?

@yifehuan
yifehuan merged commit 58e0078 into ROCm:main Nov 26, 2026
103 of 125 checks passed
gbyu-amd pushed a commit that referenced this pull request Dec 3, 2026
…4098)

(cherry picked from commit b34b6b8)

Rebase onto main 12-03: kimik3_bf16_tuned_gemm.csv conflicted with main's gfx950 row updates (#8317 / #8245 / #8915). Replayed by row key: the 32 gfx1250 rows this commit adds are inserted; its 15 gfx950 edits were number formatting only (a CSV round-trip) and are left as main has them. Same rows as the PR head 3b64098.
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.

4 participants