Skip to content

[FlyDSL] [gfx1250] Kimi-K3 TP1 decode: mxfp8_128 rows for every M bucket up to 1024, cluster_m 3/5 candidates - #8586

Draft
zejunchen-zejun wants to merge 2 commits into
gfx1250/k3-flydsl-fp8-gemmfrom
zejun/k3-tp1-decode-gemm-rows
Draft

zejunchen-zejun wants to merge 2 commits into
gfx1250/k3-flydsl-fp8-gemmfrom
zejun/k3-tp1-decode-gemm-rows

Conversation

@zejunchen-zejun

@zejunchen-zejun zejunchen-zejun commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fills the Kimi-K3 mxfp8_128 bpreshuffle table for the TP1 GEMMs of the PD decode (D) node at every M bucket up to 1024, and adds 8 opt-in candidates whose cluster_m is 3 or 5.

Motivation

  • The D node runs these GEMMs unsplit. It is DP8EP8 + MegaMoE with --enable-dp-attention, so the attention and dense projections run at TP1.

  • M per rank is about 120 to 960 for c192 to c1536. With DSpark k=4 every request adds 5 tokens a step, so M ≈ 5 × concurrency / 8.

  • The table had only power-of-two M rows for these shapes.

    • getPaddedM rounds M up to a multiple of 16 (M ≤ 256) or 32 (M ≤ 1024). When that bucket has no row, M falls through to the next power of two.
    • So M=315 (c512) ran the M=512 tile, and M≈640 / 960 ran the M=1024 tile.
  • KDA f_b (12288×128) had no row and ran the untuned heuristic.

  • Three rows launch a compute kernel whose tile_m is taller than part of the M range they serve:

    shape M row and kernel
    o_proj, dense-layer down_proj 65–127 M128 row, compute_t128x128x128 … sk4_cm1_cn4
    dense gate_up 129–255 M256 row, compute_t256x256x128 … cm1_cn4
    • kernel_fits_shape rejects such launches ("must not launch when M < tile_m (cluster barrier hang on decode M)"), but the dispatcher does not check.
    • c192 (M=120) hits the first two.
    • These launches were not tested: the tray has gpu_recovery=0.
  • Power-of-two clusters miss the c512 tile count. At M=315 a 128-row tile gives 3 M-tiles, so no power-of-two cluster_m fits and each M-tile reads the whole weight alone. A cluster of 3 M-tiles shares each weight read through TDM multicast.

Changes

1. aiter/configs/model_configs/kimik3_a8w8_blockscale_mxscale_bpreshuffle_tuned_gemm.csv: 456 → 654 rows.

shape N × K rows added or replaced
kda_in_proj 49408 × 7168 24
o_proj (KDA + MLA) 7168 × 12288 24
mla_gate / shexp_gate_up 12288 × 7168 22
kda_f_b 12288 × 128 44
mla_qkv_a 2176 × 7168 34
mla_q_b 18432 × 1536 27
shexp_down 7168 × 6144 27
dense gate_up 67584 × 7168 23
dense down 7168 × 33792 19

2. aiter/ops/flydsl/gemm_tune/flydsl_gemm_mxfp8_128_bpreshuffle_wmma_common.py

  • Eight candidates with cluster_m 3 or 5 are appended to kernels_list, the way [HIP] [CK] [FlyDSL] [gfx1250] Fused split-K for the generic a8w8 GEMM; retune K3 mx128 rows #8246 appended its opt-in K3 candidates. Existing kernelIds are unchanged (9719 → 9727).
  • kernel_fits_shape accepts the compute clusters (3, 1) and (3, 4) they use.
  • cluster_m is a launch argument, and the multicast masks (compute_mcast_masks_runtime, bit x + cm·y) do not assume a power of two. So no kernel code changes.

