Skip to content

perf(flydsl): Kimi-K3 B1 route-sort + prepared-MoE handoff (stack) - #7

Closed
JohnQinAMD wants to merge 9 commits into
mainfrom
perf/kimi-k3-moe-route-expert-handoff
Closed

JohnQinAMD wants to merge 9 commits into
mainfrom
perf/kimi-k3-moe-route-expert-handoff

Conversation

@JohnQinAMD

Copy link
Copy Markdown
Owner

Summary

Banked change #5 — the route-sort + AttnRes integration (the campaign's largest
single jump, +20.3% to 60.909 tok/s). This branch is a 9-commit stack, not a
single independent change:

ac4ba2dfe3 perf(mla): expose split override for graph decode
2790dbfe9a [Kimi-K3] Fuse gfx950 B1 routing and MoE sort metadata   <- route-sort (essence of #5)
d1a3ef562d perf(moe): specialize Kimi-K3 B1 gate projection          (re-created; see PR gate)
c257ea6509 perf(moe): add Kimi-K3 B1 stage1 direct tile
8687dca545 perf(moe): use atomic Kimi-K3 B1 stage2 reduction
15d1d1744f perf(flydsl): fuse Kimi-K3 KDA decode                      (re-created; see PR KDA-FB)
95dfd13ee8 perf(flydsl): fuse Kimi-K3 f_b projection into KDA decode  (re-created; see PR KDA-FB)
d4fb7ab2b4 perf(flydsl): fuse Kimi-K3 B1 latent MoE tail              (re-created; see PR tail)
459601b680 perf(flydsl): consume Kimi-K3 prepared MoE routing         <- route->expert handoff (essence of #5)

The route-sort kernel (2790dbfe9a) does FP32-logit conversion + correction bias

  • grouped top-k + both sort phases, feeding prepared AITER metadata into GEMM1;
    459601b680 consumes that metadata directly in fused_moe_2stages with no second
    grouped-top-k/sort. Route boundary 1.62x; replaced ~330 fragmented launches. The
    paired AttnRes+RMSNorm (RES-1) change lives on the vLLM side.

Overlap / supersession (read before merge)

  • Commits d1a3ef562d, 15d1d1744f, 95dfd13ee8, d4fb7ab2b4 are re-created
    copies
    of the gate / KDA-decode / KDA-FB / tail changes that also ship as
    their own independent PRs. Do not merge both without de-duplication.
  • Persistent-MoE (aiter#2) supersedes the route + gate ownership here — it
    removes the duplicate route ownership this stack introduces. A single integrated
    1->7 chain must resolve this supersession (route-sort is retained; the separate
    gate/stage tiles are absorbed by the persistent boundary) and be re-verified at
    the endpoint. See perf_changelog.md "Stacked-integration blocker".

Provenance

Banked endpoint 60.909 tok/s via composed overlay image
(route-attnres:candidate1). Independent-off-main PR for review; not the final
integration branch.

AI assistance (OpenAI Codex) was used; a human submitter must review every line
before merge.

Made with Cursor

Graph-captured callers may not have a useful runtime sequence length for
automatic split-KV scheduling. Add a validated num_kv_splits override while
preserving the existing automatic default and positional API compatibility.

Cover policy validation and the Kimi-K3 TP8 bh16/BF16 shape across
short-sequence split boundaries and 8K context.

Assisted-by: OpenAI Codex

Signed-off-by: Yanyuan Qin <yanyuan.qin@amd.com>
Add a narrow FlyDSL specialization for the 896-expert, top-16, single-group decode shape. Preserve AITER tie ordering and emit Opus-compatible metadata directly from the routing launch.

Assisted-by: Codex
Signed-off-by: Yanyuan Qin <yanyuan.qin@amd.com>
Add a narrow gfx950 FlyDSL projection for the production 1x7168 by 896x7168 BF16 router shape. Preserve the GateLinear BF16 output contract, isolate dispatch behind a named capability predicate, and leave unsupported shapes on their existing paths.

Assisted-by: Codex
Signed-off-by: Yanyuan Qin <yanyuan.qin@amd.com>
Register one validated BF16 x MXFP4 16-row FlyDSL variant and advance it with the producer 32-row sort-bucket stride. Select it only through the existing exact gfx950 Kimi-K3 B1 tuning row.

The complete expert boundary improves from 20.70 us to 18.20 us across two independent processes, with 90/90 adversarial correctness cases passing.

Signed-off-by: Yanyuan Qin <yanyuan.qin@amd.com>
Select the existing direct atomic weighted-reduction kernel through the exact gfx950 Kimi-K3 B1 tuning row. Larger batch rows and generic dispatch remain unchanged.

The complete expert boundary improves from 20.70 us to 18.62 us across two independent processes, with 90/90 adversarial correctness cases passing.

Signed-off-by: Yanyuan Qin <yanyuan.qin@amd.com>
Signed-off-by: Yanyuan Qin <yanyuan.qin@amd.com>
Add a typed, fail-closed gfx950 B1 handoff that owns Kimi-K3 routing and feeds its prepared metadata directly into the existing MXFP4 expert stages. Support both production A8W4/interleaved and A16W4/separated layouts while preserving fallback outside the exact shape contract.

The live A8W4 route-to-expert boundary improves from 41.83-42.01 us to 25.40-25.41 us (1.647-1.653x), with exact route IDs, 6.66e-8 routing-weight RRMSE, zero output RRMSE, and no duplicate route/sort launch.

Assisted-by: Codex

Signed-off-by: Yanyuan Qin <yanyuan.qin@amd.com>
@github-actions

Copy link
Copy Markdown

🏷️ 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 7 --add-label <label>

@JohnQinAMD

Copy link
Copy Markdown
Owner Author

Superseded by the reviewed, minimal PR decomposition: MLA split scheduling is now #20; prepared route/expert ownership and B1 stage policy are replaced by the single-owner persistent A8W4 boundary in #2; gate projection is #6; KDA decode + f_b is #16; and latent MoE tail is #17 (with FP8 follow-up #18). The corresponding vLLM ownership boundary is #10. Closing this conflicting 9-commit integration stack avoids duplicate kernel ownership and duplicate commits; its 60.909 tok/s endpoint result remains valid provenance for the composed features.

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.

1 participant