Repository navigation
[Config] [gemm][gfx950] Tune Kimi-K3 A4W4 and FP8 projections - #4873
Conversation
Add complete TP8 routed-projection shape coverage so Kimi-K3 uses explicit, reproducible configs instead of fallback dispatch. Co-authored-by: Cursor <[email protected]>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
PR title tags: |
There was a problem hiding this comment.
Pull request overview
Adds MI350 (gfx950, 256-CU) A4W4 blockscale GEMM tuning manifests for Kimi-K3’s TP8 routed projection GEMMs so runtime get_GEMM_config() resolves tuned kernels (not the fallback), especially for the latency-critical M=1 shapes.
Changes:
- Add an untuned shape list covering 32 (M,N,K) combinations for Kimi-K3 routed projections across M=1–32768.
- Add a tuned config CSV for gfx950/256 selecting per-shape winners (including improved M=1 picks) with
errRatio=0.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| aiter/configs/model_configs/kimik3_a4w4_blockscale_untuned_gemm.csv | Defines the 32 target (M,N,K) shapes to tune for Kimi-K3 routed projections. |
| aiter/configs/model_configs/kimik3_a4w4_blockscale_tuned_gemm.csv | Provides the tuned per-shape winners keyed by (gfx, cu_num, M, N, K) for gfx950/256, enabling config lookup instead of fallback kernels. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Cover the padded 2176x7168 physical GEMM shape so the fused full-attention QKV projection avoids untuned CK fallback. Co-authored-by: Cursor <[email protected]>
Use the same-GPU retune winner after repeated A/B confirmed the fallback and top CK candidates are effectively tied. Co-authored-by: Cursor <[email protected]>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Suppressed comments (2)
aiter/configs/model_configs/kimik3_a4w4_blockscale_untuned_gemm.csv:7
- The Kimi-K3 MoE token configs include M=3 (see
aiter/configs/model_configs/kimik3_a4w4_untuned_fmoe.csv), but this untuned GEMM shape list skips M=3 for both (N,K) directions. That means the M=3 routed projection GEMMs cannot be tuned/selected from this manifest and will fall back to defaults.
2,3584,7168
2,7168,3584
4,3584,7168
4,7168,3584
aiter/configs/model_configs/kimik3_a4w4_blockscale_tuned_gemm.csv:6
- This tuned manifest also lacks entries for M=3 (for both (3,3584,7168) and (3,7168,3584)), even though Kimi-K3 MoE routing includes token=3. Without tuned rows, dispatch will fall back to the default kernel for M=3 and can regress performance relative to the stated M=1–32768 coverage.
gfx950,256,1,3584,7168,21,0,12.408,_ZN5aiter41f4gemm_bf16_per1x32Fp4_BpreShuffle_32x128E,4.14,1036.09,0.0
gfx950,256,2,3584,7168,21,0,12.3562,_ZN5aiter41f4gemm_bf16_per1x32Fp4_BpreShuffle_32x128E,8.32,1041.3,0.0
gfx950,256,4,3584,7168,21,0,12.4209,_ZN5aiter41f4gemm_bf16_per1x32Fp4_BpreShuffle_32x128E,16.55,1037.61,0.0
gfx950,256,8,3584,7168,29,0,12.9733,_ZN5aiter41f4gemm_bf16_per1x32Fp4_BpreShuffle_64x128E,31.68,996.75,0.0
gfx950,256,16,3584,7168,21,0,13.6169,_ZN5aiter41f4gemm_bf16_per1x32Fp4_BpreShuffle_32x128E,60.37,955.95,0.0
Summary
fused_qkv_a_proj(M, N, K) = (M, 2176, 7168)shape: logical N=2112 is padded to 2176 before the GEMMResults
Tuning setup
--mp 4 --shape_grouped: every shape's complete candidate set stays on one GPUvllm-latestimage with torch 2.10 / ROCm 7.2.4Test plan
(M,2176,7168)on physical GPUs 4–7 with all CK, CKTile, and FlyDSL candidateserrRatio=0gemm_a4w4andgemm_a8w8_bpreshufflecorrectness benchmarks