Skip to content

[Config] [gemm][gfx950] Tune Kimi-K3 A4W4 and FP8 projections - #4873

Merged
valarLip merged 4 commits into
mainfrom
tune/kimi-k3-a4w4-gemm-configs
Aug 21, 2026
Merged

valarLip merged 4 commits into
mainfrom
tune/kimi-k3-a4w4-gemm-configs

Conversation

@XiaobingSuper

@XiaobingSuper XiaobingSuper commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • add gfx950 A4W4 blockscale manifests for Kimi-K3's TP8 latent-MoE routed projections across M=1–32768
  • add gfx950 PTPC-FP8 bpreshuffle configs for the full-attention fused_qkv_a_proj
  • cover its physical (M, N, K) = (M, 2176, 7168) shape: logical N=2112 is padded to 2176 before the GEMM
  • supersede the standalone GEMM-config portion of [fmoe][gemm][gfx950] Tune Kimi-K3 A4W4 configs #4603

Results

  • A4W4 M=1 routed down projection: 16.85 -> 12.40 us (-26.4% latency)
  • A4W4 M=1 routed up projection: 11.32 -> 8.69 us (-23.2% latency)
  • FP8 M=1 fused QKV projection: 15.74 -> 11.52 us (-26.8% latency)
  • FP8 shapes M=1–32768: 26.6% geometric-mean speedup; 15/16 improve by at least 3%, with M=64 within ~1% measurement noise

Tuning setup

  • MI355X / gfx950, 256 CUs
  • physical GPUs 4–7
  • --mp 4 --shape_grouped: every shape's complete candidate set stays on one GPU
  • fresh vllm-latest image with torch 2.10 / ROCm 7.2.4

Test plan

  • tune Kimi-K3 A4W4 blockscale projections on GPU 0
  • tune FP8 (M,2176,7168) on physical GPUs 4–7 with all CK, CKTile, and FlyDSL candidates
  • validate exact untuned/tuned shape coverage, unique CSV keys, and errRatio=0
  • run production gemm_a4w4 and gemm_a8w8_bpreshuffle correctness benchmarks
  • compare untuned fallback against tuned production dispatch

Add complete TP8 routed-projection shape coverage so Kimi-K3 uses explicit, reproducible configs instead of fallback dispatch.

Co-authored-by: Cursor <[email protected]>
@XiaobingSuper
XiaobingSuper requested review from a team and a lite review from Copilot August 20, 2026 06:13
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter op tests (gfx942 + gfx950)
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs; main branch always runs both MI35X and MI300X
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: GPT-OSS-120B, DeepSeek-R1-0528, Kimi-K2.5
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 4873 --add-label <label>

PR title tags:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf] and op tags like [MLA] are left untouched. Add the no-auto-title label to opt this PR out of title tagging.

@github-actions github-actions Bot changed the title [gemm][gfx950] Tune Kimi-K3 A4W4 projections [Config] [gemm][gfx950] Tune Kimi-K3 A4W4 projections Aug 20, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]>
Copilot AI review requested due to automatic review settings August 20, 2026 08:31
@XiaobingSuper XiaobingSuper changed the title [Config] [gemm][gfx950] Tune Kimi-K3 A4W4 projections [Config][gemm][gfx950] Tune Kimi-K3 A4W4 and FP8 projections Aug 20, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

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]>
Copilot AI review requested due to automatic review settings August 20, 2026 08:38
@github-actions github-actions Bot changed the title [Config][gemm][gfx950] Tune Kimi-K3 A4W4 and FP8 projections [Config] [gemm][gfx950] Tune Kimi-K3 A4W4 and FP8 projections Aug 20, 2026
@XiaobingSuper
XiaobingSuper requested a review from valarLip August 20, 2026 08:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copilot AI review requested due to automatic review settings August 20, 2026 08:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@valarLip
valarLip merged commit 3cddd95 into main Aug 21, 2026
55 checks passed
@valarLip
valarLip deleted the tune/kimi-k3-a4w4-gemm-configs branch August 21, 2026 01:55
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.

3 participants