How a row was chosen

  1. Candidates. The [HIP] [CK] [FlyDSL] [gfx1250] Fused split-K for the generic a8w8 GEMM; retune K3 mx128 rows #8246 tuner space (9719 kernels), restricted to row-major A and split-K 1 or fused. A candidate must pass kernel_fits_shape at both ends of the bucket, so no M the row serves drops its cluster or runs a compute tile taller than M.
  2. Buckets. Every 16-aligned bucket from 16 to 256 and every 32-aligned bucket from 288 to 1024, plus M 1/2/4/8 for f_b.
    • The full candidate space was swept at 16 points: M 16–1024.
    • The other buckets were swept on the union of those points' top-25.
    • The top 12 of each bucket were re-timed interleaved and checked against the FP32 reference.
  3. When a row changes.
    • The new kernel is at least 3% faster than today's launch for that bucket in an ABBA A/B on one GPU (210 rows). Today's launch is the bucket's own row, or the row it falls through to.
    • Or today's kernel does not fit the bucket (16 rows).
  4. Fallthrough guard. A replaced power-of-two row also changes the buckets that fall through to it. Where that new launch is more than 1% slower than today's (ABBA), today's kernel is pinned as the bucket's own row. This gives 12 rows; for example, mla_q_b M 544–608 would otherwise run 0.60× through the new M1024 row.
  5. Clusters of 3 and 5.
    • 457 variants (cluster_m 3, 5, 10 or 15, dividing the M-tile count at both ends of a decode bucket) were each launched once on hardware first, at both ends of their bucket. None hung, and all but one matched the FP32 reference; that one is an _nlb variant, rejected before launch.
    • They were then timed and ABBA-compared with the previous kernel for each bucket.
    • 8 rows at M160 and M320 are in, and they gain inside the decode step (−12.8% at c512 over the first commit).
    • Variants at M640 were faster alone but gave 0.0% inside the step, so they are not in.
  6. Left alone. The M=1024 rows of the two dense-FFN shapes, which [Config] [Perf] Tune eight Kimi K3 TP1 dense E8M0 GEMM rows on gfx1250 #8557 retunes for prefill. Rows above M=1024 are unchanged.

Performance

Setup

  • gfx1250, 256 CUs, one 4-GPU tray.
  • Image rocm/fw-bringup:gfx1250-atom-k3-20261120, with its aiter switched to this branch's kernels, candidates and table. FlyDSL 0.5.0.
  • Every kernel is timed as at least 16 back-to-back calls in a CUDA graph, over rotated weight copies (≥2.2 GB, so W comes from HBM as in decode). The figure is the median per-call time.

Decode-step proxy

  • What it measures: the main-stream dense A8W8 GEMMs of one K3 decode step, all in one CUDA graph.
    • 68 KDA layers: in_proj, f_b, o_proj.
    • 24 MLA layers: qkv_a, q_b, gate, o_proj.
  • Every layer has its own weights (35 GB).
  • Measured at every multiple of 5 from M 100 to 960 (173 M) on 4 GPUs. With DSpark k=4, decode M is 5 × requests, so it is rarely a bucket top.
  • The before table, a null copy of it, and the after table are replayed in a shuffled order each round. The null control has mean −0.01% (−3.4% to +1.6% at a single M).
  • Each row is the mean over the M a rank sees at that concurrency: 0.8× to 1.0× of 5c/8.
Hardware Workload Before After Change
gfx1250 K3 D-node decode GEMMs per step, c192 (M 100–120 per rank) 5.25 ms 4.47 ms -14.8%
gfx1250 same, c256 (M 130–160) 7.11 ms 6.42 ms -9.7%
gfx1250 same, c384 (M 195–240) 7.50 ms 6.76 ms -9.9%
gfx1250 same, c512 (M 260–320) 11.42 ms 8.72 ms -23.6%
gfx1250 same, c768 (M 385–480) 12.10 ms 10.32 ms -14.8%
gfx1250 same, c1024 (M 515–640) 16.82 ms 13.24 ms -21.3%
gfx1250 same, c1536 (M 770–960) 21.43 ms 17.17 ms -19.9%
  • Over all 173 M: mean −17.0%. The smallest gain is −2.3% (M=135); no M is slower.
  • The earlier single-M figures were −4.7 / −14.6 / −10.3 / −26.0 / −18.9 / −20.0 / −20.3% at M 120/160/240/315/480/640/960, mostly bucket tops.

