Repository navigation
[Feat] dspark: Let the draft fold its verify commit and cap step logits - #51298
Merged
zcnrex merged 4 commits intoNov 19, 2026
Merged
Conversation
zcnrex
requested review from
BBuf,
DarkSharpness,
HaiShaw,
HydraQYH,
Qiaolin-Yu,
Ying1123,
celve,
hnyls2002,
merrymercy and
yuan-luo
as code owners
November 18, 2026 18:03
zcnrex
force-pushed
the
chunan/dspark-draft-commit-hooks
branch
2 times, most recently
from
November 18, 2026 19:14
dc8a89e to
73dfb0a
Compare
Adds a folds_static_verify_commit draft hook, subclass hooks on the DSpark v2 worker, a step-logit softcap and vocab limit in Markov sampling, and a chain (no accept_index) mode for fused_commit_track_indices. Split out of the Inkling-2-Small support PR (sgl-project#50186). Co-authored-by: Qiaolin Yu <[email protected]> Co-authored-by: ispobock <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
zcnrex
force-pushed
the
chunan/dspark-draft-commit-hooks
branch
from
November 18, 2026 19:46
73dfb0a to
3905cc7
Compare
… can fold The worker turned the static epilogue on whenever the draft set folds_static_verify_commit, but the epilogue folds only when the draft's FULL slots are the target's, unremapped. A non-V4.1 target with a draft that could not fold still ran the V4.1 static epilogue. Both now use one draft_folds_static_commit check, which also returns False instead of raising when a runner has no FULL space. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This comment has been minimized.
This comment has been minimized.
Qiaolin-Yu
approved these changes
Nov 18, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
weireweire
added a commit
to weireweire/sglang
that referenced
this pull request
Nov 19, 2026
…tail-glue One conflict hunk, in dspark_verify.py DsparkVerifyEpilogue.run_static. Main (sgl-project#51298) renamed the static epilogue's fold predicate to folds_static_commit (folds_commit, or a draft that stores the verify commit itself) and added a store_verify_commit call on the folded path, before the draft KV staging. This branch added the fused greedy accept tail branch that runs the relay scatter, engram commit and KV staging in the accept launch and returns early. Resolution: run_static takes main's folds_static_commit and keeps the fused tail branch. _commit_tail_plan now returns None when the draft stores the verify commit itself, so that configuration keeps main's separate path (store_verify_commit ordered before the staging); the fused accept still runs there, only the commits stay separate. No draft model in the tree opts into that mode today, so served behaviour for the existing drafts is the branch's. Auto-merged files touched by both sides: dspark_worker_v2.py (main's draft_folds_static_commit wiring next to this branch's in-place verify ids slot; disjoint hunks).
2 tasks done
4 of 7 tasks
YAMY1234
added a commit
to sgl-project/sgl-nvidia-mega
that referenced
this pull request
Nov 29, 2026
…PI v3 and contract (#103) * [Fix] minimax_m31: Speak megakernel API version 3 and follow SGLang main's contract #66 merged after #81 moved the unit tests to SGLang main, but its last unit run was against the old pinned SGLang, where the MiniMax-M3.1 checks are skipped. On SGLang main the spec is refused at registration and four contract checks fail, so main's unit job has been red since #66. - Megakernel API 3 (sgl-project/sglang#52054 replaced the verify penalty tables with step_penalties): declare 3, as #81 did for the other specs. The package reads no verify sampling penalties (its slots are the verify forward and the DSpark draft proposal), so nothing else changes. - sgl-project/sglang#52870 moved minimax_sparse_nvfp4_backend.py to minimax_sparse/msa_v1_backend.py; msa_v1_decode_plan is the same field. Name the new file first and keep the old one as the alternative. - fused_experts_none_to_flashinfer_trtllm_fp4: sgl-project/sglang#50195 passes the ignored output buffer on the logits-routed path too; the routed-top-k path moe_nofill follows already passed it. Re-pin. - _draft_step and _markov_sample_partial_kernel: sgl-project/sglang#51298 adds a step softcap and vocab limit that only Inkling2's MTP head sets, and #52728 a folded-bias kernel path _draft_step never takes. The chain serves only VanillaMarkov, which leaves both None. Re-pin. Co-Authored-By: Claude Opus 5.5 <[email protected]> * [Fix] qwen3_5: Follow SGLang main's GDNAttnBackend.forward_extend sgl-project/sglang#39595 (FlyDSL GDN prefill on AMD) passes prefill_metadata=self.kernel_prefill_metadata to the extend kernel in the prefill arm of forward_extend, None for every kernel but FlyDSL, and adds kernel_prefill_metadata = None to GDNAttnBackend. - gdn/prefill.py serves only the Triton prefill kernel (view.kernel_id), and gdn/verify.py mirrors the target-verify arm, which the change does not touch. Re-pin both mirrors. - The runtime tests' fake GDN backend gains kernel_prefill_metadata=None, as SGLang's class now defines it. Co-Authored-By: Claude Opus 5.5 <[email protected]> * [Fix] kimi_k31: Follow SGLang main's verify sampling stages in the DFlash runtime sgl-project/sglang#52406 deleted sampling_batch_info.adjusts_logits and speculative/target_verify.py (adjust_verify_logits). SGLang's DFlash round now reads VerifyRoute.adjusts_logits and calls VerifyStep.adjust from SamplingPipeline.plan_verify. The K3.1 DFlash runtime imported both old names, so it no longer imported on SGLang main. - _unserved: VerifyRoute.derive(...).adjusts_logits is the same predicate as adjusts_logits (grammar, watermark, penalties, logit bias or a custom logit processor), so the same rounds go back to SGLang. - _accept, greedy round on gathered logits: the target's sampling_pipeline.plan_verify(batch, watermark_full_mask=False).adjust() runs the same stages in the same order as adjust_verify_logits did: penalties along the chain, logit bias and the custom logit processor, each width rows per request, with no grammar mask. DFlash refuses the watermark, so none is bound. As before, _unserved already refuses every round these stages would change. - The test fakes gain the target's sampling_pipeline and need_min_p_sampling, which SGLang's SamplingBatchInfo defines. Co-Authored-By: Claude Opus 5.5 <[email protected]> * [Fix] qwen3_5: Re-pin GDNAttnBackend.forward_extend after sgl-project/sglang#44195 sgl-project/sglang#44195 gives the Triton GDN kernel an FP32 track snapshot and gates the snapshot in forward_extend's prefill arm on use_track_state_snapshot(): a snapshot-capable kernel in batch-invariant mode. - gdn/prefill.py: only --enable-deterministic-inference turns on batch-invariant mode, and it refuses the trtllm_mha attention backend this spec requires. The served prefill arm still writes checkpoints from the per-chunk states, as the slot does. Re-pin. - gdn/verify.py mirrors the target-verify arm, which the change does not touch. Re-pin. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
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
Split out of #50186 (Inkling-2-Small support). The Inkling2 MTP draft runs on DSpark. It needs a few hooks in the DSpark worker and verify path that do not depend on the model.
Modifications
DsparkVerifyEpilogue: when the draft model setsfolds_static_verify_commitand shares the target's FULL id space (no write translation), the static verify graph callsdraft_model.store_verify_commit(...).folds_static_commitis now resolved once and cached.DSparkWorkerV2:_build_verify_executorand_on_prefill_target_hidden;fused_commit_track_indiceswithoutaccept_index(a chain), with an eager fallback off CUDA.fused_commit_track_indices:accept_indexis optional (HAS_ACCEPT_INDEX).fused_conv_window_scatter_multi: aCONTIGUOUSfast path for contiguous source windows.BaseDSparkMarkovHead.step_softcap/step_vocab_limitapply a tanh softcap to the step logits and mask ids fromvocab_limiton. Both default to off.Tests
test_verify_commit_triton.py: newtest_chain_commit_steps_matches_eager(CUDA), which checks the chain mode against the eager reference.Accuracy Tests
These changes are moved unchanged from #50186, where they were validated together with the Inkling-2-Small model (see that PR and the cookbook page). The code is unchanged. I have not run it separately on this branch. CI runs the unit tests listed above.
Speed Tests and Profiling
None separately; see #50186.
Co-authored with @ispobock.
🤖 Generated with Claude Code
CI States
Latest PR Test (Base): ✅ Run #44406803958
Latest PR Test (Extra): ⊘ Skipped -- add the
run-ci-nv-extralabel to opt in.Latest PR Test (AMD ROCm 10): ⏳ Run #44406803778
Tip
Base CI only covers the core cases, and its workload may not exercise your change. Use
/rerun-testto run the tests your change touches, or copy this prompt for an agent: