Repository navigation
[Perf] [NVIDIA] kda: Narrower V tiles for the KDA spec-verify recurrence on SM107 - #46465
Merged
kpham-sgl merged 1 commit intoOct 25, 2026
Merged
Conversation
The KDA recurrence in every Kimi-K3 KDA layer launches grid (V/32, 1, heads) with one warp per CTA: 48 single-warp CTAs at TP8, each walking the draft tokens serially over a 128x32 state slice. On SM107 (212 SMs) BV=4 gives 384 CTAs with identical output; isolated launch 13.66 -> 6.99 us, and the KDA delta-rule time on the verify critical path drops ~283 us per step. Ported from zcnrex/sglang-vera-rubin#45 onto the launch-config selector. Co-Authored-By: Claude Fable 5.1 <[email protected]>
kpham-sgl
requested review from
hebiao064,
yizhang2077 and
yuan-luo
as code owners
October 25, 2026 20:25
kpham-sgl
force-pushed
the
kpham/kda-verify-tile-sm107
branch
from
October 25, 2026 20:34
ad1e4f2 to
db93fe3
Compare
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.
Motivation
fused_sigmoid_gating_delta_rule_update_kernelis the KDA recurrence in every Kimi-K3 KDA layer and sits on the spec-verify critical path. Its launch isgrid = (V / 32, 1, heads)with one warp per CTA: at TP8 (12 heads per rank) that is 48 single-warp CTAs, each walking the draft tokens serially over a 128x32 state slice, on a 212-SM part. Most of the GPU is idle.Modifications
fused_sigmoid_gating_recurrent.py: in_select_recurrent_launch_config, the KDA verify call on SM107 picks BV=4 with one warp (384 CTAs at TP8). Every other case keeps its current launch: other architectures, KDA decode, GDN.Accuracy Tests
Each V column of the state updates independently, so a narrower tile computes the same recurrence. Output matches the BV=32 launch exactly; the ReplaySSM ring and state match within bf16 rounding (max abs diff 1.2e-4). KDA tests on SM107 with the new tile active:
test_kda_replayssm_ring_fused.py,test_fused_kda_conv_recurrent_verify.py,test_kda_kernels.py. On SM107 with this branch: the two kernel tests give 44 passed, 2 skipped;test_kda_kernels.pygives the same result as unmodified main in the same image (8 errors inTestKDAGateChunkCumsumfrom the image's Triton rejecting block pointers, unrelated to this change).Speed Tests and Profiling
Isolated launch sweep on SM107, B=1, T=8, 12 heads, K=V=128, BF16, ReplaySSM ring, CUDA graph, us per call:
Full model, Kimi-K3 NVFP4 TP8/DCP8, 128k in at 95% prefix hit, 1k out, bs=1, DSpark block 7 + ReplaySSM, rank-0 verify graph, median over 14 replays: KDA
delta_rule_updateexposed time per verify step 1072.5 -> 789.3 us (-283 us); verify step exposed time excluding the graph-entry all-reduce 9504.8 -> 9217.7 us (-3.0%).Checklist
🤖 Generated with Claude Code
CI States
Latest PR Test (Base): ❌ Run #40231449142
Latest PR Test (Extra): ❌ Run #40231449079
Latest PR Test (AMD ROCm 10): ❌ Run #40231449071