Repository navigation
[Config] [Perf] Add tuned bf16 GEMM configs for Qwen3.8-2.4T-A95B on gfx950 - #5183
mjkvaak-amd wants to merge 1 commit into
Conversation
…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 75 rows covering them, tuned on gfx950 / cu_num=256. N=4608 K=8192 12 rows Gated DeltaNet in_proj_qkvz N=32 K=8192 12 rows Gated DeltaNet in_proj_ba N=31040 K=8192 6 rows lm_head, vocab 248320 sharded TP8 N=512 K=8192 6 rows MoE router, M>=512 only (see below) N=1 K=8192 15 rows shared-expert gate, unfused N=8192 K=256 12 rows MoE down-projection N=513 K=8192 12 rows fused shared-expert gate, 512 routed + 1 shared Every row has err_ratio 0.0000 against the reference. Winners were selected as the fastest candidate within err_ratio <= 0.005 rather than on speed alone: at the tuner's default 0.05 tolerance, flydsl split-k kernels win several N=512 shapes with err_ratio 0.015-0.030 while hipBLASLt, torch and triton all reach 0.000 on the identical shape. The MoE router is tuned only at M>=512 by choice. Leaving those shapes to the existing fallback is faster than tuned alternatives. Measured under vLLM on amd/Qwen3.8-2.4T-A95B-Quark-MXFP4, TP8, three repeats per case, arms differing only by this table: geometric mean output throughput +2.25%, mean TPOT +2.23%, mean TTFT +1.38%. GSM8K 5-shot over all 1319 problems shows no detectable accuracy change. Coverage was verified by replaying AITER's get_padded_m lookup against a long-context benchmark (ISL/OSL 8k/1k, 60k/1k, 128k/1k) that logged 6127 distinct (M, N, K) shapes: 6070 are served, the remaining 57 being the deliberate sub-M=512 router gap. No family here appears in any bf16 tuned table currently on main, and no row duplicates an existing shape key. Signed-off-by: Mikko Tukiainen <[email protected]> Co-authored-by: Cursor <[email protected]>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
PR title tags & labels: |
| gfx950,256,1,1,8192,False,torch.bfloat16,torch.bfloat16,False,False,skinny,2,0,3.2932,sol2,0.0,0.0,9.95 | ||
| gfx950,256,2,1,8192,False,torch.bfloat16,torch.bfloat16,False,False,skinny,2,0,4.0563,sol2,0.0,0.01,12.12 | ||
| gfx950,256,4,1,8192,False,torch.bfloat16,torch.bfloat16,False,False,skinny,2,0,5.6019,sol2,0.0,0.01,14.63 | ||
| gfx950,256,8,1,8192,False,torch.bfloat16,torch.bfloat16,False,False,hipblaslt,439633,0,6.4201,Cijk_Alik_Bljk_BBS_BH_Bias_HA_S_SAV_UserArgs_MT16x16x512_MI16x16x1_SN_LDSB0_AFC0_AFEM1_AFEM1_ASEM1_CLR1_CADS0_DTLA1_DTLB1_DTVA0_DTVB0_EPS0_FDSI0_GRPM1_GRVWA8_GRVWB8_GSU0_GSUAMB_GLS0_ISA950_IU1_K1_LDSTI0_LBSPPA1024_LBSPPB1024_LBSPPM0_LPA16_LPB16_LPM0_LRVW8_LWPMn1_MIAV0_MIWT1_1_MO40_NTn1_NTA7_NTB2_NTC2_NTD0_NTM0_NEPBS4_NLCA1_NLCB1_ONLL1_PGR2_PLR1_PKA1_SIA3_SS0_SPO1_SRVW0_SSO0_SVW1_SK3_SKFTR0_SKXCCM0_TLDS1_ULSGRO0_USL1_UIOFGRO0_USFGRO1_VSn1_VWA1_VWB1_WSGRA0_WSGRB0_WS64_WG16_4_4,0.0,0.02,22.97 |
There was a problem hiding this comment.
Please exclude hipblaslt from the checked-in tuned configs. This table contains 63 hipBLASLt entries whose solution indices are library-version dependent and should not be shipped in the shared configs. Please reselect the best candidates from the remaining backends, retain the default fallback where appropriate, and update the performance results.
There was a problem hiding this comment.
@yifehuan The hipBLASLt (and Opus) -free table is 15 rows and results in+0.35% uplift, against the 75-row table's +2.25%. I will close the PR as a dud.
…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]>
…fx950 (#5835) 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 #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 #5183 was closed. Re-tuning against the gfx950 A16W16 FlyDSL kernels added in #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]>
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.
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.
What this adds
One tuned table,
aiter/configs/model_configs/qwen3_8_2p4t_a95b_bf16_tuned_gemm.csv, with 75 rows covering the seven bf16 GEMM families Qwen3.8-2.4T-A95B executes that AITER has no tuned entry for. Tuned on gfx950, cu_num=256 (MI355X), TP8.The matching
qwen3_8_2p4t_a95b_bf16_untuned_gemm.csvshape list is included so the table can be re-tuned without reconstructing the shapes by hand. Theget_config_fileglob skips any name containinguntuned, so it is documentation and does not affect lookup.in_proj_qkvz, sharded TP8in_proj_ba, sharded TP8lm_head, vocab 248320 sharded TP8M>=512only (see TTFT below)Why these shapes
They are the shapes real serving runs logged as misses:
Two sweeps on two checkpoints contributed: an 18-case MoE-MXFP4 sweep (1,618 distinct shapes) and an 18-case Quark-MXFP4 sweep (custom, non-public checkpoint; 461 distinct shapes). Every miss in both falls into the seven families above. 65 of the model's 92 layers are
linear_attention, so the two GDN projections run on nearly every forward pass.Why 75 rows covers thousands of shapes
The lookup tries
gl in [None, 0, 1]: exact M, then the two padded buckets fromget_padded_m. Tuning the power-of-two bucket representatives serves every M that pads onto them.Verified against a full production-shaped benchmark, not just the tuning sweep. A run covering ISL/OSL of 8k/1k, 60k/1k and 128k/1k logged 6,127 distinct (M, N, K) shapes, all in one key variant (
torch.bfloat16in and out,bias=False,scaleAB=False,bpreshuffle=False). Replaying AITER's lookup against every one of them:6,070 of 6,127 served, by 59 rows. No family outside the seven above appeared, and the thousand-plus distinct M values per family collapse onto a dozen rows each:
The 57 unserved shapes are the one deliberate gap: MoE-router GEMMs below M=512, excluded because tuned entries there measurably hurt TTFT. They keep AITER's current behavior, so nothing regresses relative to today.
We collected the untuned shapes at
max_num_batched_tokens=16384andmax_num_seqs=256. Raising either past those values is a configuration change that would put shapes outside the tuned table.Per-shape gain over the current fallback
Best speedup over AITER's
torch/rocBLAS fallback, per family, measured from the tuner's own profile output and restricted to numerically-clean candidates (below):Every winner is numerically exact
All 75 rows have
err_ratio0.0000 against the reference.This is worth stating because the tuner's default
--errRatio 0.05does not give you that. Selecting on speed alone,flydslsplit-k kernels won six N=512 shapes aterr_ratio0.015–0.030, whilehipblaslt,opus,torchandtritonall reached 0.000 on the identical shape. Those winners were re-picked as the fastest candidate withinerr_ratio <= 0.005.End-to-end effect
Serving A/B under vLLM on the public
amd/Qwen3.8-2.4T-A95B-Quark-MXFP4, TP8, three repeats per case, arms differing only by this table.Geometric mean output throughput +2.25%, mean TPOT +2.23%, mean TTFT +1.38%
(all concurrencies clean in both arms):
N=513 gate rows, measured separately on the fused shared-expert path:
+0.4% geometric mean, TPOT −0.3% to −1.3%, directionally consistent across six
cases.
Accuracy
GSM8K, 5-shot, all 1319 problems, greedy, on
amd/Qwen3.8-2.4T-A95B-Quark-MXFP4, compared per-problem against the stock arm on the same vLLM build (v0.27.2rc1.dev150+g311b3513a) with the same eval settings:No detectable accuracy change.
Co-authored-by: Cursor