Repository navigation
[Triton/Gluon] [Config] gfx1250 Gluon GEMM configs for Kimi-K2 TP8 - #6573
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
Kimi-K2 at TP8 has dense bf16 GEMM shapes and MLA-absorb batched GEMM shapes with no gfx1250 Gluon config, so they run on DEFAULT.json: - gemm_a16w16 (N, K): q_b (1536, 1536), kv_b (2048, 512), shared expert down (7168, 256), o_proj (7168, 1024), and the layer-0 dense MLP (4608, 7168) and (7168, 2304). - batched_gemm_a16w16 B=8: absorb q (N=512, K=128) and absorb v (N=128, K=512), 8 heads per GPU at TP8. Each M bucket was picked by CUDA-graph timing on MI455X over the configs already shipped for gfx1250 in neighbouring buckets; buckets with no faster candidate keep the DEFAULT.json config. Signed-off-by: Yang, JiaRong <[email protected]>
fc87e6c to
5457386
Compare
There was a problem hiding this comment.
🟡 Changes recommended
All six dense config files omit the required waves_per_eu field from every bucket.
1 open issue
What changed in this PR
This PR adds shape-specific gfx1250 Gluon GEMM configs for Kimi-K2 at TP8, replacing default config selection for dense and MLA-absorb operations.
Changes:
- Adds six dense bf16 GEMM configs with M-based buckets.
- Adds two batched GEMM configs for eight heads per GPU.
- Changes only config data; no kernels or wrappers change.
All paths below are relative to aiter/ops/triton/configs/gfx1250/gluon/gemm/.
| File | Description |
|---|---|
gemm_a16w16/GEMM-A16W16-N=7168-K=256.json |
Shared expert down-projection config. |
gemm_a16w16/GEMM-A16W16-N=7168-K=2304.json |
Layer-0 dense MLP down-projection config. |
gemm_a16w16/GEMM-A16W16-N=7168-K=1024.json |
Attention output-projection config. |
gemm_a16w16/GEMM-A16W16-N=4608-K=7168.json |
Layer-0 dense MLP expansion config. |
gemm_a16w16/GEMM-A16W16-N=2048-K=512.json |
KV projection config. |
gemm_a16w16/GEMM-A16W16-N=1536-K=1536.json |
Query projection config. |
batched_gemm_a16w16/BATCHED_GEMM-A16W16-B=8-N=512-K=128.json |
MLA query-absorb config. |
batched_gemm_a16w16/BATCHED_GEMM-A16W16-B=8-N=128-K=512.json |
MLA value-absorb config. |
Review effort: Balanced
|
@jiaryang which triton version did you use for tuning? |
…he full search space Retune the eight Kimi-K2 TP8 shapes of this PR with sweep_configs.py (--backend gluon) over the full gfx1250 Gluon search space, one sweep per M bucket from 1 to 128, on MI450 in DPX mode (96 CUs per partition): - every entry now carries waves_per_eu, as DEFAULT.json does; - the files are DEFAULT_FALLBACK, so the buckets from 256 to 4096 come from DEFAULT.json; M_LEQ_8192 keeps the first version's config, with the waves_per_eu the wrapper used for it (0). Cold-L2 CUDA-graph time against DEFAULT.json (main has no file for these shapes), M = 4 / 16 / 64: q_b (1536, 1536) 1.04 / 1.01 / 1.10x o_proj (7168, 1024) 1.59 / 1.34 / 1.86x sh_down (7168, 256) 1.90 / 1.53 / 1.11x l0_gu (4608, 7168) 1.30 / 1.21 / 1.48x l0_down (7168, 2304) 1.59 / 1.57 / 1.71x kv_b (2048, 512) 1.02 / 1.03 / 1.03x bmm_q B=8 (512, 128) 1.46 / 1.37 / 2.36x bmm_v B=8 (128, 512) 1.25 / 1.28 / 1.25x Signed-off-by: Yang, JiaRong <[email protected]>
…expert gate_up configs for Kimi-K2 TP8 Kimi-K2 TP8 also runs three shapes that already have gfx1250 Gluon files (from the DeepSeek-R1 and router configs): fused_qkv_a_proj_with_mqa (N=2112, K=7168), the MoE router (N=384, K=7168) and the shared-expert gate_up (N=512, K=7168). Retune their M buckets from 1 to 128 the same way, keeping every larger bucket; the kept buckets get the waves_per_eu the wrapper used for them (0). Cold-L2 CUDA-graph time against the current files, M = 4 / 16 / 64: qa_kva (2112, 7168) 1.56 / 1.81 / 1.50x router ( 384, 7168) 1.09 / 1.17 / 1.06x sh_gu ( 512, 7168) 1.10 / 1.25 / 1.67x Signed-off-by: Yang, JiaRong <[email protected]>
Using Triton: 3.8.0+git76940ad3 (rocm/sgl-dev:v0.5.22-rocm10-mi45x-20261022). |
|
@azaidy already add the waves_per_eu key and update triton version, could you help to take a look, thanks. |
There was a problem hiding this comment.
🔵 Needs a closer look
The configs depend on unmerged loader PR #7096, and integrated accuracy and base/head latency require validation on a gfx1250 96-CU partition unavailable in this review environment.
3 open issues
Review effort: Balanced
|
@azaidy I updated the PR as discussed:
End to end with #7096 and #7070, Kimi-K2 TP8 on MI450 DPX (8k input / 1k output, concurrency 4): the median TPOT is 17.83 ms on main and 16.46 ms with the three PRs. GSM8K 5-shot is 0.935 on main and 0.940 with the three PRs. Could you review it again? |
|
Both new 96-CU config directories (gemm_a16w16 and batched_gemm_a16w16) are missing DEFAULT.json, so the current loader from #7105 falls back to the CU-agnostic directories and ignores all ten tuned files. Please add a byte-identical copy of the corresponding family’s DEFAULT.json to each directory, then verify that the tuned configs are selected on gfx1250 with 96 CUs and that other shapes retain the intended fallback behavior. |
* [FlyDSL] [Config] gfx1250 FlyDSL bf16 GEMM rows for Kimi-K2 TP8 Kimi-K2 at TP8 on gfx1250 in DPX mode (96 CUs per partition) has no tuned bf16 GEMM row for its dense shapes: the gfx1250 rows in model_configs/ are all cu_num=256, so tgemm.mm falls back to the Gluon gemm_a16w16 kernel with DEFAULT.json (or the shape's Gluon JSON). Tune the nine dense shapes for M = 1 to 256 with gemm_a16w16_tune.py on MI450 (DPX, cu_num=96) over flydsl, torch and hipblaslt (opus has no gfx1250/96 registry; asm and skinny have no gfx1250 kernels), and keep a flydsl row only where it beats the current Gluon path by more than 3% in cold-L2 CUDA-graph time (the Gluon tuning harness timing). Every winner is flydsl; the other 19 buckets stay on the Gluon fallback. gemm (N, K) rows qkv_a fused_qkv_a_proj (2112, 7168) 9 router MoE gate ( 384, 7168) 9 sh_gu shared gate_up ( 512, 7168) 9 sh_dn shared down (7168, 256) 8 o_proj (7168, 1024) 9 l0_gu layer-0 gate_up (4608, 7168) 7 l0_dn layer-0 down (7168, 2304) 8 kv_b (2048, 512) 2 (M = 64, 256) q_b (1536, 1536) 1 (M = 256) Cold-L2 CUDA-graph time against main (A/B alternated on one GPU, median of 10 rounds), speedup at M = 4 / 16 / 64: qkv_a 1.39 / 1.80 / 1.83x router 1.49 / 1.47 / 1.17x sh_gu 1.36 / 1.46 / 2.19x sh_dn 1.80 / 1.41 / 0.99x (not kept) o_proj 1.46 / 1.15 / 1.60x l0_gu 1.11 / 1.10 / 1.48x l0_dn 1.32 / 1.34 / 1.55x Per decode step these GEMMs take 0.63 / 0.72 / 1.19 ms less at concurrency 4 / 16 / 64 (kernel time x calls per step, 61 layers). Needs flydsl 0.4.0, the version setup.py pins. Signed-off-by: Yang, JiaRong <[email protected]> * [FlyDSL] [Config] Drop the Kimi-K2 gfx1250 rows that lose to the 96-CU Gluon configs Removes 30 gfx1250 FlyDSL rows (M <= 128 of N,K = 2112,7168 / 4608,7168 / 7168,256 / 7168,1024 / 7168,2304) whose shapes run faster on the Gluon configs of #6573; a CSV row takes precedence over the Gluon default, so these rows would replace the faster kernel. * [FlyDSL] [Config] Drop the Kimi-K2 gfx1250 rows that only tie the 96-CU Gluon configs o_proj (7168x1024) M=4 and 8, shared expert down (7168x256) M=32 and layer-0 gate_up (4608x7168) M=1 and 2 are within 4% of the Gluon path with the 96-CU configs, inside the run-to-run spread, so they do not meet the 3% bar the other rows were kept on. 27 gfx1250 rows remain. --------- Signed-off-by: Yang, JiaRong <[email protected]>
…EMM trees ROCm#7105 reads a <cu_num>cu/ tree only when it has a DEFAULT.json, so without one the ten Kimi-K2 files in 96cu/gluon/gemm/gemm_a16w16 and 96cu/gluon/gemm/batched_gemm_a16w16 are never read. Both DEFAULT.json files are byte-identical copies of the ones in gfx1250/gluon/gemm/, as configs/AGENTS.md asks for a new tree. Signed-off-by: Yang, JiaRong <[email protected]>
READY FOR HUMAN REVIEWPR Self-ReviewRevision Author self-review accepted. Readiness report: Author answers
Show the author's self-review answersBehavior and intentValidation and unverified scopePR-specific questionChanged op testsPR state
Copilot findings
Code and op-test hygiene
Required CI
Shadow mode reports what would block but keeps the status successful. Set |
There was a problem hiding this comment.
🔵 Needs a closer look
The gfx1250/96-CU defaults affect shapes beyond Kimi-K2, while exact-head accuracy and base/head latency checks through the merged loader remain pending on GPU hardware unavailable in this review environment.
1 resolved since last review
Review effort: Balanced
|
Thanks @yifehuan, both items are done.
|
This shape was tuned on a 96-CU partition, and gfx1250/96cu already has a tuned GEMM-A16W16-N=2112-K=7168.json (#6573), so the 256-CU file goes back to its main version. Co-authored-by: Cursor <[email protected]>
* [FlyDSL] [Config] gfx1250 FlyDSL bf16 GEMM rows for Kimi-K2 TP8 Kimi-K2 at TP8 on gfx1250 in DPX mode (96 CUs per partition) has no tuned bf16 GEMM row for its dense shapes: the gfx1250 rows in model_configs/ are all cu_num=256, so tgemm.mm falls back to the Gluon gemm_a16w16 kernel with DEFAULT.json (or the shape's Gluon JSON). Tune the nine dense shapes for M = 1 to 256 with gemm_a16w16_tune.py on MI450 (DPX, cu_num=96) over flydsl, torch and hipblaslt (opus has no gfx1250/96 registry; asm and skinny have no gfx1250 kernels), and keep a flydsl row only where it beats the current Gluon path by more than 3% in cold-L2 CUDA-graph time (the Gluon tuning harness timing). Every winner is flydsl; the other 19 buckets stay on the Gluon fallback. gemm (N, K) rows qkv_a fused_qkv_a_proj (2112, 7168) 9 router MoE gate ( 384, 7168) 9 sh_gu shared gate_up ( 512, 7168) 9 sh_dn shared down (7168, 256) 8 o_proj (7168, 1024) 9 l0_gu layer-0 gate_up (4608, 7168) 7 l0_dn layer-0 down (7168, 2304) 8 kv_b (2048, 512) 2 (M = 64, 256) q_b (1536, 1536) 1 (M = 256) Cold-L2 CUDA-graph time against main (A/B alternated on one GPU, median of 10 rounds), speedup at M = 4 / 16 / 64: qkv_a 1.39 / 1.80 / 1.83x router 1.49 / 1.47 / 1.17x sh_gu 1.36 / 1.46 / 2.19x sh_dn 1.80 / 1.41 / 0.99x (not kept) o_proj 1.46 / 1.15 / 1.60x l0_gu 1.11 / 1.10 / 1.48x l0_dn 1.32 / 1.34 / 1.55x Per decode step these GEMMs take 0.63 / 0.72 / 1.19 ms less at concurrency 4 / 16 / 64 (kernel time x calls per step, 61 layers). Needs flydsl 0.4.0, the version setup.py pins. Signed-off-by: Yang, JiaRong <[email protected]> * [FlyDSL] [Config] Drop the Kimi-K2 gfx1250 rows that lose to the 96-CU Gluon configs Removes 30 gfx1250 FlyDSL rows (M <= 128 of N,K = 2112,7168 / 4608,7168 / 7168,256 / 7168,1024 / 7168,2304) whose shapes run faster on the Gluon configs of #6573; a CSV row takes precedence over the Gluon default, so these rows would replace the faster kernel. * [FlyDSL] [Config] Drop the Kimi-K2 gfx1250 rows that only tie the 96-CU Gluon configs o_proj (7168x1024) M=4 and 8, shared expert down (7168x256) M=32 and layer-0 gate_up (4608x7168) M=1 and 2 are within 4% of the Gluon path with the 96-CU configs, inside the run-to-run spread, so they do not meet the 3% bar the other rows were kept on. 27 gfx1250 rows remain. --------- Signed-off-by: Yang, JiaRong <[email protected]>
…6573) * [Triton/Gluon] [Config] gfx1250 Gluon GEMM configs for Kimi-K2 TP8 Kimi-K2 at TP8 has dense bf16 GEMM shapes and MLA-absorb batched GEMM shapes with no gfx1250 Gluon config, so they run on DEFAULT.json: - gemm_a16w16 (N, K): q_b (1536, 1536), kv_b (2048, 512), shared expert down (7168, 256), o_proj (7168, 1024), and the layer-0 dense MLP (4608, 7168) and (7168, 2304). - batched_gemm_a16w16 B=8: absorb q (N=512, K=128) and absorb v (N=128, K=512), 8 heads per GPU at TP8. Each M bucket was picked by CUDA-graph timing on MI455X over the configs already shipped for gfx1250 in neighbouring buckets; buckets with no faster candidate keep the DEFAULT.json config. Signed-off-by: Yang, JiaRong <[email protected]> * [Triton/Gluon] [Config] Retune the Kimi-K2 TP8 gfx1250 configs over the full search space Retune the eight Kimi-K2 TP8 shapes of this PR with sweep_configs.py (--backend gluon) over the full gfx1250 Gluon search space, one sweep per M bucket from 1 to 128, on MI450 in DPX mode (96 CUs per partition): - every entry now carries waves_per_eu, as DEFAULT.json does; - the files are DEFAULT_FALLBACK, so the buckets from 256 to 4096 come from DEFAULT.json; M_LEQ_8192 keeps the first version's config, with the waves_per_eu the wrapper used for it (0). Cold-L2 CUDA-graph time against DEFAULT.json (main has no file for these shapes), M = 4 / 16 / 64: q_b (1536, 1536) 1.04 / 1.01 / 1.10x o_proj (7168, 1024) 1.59 / 1.34 / 1.86x sh_down (7168, 256) 1.90 / 1.53 / 1.11x l0_gu (4608, 7168) 1.30 / 1.21 / 1.48x l0_down (7168, 2304) 1.59 / 1.57 / 1.71x kv_b (2048, 512) 1.02 / 1.03 / 1.03x bmm_q B=8 (512, 128) 1.46 / 1.37 / 2.36x bmm_v B=8 (128, 512) 1.25 / 1.28 / 1.25x Signed-off-by: Yang, JiaRong <[email protected]> * [Triton/Gluon] [Config] Retune the gfx1250 qa_kva, router and shared-expert gate_up configs for Kimi-K2 TP8 Kimi-K2 TP8 also runs three shapes that already have gfx1250 Gluon files (from the DeepSeek-R1 and router configs): fused_qkv_a_proj_with_mqa (N=2112, K=7168), the MoE router (N=384, K=7168) and the shared-expert gate_up (N=512, K=7168). Retune their M buckets from 1 to 128 the same way, keeping every larger bucket; the kept buckets get the waves_per_eu the wrapper used for them (0). Cold-L2 CUDA-graph time against the current files, M = 4 / 16 / 64: qa_kva (2112, 7168) 1.56 / 1.81 / 1.50x router ( 384, 7168) 1.09 / 1.17 / 1.06x sh_gu ( 512, 7168) 1.10 / 1.25 / 1.67x Signed-off-by: Yang, JiaRong <[email protected]> * [Triton/Gluon] [Config] Move the new Kimi-K2 Gluon GEMM configs to gfx1250/96cu/ * [Triton/Gluon] [Config] Keep the CU-agnostic gfx1250 GEMM configs, put the 96-CU retunes in 96cu/ The fused_qkv_a (2112, 7168), router (384, 7168) and shared expert gate_up (512, 7168) retunes move to configs/gfx1250/96cu/; the CU-agnostic files are back to their main contents. * [Triton/Gluon] [Config] Keep main's configs where the 96-CU retune is not faster The 96-CU copies of the N=2112, 384 and 512 (K=7168) files take the "any" bucket (M > 8192) from the CU-agnostic file again, with waves_per_eu 0, instead of DEFAULT.json's. q_b (N=1536, K=1536) M_LEQ_1, M_LEQ_4 and M_LEQ_16 and shared expert down (N=7168, K=256) M_LEQ_64 go back to the DEFAULT.json entries main uses: in tgemm.mm on MI450 (DPX, 96 CUs) the retuned ones were 4-11% slower. * [Triton/Gluon] [Config] Add DEFAULT.json to the gfx1250 96-CU Gluon GEMM trees #7105 reads a <cu_num>cu/ tree only when it has a DEFAULT.json, so without one the ten Kimi-K2 files in 96cu/gluon/gemm/gemm_a16w16 and 96cu/gluon/gemm/batched_gemm_a16w16 are never read. Both DEFAULT.json files are byte-identical copies of the ones in gfx1250/gluon/gemm/, as configs/AGENTS.md asks for a new tree. Signed-off-by: Yang, JiaRong <[email protected]> --------- Signed-off-by: Yang, JiaRong <[email protected]>
…with rotating weights; LM-head files (#7289) * gfx1250 gluon gemm_a16w16 compute_bound: register-store epilogues, chosen per config entry (REGISTER_STORE) The compute_bound kernel ended with the gfx1250 B1 pattern: the tile is staged in LDS (ds_store), a workgroup barrier, then tensor_store_from_lds, whose LDS read can miss the waves' ds_stores on gfx1250 (no documented wait or fence closes it; B1a-B1c). A config entry may now pick the epilogue with "REGISTER_STORE": 0 the LDS-staged TDM store (default: every existing entry is unchanged), 1 buffer stores straight from the WMMA layout (as the bandwidth_bound kernel), 2 coalesced register store: convert_layout to a blocked layout of 16-byte vectors along N (an ordinary ds_store/barrier/ds_load round trip), then buffer stores rebased to the block in int64. AITER_GFX1250_A16W16_STORE=<0|1|2> overrides every entry (A/B only). Cost vs the TDM store at gpt-oss's existing entries (gfx1250 DPX partition, bf16, bias): mode 2 +0..5 % at M 256-8192, -24 % at O M=64 (30.1 -> 22.9 us), -12 % at QKV M=16; mode 1 +3..16 % at M >= 256. Plan: perf1101 P1 (B1 prerequisite of the large-M a16w16 dispatch) * gfx1250 gluon gemm_a16w16: gpt-oss large-M buckets (M_BOUNDS to 32768), retuned 4096/8192, TP2 shape files gpt-oss's QKV (N5120 K2880), O (N2880 K4096) and router (N128 K2880) files stopped at M_LEQ_8192 and the loader searched only the standard bounds, so every prefill batch above 8192 tokens (chunk 16384: 94 % of 70k/300 prefill batches, 12 % at 8k/1k c64 with mixed chunk) ran the 'any' entry, bandwidth_bound 128x128x64. The TP2 shapes (QKV N2560 K2880, O N2880 K2048) had no file at all and ran DEFAULT.json at every M. - QKV and O: M_BOUNDS up to 32768; M_LEQ_4096/8192/16384/32768 = compute_bound 256x256x64, 4 buffers, 8 warps, waves_per_eu 1, coalesced register store (REGISTER_STORE 2: no new LDS-staged TDM store epilogue). Best of 126 candidates at M 16384 (BLOCK_K dividing K), and faster than the old 4096/8192 entries. - Router: M_BOUNDS to 32768; M_LEQ_8192/16384/32768 = compute_bound 128x128x64, 4 buffers, 4 warps, register store. - TP2 QKV and O: new files with DEFAULT_FALLBACK (DEFAULT.json keeps M <= 128): M_LEQ_256..1024 = compute_bound 128x128x64, 2048..32768 = 256x256x64, register store. Kernel time, old file -> new (us, bf16 + bias, one gfx1250 DPX partition, A-B-A): QKV M 7500 340 -> 302, 8192 365 -> 307, 16384 3278 -> 618, 32768 6567 -> 1230 O M 7500 288 -> 246, 8192 293 -> 249, 16384 2643 -> 503, 32768 5252 -> 1020 router M 8192 26.7 -> 18.9, 16384 101.5 -> 26.9 TP2 QKV M 1024 51.5 -> 26.4, 7500 843 -> 167, 16384 1684 -> 308 TP2 O M 1024 43.9 -> 21.0, 7500 719 -> 132, 16384 1453 -> 267 Other buckets unchanged. fp32-reference max rel err 0.003 (same as before); CUDA-graph replay bitwise equal over 6000 calls per shape at M 8192/9000/16384/16385. Plan: perf1101 P1 (large-M a16w16 dispatch; router separately; TP2 files added) * gfx1250 gluon gemm_a16w16 compute_bound: share the register-store code, validate the store mode Review follow-up (perf1101 P1, codex round 1, findings 3-4): REGISTER_STORE outside {0, 1, 2} is rejected (ValueError on the host, static_assert in the kernel) instead of falling to the TDM store; the two register-store modes share one store helper; the store layout helper drops its unused BLOCK_M; the comment states the override's scope (non-persistent gluon compute_bound launches; unset in serving). Same kernels, same outputs: P1's correctness check passes unchanged (55 shape/M cases, old vs new bitwise equal, 2,000 replayed calls each); mode-2 store cost at the shipped 256x256 tile 1.012-1.014 of the TDM store. Plan: perf1101 P1 (review round 1) * gfx1250 gluon gemm_a16w16: gpt-oss band starts without regressions (O 2049-3072, TP2 129-1536, 2049-3072) Review follow-up (perf1101 P1, codex round 1, finding 2): a dense A-B-A over every changed band showed four band starts slower than the old schedule (O M 2049 +16 %, TP2 QKV M 1025 +9 %, TP2 O M 2049 +5 %, M 257 +3 %): 256x256 tiles just past a bound leave most of a tile empty. Per-band sweep of eight register-store tiles: O (TP1): new bound 3072, M_LEQ_3072 = 128x128x64 (2049-3072: 0.91-0.95 of old). TP2 QKV: new bound 1536; M_LEQ_256 = 128x64x64, M_LEQ_512 = 128x128x128, M_LEQ_1024/1536 = 128x128x64, M_LEQ_2048 = 256x256x64. TP2 O: new bound 3072; M_LEQ_256 = 128x64x64, M_LEQ_512 = 128x128x128, M_LEQ_1024 = 128x128x64, M_LEQ_2048 = 256x256x64, M_LEQ_3072 = 128x128x64. All compute_bound, 4 buffers, 4 warps (256x256: 8 warps), coalesced register store. Dense A-B-A (TP1 20 M from 2048 to 32768, TP2 28 M from 128 to 32768): new/old 0.17-1.01 everywhere, no point above 1.02. Old vs new outputs bitwise equal at every band boundary (65 cases, same K order); 2,000 replayed calls each, 0 mismatches. Plan: perf1101 P1 (review round 1) * gfx1250 gluon gemm_a16w16: move the TP2 gpt-oss shape files into the 96-CU tree (pure git mv) They were tuned on a 96-CU DPX partition, and since #6573 a 96-CU device reads configs/gfx1250/96cu/gluon/gemm/gemm_a16w16/ whole: in the plain tree no DPX device ever loaded them (configs/AGENTS.md, CU trees). * gfx1250 gluon gemm_a16w16: the gpt-oss QKV, O and router entries go in the 96-CU tree The retuned QKV (N 5120, K 2880), O (N 2880, K 4096) and router (N 128, K 2880) tables were measured on a 96-CU DPX partition, which reads only the 96cu tree, so on main they were never used there (Copilot, #7288). The 96cu files hold these tables whole (buckets this PR did not retune keep #6921's values); the plain-tree files go back to main's, so devices that read the plain tree see no change from this PR. * gfx1250 gluon gemm_a16w16: let the tuner search and keep REGISTER_STORE The tuner's keys are the union of the family DEFAULT.json's keys, and write_best_configs.py writes only those keys into a bucket. Neither gluon DEFAULT.json (plain or 96cu) had REGISTER_STORE, so the tuner never searched it and a retuned bucket silently lost it, going back to the LDS + TDM-store epilogue (Copilot, #7288). Every DEFAULT bucket now says REGISTER_STORE 0 (what it already meant; bandwidth_bound pops and ignores it) and SEARCH_SPACE offers 0, 1, 2. * gfx1250 gluon gemm_a16w16: black * gfx1250 gluon gemm_a16w16: test the REGISTER_STORE epilogues through the public wrapper Modes 0/1/2 on fp16 and bf16, bias on and off, at the gpt-oss bucket edges (1025, 2049, 3073) and with partial M and N tiles (M 1, 97, 300; N 200); the AITER_GFX1250_A16W16_STORE override for each mode; an invalid override (3) and an invalid entry value (5) raise ValueError (Copilot, #7288). 73 passed on gfx1250 (MI450 DPX partition, 96 CU). * gfx1250 gluon gemm_a16w16: test the tuned gpt-oss entries and their 96-CU lookup A 96-CU lookup of the QKV, O, router and TP2 shapes at M 4096-32768 must land on tuned compute_bound entries (on the PR as filed it landed on the 96cu DEFAULT's untuned bandwidth_bound rows), and every gpt-oss shape must compute the right result at M 1, 64, 1000, 2049, 3073 and 8192 through the tuned lookup. * gfx1250 gluon gemm_a16w16: read the 96-CU gpt-oss tables as gfx1250 The lookup test passed cu_num=96 and left the arch as the runner's, so MI35X asked for a gfx950 Gluon default that is not in the tree. * gfx1250 gluon gemm_a16w16: gpt-oss decode buckets and LM-head tuning, stacked on the REGISTER_STORE PR Rebuilt on top of pr-gfx1250-gemm-a16w16-large-m-regstore so the shared commits are not duplicated. Only the gpt-oss decode buckets, the LM-head shape files and the 96-CU lookup test differ from that branch. * gfx1250 gluon gemm_a16w16: drop the hardware-bug notes from the store comments
* [FlyDSL] [Config] gfx1250 FlyDSL bf16 GEMM rows for Kimi-K2 TP8 Kimi-K2 at TP8 on gfx1250 in DPX mode (96 CUs per partition) has no tuned bf16 GEMM row for its dense shapes: the gfx1250 rows in model_configs/ are all cu_num=256, so tgemm.mm falls back to the Gluon gemm_a16w16 kernel with DEFAULT.json (or the shape's Gluon JSON). Tune the nine dense shapes for M = 1 to 256 with gemm_a16w16_tune.py on MI450 (DPX, cu_num=96) over flydsl, torch and hipblaslt (opus has no gfx1250/96 registry; asm and skinny have no gfx1250 kernels), and keep a flydsl row only where it beats the current Gluon path by more than 3% in cold-L2 CUDA-graph time (the Gluon tuning harness timing). Every winner is flydsl; the other 19 buckets stay on the Gluon fallback. gemm (N, K) rows qkv_a fused_qkv_a_proj (2112, 7168) 9 router MoE gate ( 384, 7168) 9 sh_gu shared gate_up ( 512, 7168) 9 sh_dn shared down (7168, 256) 8 o_proj (7168, 1024) 9 l0_gu layer-0 gate_up (4608, 7168) 7 l0_dn layer-0 down (7168, 2304) 8 kv_b (2048, 512) 2 (M = 64, 256) q_b (1536, 1536) 1 (M = 256) Cold-L2 CUDA-graph time against main (A/B alternated on one GPU, median of 10 rounds), speedup at M = 4 / 16 / 64: qkv_a 1.39 / 1.80 / 1.83x router 1.49 / 1.47 / 1.17x sh_gu 1.36 / 1.46 / 2.19x sh_dn 1.80 / 1.41 / 0.99x (not kept) o_proj 1.46 / 1.15 / 1.60x l0_gu 1.11 / 1.10 / 1.48x l0_dn 1.32 / 1.34 / 1.55x Per decode step these GEMMs take 0.63 / 0.72 / 1.19 ms less at concurrency 4 / 16 / 64 (kernel time x calls per step, 61 layers). Needs flydsl 0.4.0, the version setup.py pins. Signed-off-by: Yang, JiaRong <[email protected]> * [FlyDSL] [Config] Drop the Kimi-K2 gfx1250 rows that lose to the 96-CU Gluon configs Removes 30 gfx1250 FlyDSL rows (M <= 128 of N,K = 2112,7168 / 4608,7168 / 7168,256 / 7168,1024 / 7168,2304) whose shapes run faster on the Gluon configs of ROCm#6573; a CSV row takes precedence over the Gluon default, so these rows would replace the faster kernel. * [FlyDSL] [Config] Drop the Kimi-K2 gfx1250 rows that only tie the 96-CU Gluon configs o_proj (7168x1024) M=4 and 8, shared expert down (7168x256) M=32 and layer-0 gate_up (4608x7168) M=1 and 2 are within 4% of the Gluon path with the 96-CU configs, inside the run-to-run spread, so they do not meet the 3% bar the other rows were kept on. 27 gfx1250 rows remain. --------- Signed-off-by: Yang, JiaRong <[email protected]>
…OCm#6573) * [Triton/Gluon] [Config] gfx1250 Gluon GEMM configs for Kimi-K2 TP8 Kimi-K2 at TP8 has dense bf16 GEMM shapes and MLA-absorb batched GEMM shapes with no gfx1250 Gluon config, so they run on DEFAULT.json: - gemm_a16w16 (N, K): q_b (1536, 1536), kv_b (2048, 512), shared expert down (7168, 256), o_proj (7168, 1024), and the layer-0 dense MLP (4608, 7168) and (7168, 2304). - batched_gemm_a16w16 B=8: absorb q (N=512, K=128) and absorb v (N=128, K=512), 8 heads per GPU at TP8. Each M bucket was picked by CUDA-graph timing on MI455X over the configs already shipped for gfx1250 in neighbouring buckets; buckets with no faster candidate keep the DEFAULT.json config. Signed-off-by: Yang, JiaRong <[email protected]> * [Triton/Gluon] [Config] Retune the Kimi-K2 TP8 gfx1250 configs over the full search space Retune the eight Kimi-K2 TP8 shapes of this PR with sweep_configs.py (--backend gluon) over the full gfx1250 Gluon search space, one sweep per M bucket from 1 to 128, on MI450 in DPX mode (96 CUs per partition): - every entry now carries waves_per_eu, as DEFAULT.json does; - the files are DEFAULT_FALLBACK, so the buckets from 256 to 4096 come from DEFAULT.json; M_LEQ_8192 keeps the first version's config, with the waves_per_eu the wrapper used for it (0). Cold-L2 CUDA-graph time against DEFAULT.json (main has no file for these shapes), M = 4 / 16 / 64: q_b (1536, 1536) 1.04 / 1.01 / 1.10x o_proj (7168, 1024) 1.59 / 1.34 / 1.86x sh_down (7168, 256) 1.90 / 1.53 / 1.11x l0_gu (4608, 7168) 1.30 / 1.21 / 1.48x l0_down (7168, 2304) 1.59 / 1.57 / 1.71x kv_b (2048, 512) 1.02 / 1.03 / 1.03x bmm_q B=8 (512, 128) 1.46 / 1.37 / 2.36x bmm_v B=8 (128, 512) 1.25 / 1.28 / 1.25x Signed-off-by: Yang, JiaRong <[email protected]> * [Triton/Gluon] [Config] Retune the gfx1250 qa_kva, router and shared-expert gate_up configs for Kimi-K2 TP8 Kimi-K2 TP8 also runs three shapes that already have gfx1250 Gluon files (from the DeepSeek-R1 and router configs): fused_qkv_a_proj_with_mqa (N=2112, K=7168), the MoE router (N=384, K=7168) and the shared-expert gate_up (N=512, K=7168). Retune their M buckets from 1 to 128 the same way, keeping every larger bucket; the kept buckets get the waves_per_eu the wrapper used for them (0). Cold-L2 CUDA-graph time against the current files, M = 4 / 16 / 64: qa_kva (2112, 7168) 1.56 / 1.81 / 1.50x router ( 384, 7168) 1.09 / 1.17 / 1.06x sh_gu ( 512, 7168) 1.10 / 1.25 / 1.67x Signed-off-by: Yang, JiaRong <[email protected]> * [Triton/Gluon] [Config] Move the new Kimi-K2 Gluon GEMM configs to gfx1250/96cu/ * [Triton/Gluon] [Config] Keep the CU-agnostic gfx1250 GEMM configs, put the 96-CU retunes in 96cu/ The fused_qkv_a (2112, 7168), router (384, 7168) and shared expert gate_up (512, 7168) retunes move to configs/gfx1250/96cu/; the CU-agnostic files are back to their main contents. * [Triton/Gluon] [Config] Keep main's configs where the 96-CU retune is not faster The 96-CU copies of the N=2112, 384 and 512 (K=7168) files take the "any" bucket (M > 8192) from the CU-agnostic file again, with waves_per_eu 0, instead of DEFAULT.json's. q_b (N=1536, K=1536) M_LEQ_1, M_LEQ_4 and M_LEQ_16 and shared expert down (N=7168, K=256) M_LEQ_64 go back to the DEFAULT.json entries main uses: in tgemm.mm on MI450 (DPX, 96 CUs) the retuned ones were 4-11% slower. * [Triton/Gluon] [Config] Add DEFAULT.json to the gfx1250 96-CU Gluon GEMM trees ROCm#7105 reads a <cu_num>cu/ tree only when it has a DEFAULT.json, so without one the ten Kimi-K2 files in 96cu/gluon/gemm/gemm_a16w16 and 96cu/gluon/gemm/batched_gemm_a16w16 are never read. Both DEFAULT.json files are byte-identical copies of the ones in gfx1250/gluon/gemm/, as configs/AGENTS.md asks for a new tree. Signed-off-by: Yang, JiaRong <[email protected]> --------- Signed-off-by: Yang, JiaRong <[email protected]>


PR Self-Review
Reviewed revision
c61e6b9
Behavior and intent
Kimi-K2 TP8 on gfx1250 with 96 CUs (MI450 DPX) gets tuned Gluon configs for ten GEMM shapes: 8
gemm_a16w16(N, K) and 2batched_gemm_a16w16(B=8). Before this PR these shapes used the gfx1250DEFAULT.jsonor configs tuned for other models, which are slow at the small-M decode buckets on a 96-CU partition. The files are inconfigs/gfx1250/96cu/. #7105 reads that tree only when it has aDEFAULT.json, so this PR adds byte-identical copies of the plain gfx1250 GluonDEFAULT.jsonto both trees. Only devices with 96 CUs read the new tree; other CU counts keep the plain tree.Validation and unverified scope
Validated:
get_gemm_config(..., backend="gluon", cu_num=96), arch gfx1250, M = 1 to 16384): each of the ten shapes is served from its96cu/file, andis_tunedis True for its tuned buckets. Withcu_num=None(the plain tree) the selection is the same as main.op_tests/tuning_tests/test_config_shape_collision.pypasses.Not yet verified on this head:
verify_configs.py --expect-tunedand the kernel timings through [Triton/Gluon] [CI] Configs per CU count: <arch>/<cu_num>cu/ trees #7105 on a 96-CU partition.PR-specific question
Workload keys, all
backend="gluon"on gfx1250 with 96 CUs:GEMM-A16W16: N=2112 K=7168, N=1536 K=1536, N=7168 K=1024, N=512 K=7168, N=7168 K=256, N=384 K=7168, N=4608 K=7168, N=7168 K=2304.BATCHED_GEMM-A16W16: B=8 N=512 K=128, B=8 N=128 K=512.Unrelated shapes: on CU counts other than 96 nothing changes, because the
96cu/tree is not read. On 96 CUs a tree is read whole, so the shapes that only have a file in the plain tree (64gemm_a16w16, 5batched_gemm_a16w16) now get the96cu/DEFAULT.json, which is byte-identical to the plainDEFAULT.json. This is the fallback the CU-tree rule intends; the CPU check above lists these shapes.Changed op tests
None