Repository navigation
[Config] [gfx1250] Kimi-K3 TP1 decode: BF16 MoE router and latent GEMM rows for every M bucket up to 1024 - #8634
zejunchen-zejun wants to merge 1 commit into
Conversation
…M rows for every M bucket up to 1024 Rows for the router (896x7168), latent down (3584x7168) and latent up (7168x3584) GEMMs of Kimi-K3's latent MoE on gfx1250 / 256 CUs: one row for every decode M bucket up to 1024 (16-aligned to 256, 32-aligned to 1024), so no decode M falls through to a power-of-two row. Each bucket was picked inside a decode-step proxy (92 layers x the three GEMMs, per-layer weights, CUDA graph) at every multiple of 5 in the bucket, since DP8EP8 decode with DSpark k=4 gives M = 5 x requests per rank. Step proxy, every multiple of 5 from M 100 to 960: -4.6% on average, worst +0.6%; c256 -11.4%, c512 -7.0%, c1024 -9.2%. The latent rows at M 1/2/4/8 and 2048-32768 are #8348's, with the _i0_ptdm / _i1_ptdm names written as _ptdm / _ptdmi. The TDM rows need #8031's kernel. Co-Authored-By: Claude Opus 5.5 <[email protected]>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
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]>
Summary
Fills
kimik3_bf16_tuned_gemm.csvon gfx1250 (256 CUs) for the three BF16 GEMMs of Kimi-K3's latent MoE. Every decode M bucket up to 1024 gets an explicit row. The three GEMMs are the router (896×7168), the latent down projection (3584×7168) and the latent up projection (7168×3584).main.tdm/tdmipolicy names.main's TDM kernel reduces split-K in BF16, so these rows are untested there._i0_ptdm/_i1_ptdmto_ptdm/_ptdmi. [FlyDSL] [gfx1250] TDM HGEMM: FP32 cluster split-K, and DSV4.1 BF16 rows where TDM measures faster #8031's parser reads only the new names.Motivation
--enable-dp-attention. With DSpark k=4 every request adds 5 tokens a step, so M per rank is a multiple of 5, about 5 × concurrency / 8: 120 to 960 for c192 to c1536.mainthe router had rows only at powers of two, and latent down and up had no gfx1250 rows at all ([Config] [gfx1250] Kimi-K3 latent-MoE BF16 GEMM rows for 256 CUs #8348 adds powers of two). With those rows, M = 315 runs the M = 512 rows.Changes
aiter/configs/model_configs/kimik3_bf16_tuned_gemm.csv: 1069 → 1200 rows.Of the 120 decode-bucket rows:
How a row was chosen
Sweep. The candidates were:
It was coarse to fine. One representative of each TDM tile family was timed first, then every member of the 30 best families. This ran at 16 anchor M from 16 to 1024 and then at every bucket on the union of their best candidates. The top 12 were re-timed interleaved and checked against the FP32 reference.
First pass. A row changed when it was at least 3% faster than today's launch in an ABBA A/B at the bucket top M.
Re-selection inside the decode step. The first pass measured at the bucket top, but decode M is a multiple of 5 and almost never the bucket top. Several top-M winners were 2–4% slower than a neighbour bucket's kernel at the M inside the bucket. One example: the router's M864 winner
t96x128x128is +2.3% on the step at M 835–860 againstt64x128x128. So every bucket up to 1024 was re-selected in the decode-step proxy (below) at every multiple of 5 in the bucket.Explicit rows. Every bucket up to 1024 gets its own row, so no decode M depends on a power-of-two fallthrough.
Performance
Setup
rocm/fw-bringup:gfx1250-atom-k3-20261120with [FlyDSL] [gfx1250] TDM HGEMM: FP32 cluster split-K, and DSV4.1 BF16 rows where TDM measures faster #8031's FlyDSL kernel at 79b6913 (its kernel, policy and name code are identical to [FlyDSL] [gfx1250] TDM HGEMM: FP32 cluster split-K, and DSV4.1 BF16 rows where TDM measures faster #8031's head f5ec86c). FlyDSL 0.5.0.Decode-step proxy
Per kernel at decode M: µs per call (cold weights), and the bandwidth and FLOP rate of the new kernel
opus splitk_clusterlaunch_tdmt32x64x256x6_ks4_w2x4x1_gm0_ptdmt64x64x128x5_ks4_w4x2x1_gm0_phtt32x64x128x4_ks7_w2x2x1_gm0_ptdmt64x64x128x5_ks4_w4x2x1_gm0_phtt32x64x256x3_ks4_w2x4x1_gm0_ptdmt64x64x128x4_ks4_w4x2x1_gm0_pftt64x64x128x3_ks7_w2x2x1_gm0_ptdmt64x64x128x4_ks4_w4x2x1_gm0_pftt64x64x128x4_ks4_w4x2x1_gm0_phtopus 4wave_wl_co_128x64x64x256t64x64x128x3_ks4_w2x4x1_gm0_ptdmopus 4wave_wl_co_128x64x64x256t64x128x128x3_ks4_w2x4x1_gm0_ptdmt64x64x128x4_ks4_w2x2x1_gm0_ptdmt64x64x128x3_ks4_w2x4x1_gm0_ptdmt64x128x128x3_ks4_w2x4x1_gm0_ptdmt64x64x128x3_ks4_w2x2x1_gm0_ptdmt64x128x128x3_ks4_w2x4x1_gm0_ptdmt128x128x128x3_ks2_w4x4x1_gm0_ptdmt128x128x128x3_ks2_w4x4x1_gm0_ptdmt64x128x128x3_ks2_w2x4x1_gm0_ptdmopus 4wave_co_128x128x128x128opus 4wave_co_128x128x128x128opus 4wave_wl_co_128x64x64x256t64x128x128x6_ks1_w2x2x1_gm0_pftt64x128x128x3_ks2_w2x4x1_gm0_ptdmt64x128x128x6_ks1_w2x2x1_gm0_pftt64x128x128x5_ks1_w2x2x1_gm0_pftopus 4wave_wl_co_128x128x128x128opus 4wave_wl_co_128x128x128x128opus 4wave_wl_co_128x128x256x128opus 4wave_wl_co_128x128x256x128The same kernel measures within about 2% of itself between the two columns. Bytes counted are A + W + C in BF16.
What limits these shapes
Caveat: the shared expert overlaps the main stream in the model
Testing
get_GEMM_A16W16_config.tgemm.mmat every M from 1 to 1024 for the three shapes (3072 calls) against an FP32 reference (errRatio ≤ 0.05), plus CUDA-graph replay bit-exact against eager: 0 failures.flydsl_hgemm_*name in the file (654) parses and rebuilds to itself with [FlyDSL] [gfx1250] TDM HGEMM: FP32 cluster split-K, and DSV4.1 BF16 rows where TDM measures faster #8031'sget_flydsl_hgemm_kernel_params/flydsl_hgemm_kernel_name, which is the check intest_a16w16_tuned_config_lookup.py.mainhas gfx1250 rows for these three shapes, so the runtime merge has nothing to collide with.🤖 Generated with Claude Code