Skip to content

[Perf] [NVIDIA] kda: Narrower V tiles for the KDA spec-verify recurrence on SM107 - #46465

Merged
kpham-sgl merged 1 commit into
sgl-project:mainfrom
kpham-sgl:kpham/kda-verify-tile-sm107
Oct 25, 2026
Merged

kpham-sgl merged 1 commit into
sgl-project:mainfrom
kpham-sgl:kpham/kda-verify-tile-sm107

Conversation

@kpham-sgl

@kpham-sgl kpham-sgl commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

fused_sigmoid_gating_delta_rule_update_kernel is the KDA recurrence in every Kimi-K3 KDA layer and sits on the spec-verify critical path. Its launch is grid = (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.py gives the same result as unmodified main in the same image (8 errors in TestKDAGateChunkCumsum from 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:

launch us
BV=32, 1 warp (current) 13.66
BV=16, 1 warp 9.04
BV=8, 1 warp 7.73
BV=4, 1 warp 6.99

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_update exposed 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

  • Format your code according to pre-commit.
  • Add unit tests (existing KDA tests cover the kernel).
  • Update documentation.
  • Provide accuracy and speed benchmark results.

🤖 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

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]>
@sgl-project sgl-project deleted a comment from github-actions Bot Oct 25, 2026
@kpham-sgl
kpham-sgl force-pushed the kpham/kda-verify-tile-sm107 branch from ad1e4f2 to db93fe3 Compare October 25, 2026 20:34
@kpham-sgl
kpham-sgl merged commit 640e11e into sgl-project:main Oct 25, 2026
220 of 250 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant