Repository navigation
[Config] [gfx1250] Kimi-K3 TP1 prefill: mxfp8_128 rows at M 2048-16384 (stacked on #8586) - #8601
Draft
zejunchen-zejun wants to merge 1 commit into
Draft
zejunchen-zejun wants to merge 1 commit into
zejunchen-zejun wants to merge 1 commit into
Conversation
The PD prefill node (PP8 x TP1) runs these GEMMs at about 16K tokens a forward. The power-of-two rows from 2048 up serve every M above 1024 (getPaddedM gl=1; for N > 4096 every M above 8192 without an exact row lands on the 8192 row). 20 rows replaced and 4 added (kda_f_b had none above 1024), each >= 3% faster at its M in an ABBA A/B and not below 0.99x at two interior points of the range the row serves. kda_in_proj moves from the generic kernel to compute t256x256 with cluster_m 4 (1.23-1.27x). Prefill proxy (all TP1 GEMMs of one forward, per-layer weights): -12.9% at M=16384, -12.4% at 8192, -10.8% at 4096. Large-M correctness: 9 shapes x 24 M points, 0 failures. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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
… TP1 table Table only. This branch's prefill rows are kept (in_proj and q_a+kv_a use the N tail compute tiles, which the PR does not have) except 6 rows the PR measured faster here: dense gate_up M2048/4096/8192 (3-pass isolated A/B, 1.08-1.09x) and the M8192 rows of o_proj, gate / shared gate_up and shared down, which are faster inside the K3 prefill step at the M above 8192 they also serve.
5 of 10 tasks
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Retunes the Kimi-K3 mxfp8_128 bpreshuffle rows at M 2048 / 4096 / 8192 / 16384 for the PD prefill (P) node.
kda_f_b), over 8 shapes.Motivation
getPaddedMgl=1): 1025–2047 → 2048, 2049–4095 → 4096, 4097–8191 → 8192;cluster_m4 along M does fit.Changes
aiter/configs/model_configs/kimik3_a8w8_blockscale_mxscale_bpreshuffle_tuned_gemm.csv: 654 → 658 rows.Rows that changed
compute_t256x256x128 nb2 cm4_cn1(generic before)How a row was chosen
Candidates. The full [HIP] [CK] [FlyDSL] [gfx1250] Fused split-K for the generic a8w8 GEMM; retune K3 mx128 rows #8246 space at each M (row-major A, split-K 1 or fused), every candidate fitting both ends of its gl=0 bucket. Timed in a CUDA graph with 4 calls a replay, then the top 12 re-timed interleaved with the FP32 check.
The row's own M. The candidate must be at least 3% faster than today's row in an ABBA A/B on one GPU.
The range the row serves. The candidate must not be slower than 0.99× at two interior points of the range the row also serves, also by ABBA:
mla_qkv_a(N ≤ 4096).This rule rejected 10 of the 34 candidates. For example,
mla_qkv_aM8192 was 1.06× at 8192 but 0.90× at 7600.Overlap with [Config] [Perf] Tune eight Kimi K3 TP1 dense E8M0 GEMM rows on gfx1250 #8557. The dense FFN rows overlap the keys of draft [Config] [Perf] Tune eight Kimi K3 TP1 dense E8M0 GEMM rows on gfx1250 #8557.
Every candidate row: ABBA at its M and at the interior points
t256x256x128_mw2_nw2_nb4_sk1_cm1_cn1C_t256x256x128_mw2_nw2_nb2_sk1_cm4_cn1t256x256x128_mw2_nw2_nb4_sk1_cm1_cn1C_t256x256x128_mw2_nw2_nb2_sk1_cm4_cn1t256x256x128_mw2_nw2_nb4_sk1_cm1_cn1C_t256x256x128_mw2_nw2_nb2_sk1_cm4_cn1t256x256x128_mw2_nw2_nb4_sk1_cm1_cn1C_t256x256x128_mw2_nw2_nb2_sk1_cm4_cn1C_t256x256x128_mw2_nw2_nb4_sk1_cm4_cn4C_t256x256x128_mw2_nw2_nb4_sk1_cm1_cn2C_t256x256x128_mw2_nw2_nb4_sk1_cm2_cn2C_t256x256x128_mw2_nw2_nb4_sk1_cm1_cn2_ps2C_t256x256x128_mw2_nw2_nb4_sk1_cm2_cn2C_t256x256x128_mw2_nw2_nb4_sk1_cm2_cn4C_t256x256x128_mw2_nw2_nb4_sk1_cm2_cn2C_t256x256x128_mw2_nw2_nb2_sk1_cm4_cn2C_t256x256x128_mw2_nw2_nb4_sk1_cm2_cn2C_t256x256x128_mw2_nw2_nb4_sk1_cm4_cn2C_t256x256x128_mw2_nw2_nb4_sk1_cm4_cn2C_t256x256x128_mw2_nw2_nb4_sk1_cm4_cn4C_t256x256x128_mw2_nw2_nb4_sk1_cm2_cn2C_t256x256x128_mw2_nw2_nb4_sk1_cm4_cn4C_t256x256x128_mw2_nw2_nb4_sk1_cm2_cn2C_t256x256x128_mw2_nw2_nb4_sk1_cm4_cn4heuristic (no row)t64x256x128_mw2_nw2_nb2_sk1_cm4_cn1heuristic (no row)t128x256x128_mw2_nw2_nb2_sk1_cm2_cn4heuristic (no row)t256x128x128_mw4_nw1_nb2_sk1_cm1_cn4heuristic (no row)t256x128x128_mw4_nw1_nb2_sk1_cm2_cn2t256x128x256_mw2_nw2_nb3_sk1_cm1_cn1t128x128x256_mw2_nw2_nb2_sk1_cm2_cn1C_t128x128x128_mw2_nw2_nb4_sk1_cm4_cn1C_t128x128x128_mw2_nw2_nb4_sk1_cm2_cn1t256x128x256_mw2_nw2_nb3_sk1_cm1_cn1C_t128x128x128_mw2_nw2_nb4_sk1_cm4_cn1C_t256x256x128_mw2_nw2_nb4_sk1_cm2_cn2C_t256x256x128_mw2_nw2_nb4_sk1_cm1_cn4C_t256x256x128_mw2_nw2_nb4_sk1_cm4_cn2C_t256x256x128_mw2_nw2_nb4_sk1_cm2_cn4C_t256x256x128_mw2_nw2_nb4_sk1_cm4_cn4C_t256x256x128_mw2_nw2_nb4_sk1_cm2_cn4_ps2C_t256x256x128_mw2_nw2_nb2_sk1_cm4_cn4_ps2C_t256x256x128_mw2_nw2_nb2_sk1_cm2_cn2_ps2C_t256x256x128_mw2_nw2_nb4_sk1_cm4_cn4C_t256x256x128_mw2_nw2_nb4_sk1_cm4_cn2C_t256x256x128_mw2_nw2_nb4_sk1_cm2_cn2C_t256x256x128_mw2_nw2_nb4_sk1_cm1_cn2_ps2C_t256x256x128_mw2_nw2_nb4_sk1_cm2_cn2C_t256x256x128_mw2_nw2_nb4_sk1_cm4_cn4C_t256x256x128_mw2_nw2_nb4_sk1_cm2_cn2C_t256x256x128_mw2_nw2_nb4_sk1_cm4_cn4C_t256x256x128_mw2_nw2_nb4_sk1_cm2_cn2C_t256x256x128_mw2_nw2_nb4_sk1_cm2_cn4C_t256x256x128_mw2_nw2_nb4_sk1_cm2_cn2C_t256x256x128_mw2_nw2_nb4_sk1_cm2_cn4C_t256x256x128_mw2_nw2_nb4_sk1_cm2_cn2C_t256x256x128_mw2_nw2_nb4_sk1_cm4_cn4C_t256x256x128_mw2_nw2_nb4_sk1_cm2_cn2C_t256x256x128_mw2_nw2_nb4_sk1_cm4_cn4C_t256x256x128_mw2_nw2_nb4_sk1_cm4_cn2_ps2C_t256x256x128_mw2_nw2_nb2_sk1_cm2_cn4C_t256x256x128_mw2_nw2_nb2_sk2_cm4_cn4C_t256x256x128_mw2_nw2_nb4_sk2_cm2_cn4_fskC_t256x256x128_mw2_nw2_nb4_sk1_cm4_cn2C_t256x256x128_mw2_nw2_nb2_sk1_cm4_cn4Performance
Setup
rocm/fw-bringup:gfx1250-atom-k3-20261120, with its aiter switched to this branch. FlyDSL 0.5.0.Prefill proxy
#578 measured the dense FFN on P's stage 0 at about 140 TFLOP/s in the model. This table does not explain that: with today's rows, those two GEMMs run at 5.0–5.8 PF/s on their own at M 12K–16K. The gap more likely comes from sharing CUs with the PP send/recv kernels.
Testing
kernel_fits_shape);Note on the reference: hipBLASLt's FP32 GEMM faulted on two shapes, M=20000 × N=49408 and, in one process, M=2048 × N=49408. So the reference is computed in 1024-row blocks.
🤖 Generated with Claude Code