[Spec][DSV4] perf: Compile draft-extend hc_head during CUDA graph capture - #32497
Open
mattteochen wants to merge 37 commits into
Open
mattteochen wants to merge 37 commits into
mattteochen wants to merge 37 commits into
Conversation
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
mattteochen
marked this pull request as ready for review
July 27, 2026 08:06
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
41 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.
Motivation
The DSV4 MTP draft-extend CUDA graph currently captures
hc_headas a sequence of small ATen elementwise and reduction kernels between the cuBLASLt split-K reduction and the shared-head RMSNorm. These kernels are replayed on every draft-extend step, so their launch overhead is significant for the low token counts used by speculative decoding.This PR takes the selective capture-time
torch.compileidea from #32220 and applies it to the current DSV4 MTP NextN draft-extend path. It allows Inductor to fuse thehc_headpointwise and reduction chain before the generated kernels are recorded in the CUDA graph, without enabling whole-model torch compilation.Modifications
DeepseekV4ModelNextN.hc_headwith the sharedhc_head_torchimplementation.compile_in_capture_modefor non-empty CUDA inputs sohc_head_torchis compiled during CUDA-graph warmup and the generated kernels are captured for replay.Accuracy Tests
Speed Tests and Profiling
main:

PR:

Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): ❌ Run #30799325097
Latest PR Test (Extra): ❌ Run #30799324933