perf(flydsl): fuse Kimi-K3 B1 latent MoE tail - #4496
Draft
JohnQinAMD wants to merge 6 commits into
Draft
JohnQinAMD wants to merge 6 commits into
JohnQinAMD wants to merge 6 commits into
Conversation
Fuse the fixed gfx950 batch-one latent-MoE reduction, shared-expert contribution, and normalization tail behind an exact fail-closed contract. Assisted-by: OpenAI Codex Signed-off-by: Yanyuan Qin <yanyuan.qin@amd.com>
Keep the latent-tail export list sorted and annotate the intentional FlyDSL stream default required by the launcher DSL. Assisted-by: OpenAI Codex Signed-off-by: Yanyuan Qin <yanyuan.qin@amd.com>
Contributor
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a narrow, gfx950-only FlyDSL implementation of the Kimi-K3 batch-1 latent-MoE “tail” (routed RMSNorm → up-projection GEMV → shared add), plus validation that it matches a reference and is safely gated behind a strict support predicate.
Changes:
- Introduces
latent_moe_tail()/supports_latent_moe_tail()Python API with strict shape/dtype/layout/device gating and optionalout=reuse. - Adds a fixed-shape gfx950 FlyDSL kernel module implementing RMSNorm + GEMV + add in one launch.
- Adds dedicated FlyDSL tests for numerical matching, gating behavior, contiguity rejection, and graph-capture output reuse.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| op_tests/flydsl_tests/test_latent_moe_tail.py | New targeted tests for correctness, support gating, and CUDAGraph/out reuse behavior. |
| aiter/ops/flydsl/latent_moe_tail.py | New Python wrapper and support predicate for the fused latent-MoE tail specialization. |
| aiter/ops/flydsl/kernels/latent_moe_tail_gfx950.py | New fixed-shape gfx950 FlyDSL kernel implementing RMSNorm + BF16 projection + add. |
| aiter/ops/flydsl/init.py | Exposes the new latent_moe_tail public symbols when FlyDSL is available. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Yanyuan Qin <yanyuan.qin@amd.com>
Signed-off-by: Yanyuan Qin <yanyuan.qin@amd.com>
Signed-off-by: Yanyuan Qin <yanyuan.qin@amd.com>
JohnQinAMD
force-pushed
the
perf/kimi-k3-latent-tail-clean
branch
from
August 2, 2026 02:08
8f91eb5 to
67f4e14
Compare
op_tests/op_benchmarks/flydsl/ does not exist on main, no CI job references it, and none of the 84 existing flydsl kernel modules ship a companion benchmark. The script is kept out of tree; measured numbers go in the PR description instead. Signed-off-by: Yanyuan Qin <yanyuan.qin@amd.com>
JohnQinAMD
marked this pull request as draft
August 2, 2026 20:24
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Add a fixed-shape gfx950 FlyDSL Kimi-K3 TP8 latent-MoE tail. One kernel
fuses RMSNorm of
[1,3584], the BF16[7168,3584]up-projection, BF16materialization, and the shared-expert add into
[1,7168]. Norm and dotproducts accumulate in FP32.
The wrapper owns the exact device, shape, dtype, and stride contract and fails
closed otherwise.
Test plan
graph replay with changed input, output reuse, input immutability,
unsupported contracts, and non-contiguous input.
411-MB weights to limit cache reuse.
Test results
MI355X/gfx950, TP8 batch-one decode, BF16 input/weight/output; 21 alternating
paired trials:
git diff --check, and DCO checks passed.Overlap and limits
vllm-project/vllm#50657 owns serving dispatch and model-level evidence; no
endpoint gain is attributed to this primitive alone. This optimization is
limited to the exact Kimi-K3 BF16 gfx950 boundary above.
Tool assistance
OpenAI Codex assisted with implementation, tests, benchmarking, and drafting
this description.