Largest gains

  • kda_in_proj.
    • At c512: 95.1 → 66.6 µs a call, 1.43×, with compute_t128x256x128 cm3: the 3 M-tiles share each W read. It is called 68 times a step.
    • At M 288–1024: 1.18–1.31×, with compute_t256x256x128 cm2/cm4.
  • o_proj at c512: 24.3 → 21.6 µs, 1.13× (cm3, fused split-K 2). It is called 92 times a step.
  • kda_f_b: 1.13–1.88× over the heuristic.
  • mla_qkv_a: up to 1.30×.
Per shape at the bucket of each concurrency (µs per call; ABBA of today's launch against the new one where the kernel changed)
shape c (M bucket) before kernel after kernel before µs after µs speedup
kda_in_proj c192 (M128) t128x256x256_mw2_nw2_nb3_sk1_cm1_cn1 unchanged 40.07 40.07 1.00
kda_in_proj c256 (M160) t256x256x128_mw2_nw2_nb4_sk1_cm1_cn1 unchanged 56.44 56.44 1.00
kda_in_proj c384 (M240) t256x256x128_mw2_nw2_nb4_sk1_cm1_cn1 unchanged 58.21 58.21 1.00
kda_in_proj c512 (M320) t256x256x128_mw2_nw2_nb4_sk1_cm1_cn1 @M512 C_t128x256x128_mw2_nw2_nb3_sk1_cm3_cn1 @m320 95.13 66.64 1.43
kda_in_proj c768 (M480) t256x256x128_mw2_nw2_nb4_sk1_cm1_cn1 @M512 C_t256x256x128_mw2_nw2_nb4_sk1_cm2_cn1 @m480 98.71 81.56 1.21
kda_in_proj c1024 (M640) t256x256x128_mw2_nw2_nb4_sk1_cm1_cn1 @m1024 t128x256x128_mw2_nw2_nb3_sk1_cm1_cn1 @m640 147.52 118.38 1.25
kda_in_proj c1536 (M960) t256x256x128_mw2_nw2_nb4_sk1_cm1_cn1 @m1024 C_t256x256x128_mw2_nw2_nb2_sk1_cm4_cn1 @m960 189.84 146.31 1.30
o_proj c192 (M128) C_t128x128x128_mw2_nw2_nb4_sk4_cm1_cn4 @m128 t128x128x256_mw2_nw2_nb4_sk4_cm1_cn1_fsk @m128 13.83 13.78 1.00
o_proj c256 (M160) C_t128x128x128_mw2_nw2_nb4_sk2_cm2_cn4 @M256 C_t128x128x128_mw2_nw2_nb4_sk2_cm2_cn4_fsk @M160 17.62 17.16 1.03
o_proj c384 (M240) C_t128x128x128_mw2_nw2_nb4_sk2_cm2_cn4 @M256 C_t128x128x128_mw2_nw2_nb4_sk2_cm2_cn4_fsk @m240 19.07 17.30 1.10
o_proj c512 (M320) C_t128x128x128_mw2_nw2_nb4_sk1_cm4_cn4 @M512 C_t128x256x128_mw2_nw2_nb3_sk2_cm3_cn1_fsk @m320 24.29 21.57 1.13
o_proj c768 (M480) C_t128x128x128_mw2_nw2_nb4_sk1_cm4_cn4 @M512 C_t128x256x128_mw2_nw2_nb3_sk2_cm4_cn1_fsk @M512 26.76 24.89 1.08
o_proj c1024 (M640) C_t128x256x128_mw2_nw2_nb3_sk1_cm4_cn4 @m1024 C_t256x256x128_mw2_nw2_nb4_sk2_cm1_cn2_fsk @m640 35.89 35.45 1.01
o_proj c1536 (M960) C_t128x256x128_mw2_nw2_nb3_sk1_cm4_cn4 unchanged 40.38 40.38 1.00
mla_gate c192 (M128) t64x128x512_mw1_nw4_nb3_sk1_cm1_cn1 @m128 t128x128x256_mw2_nw2_nb4_sk2_cm1_cn1_fsk @m128 14.27 13.63 1.05
mla_gate c256 (M160) C_t128x128x128_mw2_nw2_nb4_sk1_cm2_cn4 unchanged 22.33 22.33 1.00
mla_gate c384 (M240) C_t128x128x128_mw2_nw2_nb4_sk1_cm2_cn4 unchanged 23.50 23.50 1.00
mla_gate c512 (M320) C_t128x256x128_mw2_nw2_nb3_sk1_cm4_cn4 @M512 t64x128x256_mw2_nw2_nb3_sk1_cm5_cn2 @m320 22.41 20.89 1.07
mla_gate c768 (M480) C_t128x256x128_mw2_nw2_nb3_sk1_cm4_cn4 @M512 C_t128x256x128_mw2_nw2_nb3_sk1_cm4_cn1 @m480 24.42 22.22 1.10
mla_gate c1024 (M640) C_t256x256x128_mw2_nw2_nb4_sk1_cm2_cn4 @m1024 C_t128x256x128_mw2_nw2_nb3_sk1_cm1_cn4 @m640 29.95 28.44 1.05
mla_gate c1536 (M960) C_t256x256x128_mw2_nw2_nb4_sk1_cm2_cn4 @m1024 C_t256x256x128_mw2_nw2_nb4_sk1_cm2_cn2 @m960 34.47 33.35 1.03
kda_f_b c192 (M128) heuristic (no row) @MNone t32x64x128_mw2_nw2_nb2_sk1_cm4_cn2 @m128 3.22 2.09 1.55
kda_f_b c256 (M160) heuristic (no row) @MNone t32x128x128_mw2_nw2_nb2_sk1_cm5_cn1 @M160 3.01 2.23 1.35
kda_f_b c384 (M240) heuristic (no row) @MNone t64x32x128_mw4_nw1_nb2_sk1_cm4_cn4 @m240 3.18 2.35 1.35
kda_f_b c512 (M320) heuristic (no row) @MNone t64x128x128_mw1_nw4_nb2_sk1_cm1_cn1 @m320 3.40 2.62 1.30
kda_f_b c768 (M480) heuristic (no row) @MNone t128x128x128_mw2_nw2_nb2_sk1_cm4_cn1 @m480 3.37 2.72 1.24
kda_f_b c1024 (M640) heuristic (no row) @MNone t64x128x128_mw1_nw4_nb2_sk1_cm1_cn1 @m640 3.55 3.05 1.16
kda_f_b c1536 (M960) heuristic (no row) @MNone t128x128x128_mw2_nw2_nb2_sk1_cm4_cn1 @m960 4.08 3.57 1.14
mla_qkv_a c192 (M128) t64x128x256_mw1_nw4_nb4_sk4_cm1_cn1_fsk @m128 t32x32x512_mw2_nw2_nb4_sk1_cm4_cn4 @m128 7.12 6.69 1.06
mla_qkv_a c256 (M160) t64x128x256_mw1_nw4_nb4_sk4_cm1_cn1_fsk @M160 t64x32x1024_mw4_nw1_nb3_sk1_cm1_cn4 @M160 7.69 6.70 1.15
mla_qkv_a c384 (M240) t64x128x256_mw1_nw4_nb3_sk4_cm2_cn1_fsk @m240 t64x64x512_mw2_nw2_nb4_sk1_cm4_cn2 @m240 8.82 8.31 1.06
mla_qkv_a c512 (M320) t64x128x256_mw2_nw2_nb3_sk4_cm2_cn1_fsk @m320 t64x64x512_mw2_nw2_nb4_sk1_cm1_cn2 @m320 9.68 8.84 1.10
mla_qkv_a c768 (M480) t64x128x512_mw1_nw4_nb3_sk1_cm1_cn1_qe @M512 C_t128x128x128_mw2_nw2_nb4_sk2_cm2_cn1_fsk @m480 12.12 11.17 1.08
mla_qkv_a c1024 (M640) C_t128x128x128_mw2_nw2_nb4_sk2_cm8_cn1_fsk unchanged 12.80 12.80 1.00
mla_qkv_a c1536 (M960) t128x128x256_mw2_nw2_nb4_sk1_cm1_cn1 @m1024 t64x128x512_mw1_nw4_nb3_sk1_cm1_cn1 @m960 18.02 14.68 1.23
mla_q_b c192 (M128) t128x128x256_mw2_nw2_nb4_sk1_cm8_cn1 unchanged 7.31 7.31 1.00
mla_q_b c256 (M160) t64x128x256_mw2_nw2_nb3_sk1_cm1_cn4 @M160 t64x128x256_mw2_nw2_nb3_sk1_cm3_cn1 @M160 7.12 6.45 1.10
mla_q_b c384 (M240) C_t128x256x128_mw2_nw2_nb4_sk1_cm8_cn2 @m240 t256x128x256_mw2_nw2_nb3_sk1_cm1_cn1 @m240 7.41 7.20 1.03
mla_q_b c512 (M320) C_t128x256x128_mw2_nw2_nb4_sk1_cm4_cn1 @m320 C_t128x256x128_mw2_nw2_nb4_sk1_cm3_cn1 @m320 8.13 7.60 1.07
mla_q_b c768 (M480) C_t256x256x128_mw2_nw2_nb4_sk1_cm2_cn2 @M512 C_t256x256x128_mw2_nw2_nb4_sk1_cm2_cn1 @m480 9.80 9.08 1.08
mla_q_b c1024 (M640) C_t256x256x128_mw2_nw2_nb4_sk1_cm2_cn2 @m1024 C_t256x256x128_mw2_nw2_nb2_sk1_cm1_cn2 @m640 12.13 11.48 1.06
mla_q_b c1536 (M960) C_t256x256x128_mw2_nw2_nb4_sk1_cm2_cn2 @m1024 C_t256x256x128_mw2_nw2_nb4_sk1_cm1_cn2_ps2 @m960 20.93 17.95 1.17
shexp_down c192 (M128) t64x64x512_mw2_nw2_nb3_sk1_cm1_cn1 @m128 t64x64x512_mw2_nw2_nb4_sk1_cm1_cn1 @m128 10.36 9.26 1.12
shexp_down c256 (M160) t64x128x512_mw1_nw4_nb3_sk1_cm1_cn1 @M256 t64x128x512_mw1_nw4_nb3_sk1_cm3_cn1_qe @M160 11.65 10.92 1.07
shexp_down c384 (M240) t64x128x512_mw1_nw4_nb3_sk1_cm1_cn1 @M256 C_t128x128x128_mw2_nw2_nb4_sk2_cm2_cn4_fsk @m240 12.57 11.35 1.11
shexp_down c512 (M320) C_t128x128x128_mw2_nw2_nb4_sk1_cm4_cn4 @M512 C_t128x128x128_mw2_nw2_nb4_sk1_cm3_cn4 @m320 13.50 13.01 1.04
shexp_down c768 (M480) C_t128x128x128_mw2_nw2_nb4_sk1_cm4_cn4 unchanged 17.32 17.32 1.00
shexp_down c1024 (M640) C_t128x256x128_mw2_nw2_nb3_sk1_cm4_cn4 unchanged 21.68 21.68 1.00
shexp_down c1536 (M960) C_t128x256x128_mw2_nw2_nb3_sk1_cm4_cn4 @m1024 C_t128x256x128_mw2_nw2_nb3_sk1_cm4_cn1 @m960 23.13 21.17 1.09
ffn_gate_up c192 (M128) t128x128x128_mw2_nw2_nb3_sk1_cm1_cn1 @m128 t128x256x128_mw2_nw2_nb3_sk1_cm1_cn1 @m128 51.95 49.42 1.05
ffn_gate_up c256 (M160) C_t256x256x128_mw2_nw2_nb4_sk1_cm1_cn4 @M256 (tile taller than M) C_t128x256x128_mw2_nw2_nb3_sk1_cm2_cn1 @M160 not launched 77.87 fit fix
ffn_gate_up c384 (M240) C_t256x256x128_mw2_nw2_nb4_sk1_cm1_cn4 @M256 (tile taller than M) C_t128x256x128_mw2_nw2_nb3_sk1_cm2_cn1 @m240 not launched 81.24 fit fix
ffn_gate_up c512 (M320) C_t256x256x128_mw2_nw2_nb4_sk1_cm2_cn4 unchanged 109.48 109.48 1.00
ffn_gate_up c768 (M480) C_t256x256x128_mw2_nw2_nb4_sk1_cm2_cn4 unchanged 107.34 107.34 1.00
ffn_gate_up c1024 (M640) C_t256x256x128_mw2_nw2_nb4_sk1_cm4_cn2 @m1024 C_t256x256x128_mw2_nw2_nb4_sk1_cm1_cn4 @m640 149.62 143.89 1.04
ffn_gate_up c1536 (M960) C_t256x256x128_mw2_nw2_nb4_sk1_cm4_cn2 unchanged 173.90 173.90 1.00
ffn_down c192 (M128) C_t128x128x128_mw2_nw2_nb4_sk4_cm1_cn4 @m128 t128x128x256_mw2_nw2_nb4_sk4_cm1_cn1_fsk @m128 27.48 29.18 0.94
ffn_down c256 (M160) C_t128x256x128_mw2_nw2_nb3_sk4_cm2_cn4 @M256 C_t128x256x128_mw2_nw2_nb3_sk4_cm2_cn2_fsk @M256 35.20 34.47 1.02
ffn_down c384 (M240) C_t128x256x128_mw2_nw2_nb3_sk4_cm2_cn4 @M256 C_t128x256x128_mw2_nw2_nb3_sk4_cm2_cn2_fsk @m240 39.40 37.91 1.04
ffn_down c512 (M320) C_t256x256x128_mw2_nw2_nb2_sk4_cm2_cn4 unchanged 59.19 59.19 1.00
ffn_down c768 (M480) C_t256x256x128_mw2_nw2_nb2_sk4_cm2_cn4 unchanged 65.02 65.02 1.00
ffn_down c1024 (M640) C_t256x256x128_mw2_nw2_nb2_sk2_cm4_cn4 @m1024 C_t256x256x128_mw2_nw2_nb4_sk2_cm1_cn1_fsk @m640 94.92 88.38 1.07
ffn_down c1536 (M960) C_t256x256x128_mw2_nw2_nb2_sk2_cm4_cn4 unchanged 101.30 101.30 1.00

Testing

  • Every row's kernelId matches its kernelName in kernels_list.
  • Static check over every M from 1 to 1024 for all 9 shapes: the row the runtime picks, and the kernel it launches (cluster_m fitted), pass kernel_fits_shape. Before this change, 253 M did not (o_proj 63, dense down 63, dense gate_up 127).
  • Every decode M (multiples of 5 from 120 to 995) hits a tuned row, checked with AITER_LOG_TUNED_CONFIG=1.
  • The public entry gemm_a8w8_blockscale_bpreshuffle at every M from 1 to 1024 for all 9 shapes (9216 calls), with 0 failures:
    • errRatio ≤ 0.05 against the FP32 dequantized reference;
    • a CUDA-graph replay over a NaN-poisoned output equals eager bit for bit.
  • In-model check on a DP8EP8 D node (c512 decode breakdown and GSM8K) is pending.

Not covered: M above 1024 (prefill), kv_b (PTPC) and the BF16 GEMMs.

🤖 Generated with Claude Code

zejunchen-zejun and others added 2 commits November 24, 2026 14:42
…ket up to 1024

The PD decode node (DP8EP8, attention at TP1) runs its dense A8W8 GEMMs at
M = 5 tokens x requests per rank, about 120 to 960 for c192 to c1536. The K3
mx128 table had only power-of-two M rows for these TP1 shapes, so M=315 ran the
M=512 tile and M=640/960 the M=1024 tile; KDA f_b (12288x128) had no row; and
the o_proj / dense down M128 rows and the dense gate_up M256 row launch a
compute tile taller than part of the M range they serve.

194 rows added, 44 replaced over 9 shapes, kernels from #8246's space:
- 210 rows >= 3% faster than today's launch for their bucket in an ABBA A/B;
- 16 rows replace kernels that do not fit every M of their bucket;
- 12 rows pin today's kernel where a replaced power-of-two row would make the
  buckets falling through to it more than 1% slower.
Every row fits both ends of its bucket (kernel_fits_shape). Dense FFN M=1024
rows (#8557) and rows above M=1024 are unchanged.

Main-stream decode GEMMs per step (one CUDA graph, per-layer weights):
-11.4% at c192, -14.9% at c512, -19.9% at c1024, -20.0% at c1536.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…r rows

At M=315 (c512) a 128-row tile gives 3 M-tiles, which no power-of-two
cluster_m covers, so each M-tile read the whole weight on its own. A cluster of
3 (or 5) M-tiles shares each weight read through TDM multicast.

- Eight opt-in candidates with cluster_m 3 or 5 appended to kernels_list
  (existing kernelIds unchanged); kernel_fits_shape accepts the compute
  clusters (3, 1) and (3, 4) they use.
- Eight rows at M 160 and 320, each >= 3% faster than the previous row for
  its bucket in an ABBA A/B: kda_in_proj M320 1.11x, o_proj M320 1.15x,
  mla_q_b M160 1.10x, mla_gate M320 1.10x, mla_q_b M320 1.06x, kda_f_b M160
  1.06x, shexp_down M160 / M320 1.04x.
- All 457 such variants of the decode buckets' best kernels were launched
  once on hardware first, at both ends of their bucket: none hung, all but
  one _nlb variant (rejected before launch) matched the FP32 reference.
- Variants at M640 that were faster alone gave no gain inside the decode
  step (0.0% with the table order shuffled), so they are not included.

Decode-step proxy (main-stream GEMMs, 4 GPUs): c512 -26.0% against the old
table (was -14.9% with the previous commit), c256 -14.6%.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@zejunchen-zejun zejunchen-zejun changed the title [Config] [gfx1250] Kimi-K3 TP1 decode: mxfp8_128 rows for every M bucket up to 1024 [FlyDSL] [gfx1250] Kimi-K3 TP1 decode: mxfp8_128 rows for every M bucket up to 1024, cluster_m 3/5 candidates Nov 24, 2026
ZLkanyo009 added a commit to ZLkanyo009/aiter that referenced this pull request Nov 25, 2026
Port the tuning by zejunchen-zejun from ROCm#8586, ROCm#8601 and ROCm#8634,
with the required ROCm#8246 implementation and two inherited qkv_a rows.
Resolve overlapping dense/f_b choices in favor of the peer workload
coverage; retain our remaining dense, DSpark and PTPC contributions.
Preserve the dev underfilled-compute guard, fallback policy, existing
ROCm#8348 latent rows, and unrelated architecture rows. GPU validation of
the combined dev revision is still pending.

Source-PR: ROCm#85868311172
Source-PR: ROCm#86010d0c8d7
Source-PR: ROCm#86341f962ee
Dependency-PR: ROCm#8246ccc4270
Signed-off-by: Ling Zhang <[email protected]>
aoli26 added a commit that referenced this pull request Nov 26, 2026
…to the K3 TP1 table

Table: this branch's row is kept unless the PR's row was measured faster, inside
the K3 decode step for the shapes that step runs (4 serial runs agreeing) and by a
3-pass isolated A/B for shared down and dense gate_up. 27 rows of the PR are
taken (8 of them new buckets); two of them name cluster_m 3 / 5 kernels, whose
kernelId is the one of this branch's catalog.

Candidate list: this branch's is kept. It already holds 7 of the PR's 8
cluster_m 3 / 5 candidates among its npot families; the eighth
(t64x128x512 cm3 _qe) is used by no row taken here.
gbyu-amd pushed a commit that referenced this pull request Dec 1, 2026
#8978)

* K3 TP1 a8w8 GEMM: compute N tail, underfilled tiles, aligned A-scale loads, retuned rows (#8778 @ ea7a5d8)

#8778 (aoli26; base main; open) applied to k3-455-dev as its net change on its 19 files at head
ea7a5d8 (2026-11-26T14:47:07Z), 3-way against the PR's main base adbb6ac. The 8 files k3-455-dev had
changed (all only by #8246 @ 15808c7) take the PR's version, so all 19 files equal the PR head. It
carries the newer #8246 (ccc4270), the table PRs #8579 / #8586 / #8601 and main's #8566 (its compute
guard, which #8778 replaces); no other main change rides in.

Validated in the K3 1P1D integration branch (aiter zejun/k3-455-dev 627e1eb) on 16 MI455X
(wuhuikx/LLM-Booster#578). The PR head has moved on since (204ce9d: merges of #8246 @ 0d6cf15 and of
main, which brings #8737); those can follow when #8778 lands.

Co-authored-by: zejunchen-zejun <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Update K3 FP8 kernels to c997 and add exact-M tuning

Preserve the existing dev wrappers and bucket tables. Add 162 accepted retuned exact configurations and 3 c997-default compatibility records, with CPU dispatch coverage for all 675 measured points. Backport the three kernel files from c99781c without merging main history. Integrated-head GPU validation remains outstanding.

---------

Co-authored-by: aoli26 <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Zhang <[email protected]>
gbyu-amd pushed a commit that referenced this pull request Dec 3, 2026
#8978)

* K3 TP1 a8w8 GEMM: compute N tail, underfilled tiles, aligned A-scale loads, retuned rows (#8778 @ ea7a5d8)

#8778 (aoli26; base main; open) applied to k3-455-dev as its net change on its 19 files at head
ea7a5d8 (2026-11-26T14:47:07Z), 3-way against the PR's main base adbb6ac. The 8 files k3-455-dev had
changed (all only by #8246 @ 15808c7) take the PR's version, so all 19 files equal the PR head. It
carries the newer #8246 (ccc4270), the table PRs #8579 / #8586 / #8601 and main's #8566 (its compute
guard, which #8778 replaces); no other main change rides in.

Validated in the K3 1P1D integration branch (aiter zejun/k3-455-dev 627e1eb) on 16 MI455X
(wuhuikx/LLM-Booster#578). The PR head has moved on since (204ce9d: merges of #8246 @ 0d6cf15 and of
main, which brings #8737); those can follow when #8778 lands.

Co-authored-by: zejunchen-zejun <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Update K3 FP8 kernels to c997 and add exact-M tuning

Preserve the existing dev wrappers and bucket tables. Add 162 accepted retuned exact configurations and 3 c997-default compatibility records, with CPU dispatch coverage for all 675 measured points. Backport the three kernel files from c99781c without merging main history. Integrated-head GPU validation remains outstanding.

---------

Co-authored-by: aoli26 <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Zhang <[email protected]>
(cherry picked from commit 1cc9d02)

Rebase onto main 12-03: the 19 files keep this commit's content; only main's later changes are added: the AOT launcher factories of #8678 (mxfp8 / batched wrappers launch gemm_a8w8_launcher.lazy(), _gemm_a8w8_compute_bound_launcher.lazy(), splitk_reduce_launcher.lazy(); _lazy_import keeps _data_ptr), #7449's deferred split-K entry points and #8636's ragged-K fallback. gemm_a8w8_gfx1250.py: this commit's rank0 split-K epilogue and flush_addr (it already carries #8737's flush). gemm_op_a8w8.py: main's #8566 guard in get_mxscale_bpreshuffle_config (no padded row below a compute kernel's M tile) is removed, as on the #8778 head, because the c997 compute kernel serves underfilled tiles; test_gemm_host_dispatch_cache.py takes #8778's test_mxscale_compute_row_serves_underfilled_m_tile in place of main's two guard tests. kimik3 mxscale tuned CSV: this commit's rows (626 changed or added) replayed by key; the result equals this commit's table.

Rebase onto main 12-03: main #7449 moved the bpreshuffle row lookup into _bpreshuffle_config(XQ, WQ); this commit's Kimi-K3 exact-row lookup there needs x_scale, w_scale and Y, so _bpreshuffle_config takes them (the deferred split-K path passes a meta tensor of the output's shape and dtype, so it picks the same row as gemm_a8w8_bpreshuffle).

Rebase onto main 12-03: op_tests/test_gemm_a8w8_mxfp8_bpreshuffle.py counts reduce launches through splitk_reduce_launcher.lazy (main #8678 replaced _compile_splitk_reduce).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant