Skip to content

[fmoe][gemm][gfx950] Tune Kimi-K3 A4W4 configs - #4603

Closed
XiaobingSuper wants to merge 7 commits into
mainfrom
tune/kimi-k3-a4w4-v1-v2
Closed

XiaobingSuper wants to merge 7 commits into
mainfrom
tune/kimi-k3-a4w4-v1-v2

Conversation

@XiaobingSuper

@XiaobingSuper XiaobingSuper commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • retune Kimi-K3 A4W4 SiTUv2 MoE shapes on gfx950 with v1/v2 candidates compared per shape on the same GPU
  • add complete TP8 A4W4 GEMM manifests for the latent-router down/up projections across M=1–32768
  • skip v2 stage-1 candidates whose per-wave contraction size is incompatible with tile_k

Results

  • same-GPU retuning selects v2 for M=1,2,3,256,512,1024,2048 and v1 stage2 for M=4,8,16,32,64,128
  • the previous M16 v2 combination regressed concurrency-16 output throughput to 203.15 tok/s; the retuned M16 combination restores 237.36 tok/s and improves ITL p50 from 49.00ms to 46.12ms
  • concurrency-24 throughput is neutral while ITL p50 improves by about 2.5%
  • decode FULL-graph memory estimate drops from 36.56–36.85 GiB to 0.59 GiB after avoiding the pathological v2 sorted-layout combinations
  • FP8 route-out improves large-shape stage2 by 11.4%–18.9% and total MoE time by 6.9%–12.2%
  • routed projection GEMM winners improve affected production shapes by 9.7%–45.5% (24.3% geometric mean)
  • all 17 MoE rows and all 32 routed GEMM rows pass operator correctness
  • Kimi-K3 GSM8K 5-shot (1319 samples): flexible-extract 0.9575, strict-match 0.9568

Test plan

  • ruff check csrc/ck_gemm_moe_2stages_codegen/gemm_moe_tune.py
  • same-GPU v1/v2 retune for M=1,2,3,4,8,16,32,64,128,256,512,1024,2048
  • AITER_SITUV2_A4W4=1 AITER_FLYDSL_STAGE2_FP8=1 python3 op_tests/test_moe_2stage.py --no-legacy --csv-filter flydsl_moe --kernel --beta 4 --linear-beta 25
  • python3 csrc/ck_gemm_a4w4_blockscale/gemm_a4w4_blockscale_tune.py --run_config <kimik3 tuned CSV>
  • vLLM TP8 aiperf E2E validation for concurrency 16 and 24
  • Full Kimi-K3 GSM8K 5-shot validation on TP8

Select the fastest correct implementation per shape and skip invalid K-wave combinations during v2 tuning.

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

github-actions Bot commented Aug 6, 2026

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: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 4603 --add-label <label>

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

Retunes the Kimi-K3 A4W4 SiTUv2 MoE 2-stage kernel configurations on gfx950, selecting faster/correct v1 vs v2 implementations by token count while pruning invalid v2 stage-1 candidates.

Changes:

  • Add a v2 stage-1 candidate filter to skip configs where model_dim is not divisible by tile_k * k_wave.
  • Update the tuned Kimi-K3 A4W4 MoE CSV entries with new per-token winners (v2 favored up to 2048 tokens, v1 for larger shapes).

Reviewed changes

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

File Description
csrc/ck_gemm_moe_2stages_codegen/gemm_moe_tune.py Adds a divisibility guard for v2 stage-1 kernel candidates to avoid incompatible tile_k/k_wave combinations.
aiter/configs/model_configs/kimik3_a4w4_tuned_fmoe.csv Replaces gfx950 tuned rows with updated kernel selections and performance/error metadata for Kimi-K3 A4W4 MoE shapes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Cover the TP8 latent-router down/up projection shapes so serving avoids untuned fallback kernels.

Co-authored-by: Cursor <[email protected]>
@XiaobingSuper XiaobingSuper changed the title [fmoe][gfx950] Tune Kimi-K3 A4W4 v1/v2 configs [fmoe][gemm][gfx950] Tune Kimi-K3 A4W4 configs Aug 6, 2026
coderfeli
coderfeli previously approved these changes Aug 6, 2026
XiaobingSuper and others added 2 commits August 6, 2026 23:04
The new GEMM1/v2-layout combination regresses concurrency-16 vLLM throughput, while restoring the prior M16 pair recovers performance.

Co-authored-by: Cursor <[email protected]>
Compare v1 and v2 candidates per shape on one GPU and avoid decode combinations that inflate full-graph memory or regress serving throughput.

Co-authored-by: Cursor <[email protected]>
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