Repository navigation
perf(kda): rebalance MTP verify precompute and state synchronization - #42683
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
zcnrex
marked this pull request as ready for review
October 6, 2026 04:47
zcnrex
requested review from
BBuf,
DarkSharpness,
HaiShaw,
HydraQYH,
celve and
yuan-luo
as code owners
October 6, 2026 04:47
BBuf
reviewed
Oct 8, 2026
…onorm branch Co-Authored-By: Claude Opus 5.5 <[email protected]>
BBuf
approved these changes
Oct 9, 2026
BBuf
left a comment
Collaborator
There was a problem hiding this comment.
The earlier review points are addressed: output norm on/off and num_spec=0 streaming are covered in the existing test, and the dead prefetch branch is removed. The main update leaves these two PR files unchanged. LGTM; CI is running.
Collaborator
|
/rerun-test test/registered/kernels/ops/attention/test_kda_decode_mtp.py test/registered/unit/layers/test_kda_decode_mtp_slot_stride.py Targeted validation for c15c686. |
Contributor
|
🚀 🚀 |
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
The Kimi-K3 KDA MTP verify kernel (
fused_kda_decode_mtp_dspark) spends much of its time on precompute dependencies and state synchronization. Rebalancing that work cuts kernel latency by up to 1.37× on B300, and outputs stay bitwise identical.Modifications
All changes are in
python/sglang/kernels/ops/attention/kda_decode_mtp.py:Accuracy Tests
B300 (SM103), CUDA 13.0, PyTorch 2.13, CuTe DSL 4.6.2:
test/registered/kernels/ops/attention/test_kda_decode_mtp.pyandtest/registered/unit/layers/test_kda_decode_mtp_slot_stride.py: pass on both main and this PR.compute-sanitizer --tool racecheck: 0 hazards across 4 shapes covering ring/full-snapshot and norm on/off.Speed Tests and Profiling
B300, H=12, K=V=128, same process. Warm = per-call time from a CUDA graph of 50 back-to-back calls (median of 11 replays). Cold = in-graph
[512 MiB L2 flush, kernel] × 20minus a flush-only graph (median of 21).Speedup range (main → PR) across N = 1…64:
Per-shape timings (µs)
The full-snapshot, no-norm path is roughly neutral (worst case 0.98× at N ≤ 8 with num_spec = 3, within run-to-run noise). The production ReplaySSM path gains 1.06–1.37×. On Vera Rubin (SM107) the production case (N=1, num_spec=7) drops from 13.2 µs to 9.7 µs.
Checklist
🤖 Generated with Claude Code
CI States
Latest PR Test (Base): 🚫 Run #37892740875
Latest PR Test (Extra): ❌ Run #37892740714
Latest PR Test (AMD ROCm 10): ❌ Run #37892740907