Repository navigation
[Perf][DSpark][DSv4.1] Fuse the Markov sampling loop on NVIDIA by inverse CDF - #64442
Merged
khluu merged 5 commits intoNov 3, 2026
Merged
Conversation
…erse CDF Run DSpark's sequential Markov sampling for DeepSeek-V4.1 on NVIDIA as the bias GEMM plus two Triton kernels per draft step, through the draft model's sample_sequential hook. Sampled draft tokens are drawn by inverse CDF of the cached draft logits; temperature-0 tokens are the loop's argmax. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Juntian Liu <Juntianl777@gmail.com>
|
+++ |
Open
2 of 6 tasks
Juntian777
marked this pull request as ready for review
October 29, 2026 22:41
Juntian777
requested review from
AndreasKaratzas,
DarkLight1337,
Harry-Chen,
khluu and
ywang96
as code owners
October 29, 2026 22:41
6 tasks done
Contributor
|
This pull request has merge conflicts that must be resolved before it can be |
6 tasks done
Open
6 tasks done
additional_config={"dspark_fused_markov": false} keeps the speculator's
loop instead of the fused kernels; they stay on by default. Inline a
single-use local and drop the redundant T=1 distribution test case. The
kernels are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Juntian Liu <Juntianl777@gmail.com>
…rk-dep-fused-markov Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Juntian Liu <Juntianl777@gmail.com>
ivanium
approved these changes
Nov 3, 2026
ivanium
enabled auto-merge (squash)
November 3, 2026 01:25
The speculator's loop is now the default. Set
additional_config={"dspark_fused_markov": true} to use the fused kernels.
The kernels are unchanged.
Signed-off-by: Juntian Liu <Juntianl777@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
auto-merge was automatically disabled
November 3, 2026 01:30
Head branch was pushed to by a user without write access
Contributor
Author
|
/ci run |
|
✅ Triggered Buildkite CI #99415 for commit |
TheEpicDolphin
enabled auto-merge (squash)
November 3, 2026 03:52
ZJY0516
approved these changes
Nov 3, 2026
khluu
approved these changes
Nov 3, 2026
2 of 6 tasks
yaoyaoding
added a commit
to yaoyaoding/vllm
that referenced
this pull request
Nov 3, 2026
Resolve two conflicts under vllm/models/deepseek_v41/nvidia/: - dspark.py: keep main's dspark_fused_markov opt-in (vllm-project#64442) beside the draft executor's registration, and main's compute_draft_logits_local. - moe/routed_expert_gemm.py: take current_cu_stream from main's shared moe_tail_fusion primitives (vllm-project#64974) and keep the finalize kernel. Signed-off-by: Yaoyao Ding <yaoyaod@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
yaoyaoding
added a commit
to yaoyaoding/vllm
that referenced
this pull request
Nov 3, 2026
With decode_backend=latency_specialized, the DSpark draft model now samples through the model hook that DSparkSpeculator._sample_sequential already asks first, so the speculator itself is unchanged: - The specialized decode implies dspark_fused_markov: the fused loop of ops/fused_markov.py (vllm-project#64442), under the same conditions. - Once the draft's executor is built, batches of up to 8 request rows (4 at 8 ranks) take the vocabulary-sharded Markov chain instead (ShardedMarkovSampling in specialized_decode/sampling/). Its set-up is agreed over the TP group, as before. The layers test checks the hook with the switch on and off. Signed-off-by: Yaoyao Ding <yaoyaod@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
26 of 35 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.
Overview
Runs DSpark's sequential Markov sampling for DeepSeek-V4.1 on NVIDIA as the existing bias GEMM plus two Triton kernels per draft step, through the draft model's
sample_sequentialhook (as the ROCm model does). Sampled draft tokens are drawn by inverse CDF of the cached draft logits instead of Gumbel-max. Production code changes only undervllm/models/deepseek_v41/nvidia/(+223). It is opt-in:--additional-config '{"dspark_fused_markov": true}'enables it, and the speculator's loop stays the default.Claims
Validation
Kernel time,
DSparkSpeculator._sample_sequential(main's loop) vs this PR, CUPTI under a CUDA graph, one GB200, V = 129280, rank 256, 5 draft steps, 3 runs each (spread under 1% except 1 request):Re-checked on main
51c6dfd8c8with this revision, same benchmark, one GPU, median of 3 alternating rounds (worst spread 9.0% at 1 request, 3.8% or less from 16 to 253 requests at T=1, 7.1% or less for mixed):DEP4 decode serving, DeepSeek-V4.1-Flash on one GB200 node, DSpark K=5 probabilistic drafting, synthetic acceptance length 3.51, FULL_DECODE_ONLY graphs, MegaAttn + MegaMoE,
--max-num-seqs 128. The client fills the KV with AgentX token streams, then runs 6 rounds of 4096 forced output tokens with exactly the given requests on every rank (no logits processing, as AgentX); step time is the median of the last 3 rounds, measured only over windows of pure decode:Accuracy (
vllm serve, DSpark K=5, probabilistic drafting, standard rejection sampling; GSM8K is lm_eval 5-shot, greedy, max 1024 tokens, concurrency 32; acceptance length from the server's spec-decode metrics over the GSM8K run):These evals and the DEP4 decode serving numbers ran on an earlier base (
66875d3127, 259 commits behind51c6dfd8c8) and were not rerun. Since then this PR's kernels have not changed and the only production additions are the opt-indspark_fused_markovcheck and one inlined local. All "This PR" numbers are the fused path, which now needs that flag. The speculator changed on main; I checked itssample_sequentialcontract by reading the code, and on the merged tree ran the test below and the kernel benchmark above.The DEP4 eval ran with
--jit-monitor-verbose: the new kernels compile only during warmup. The TEP4 eval ran withVLLM_GPU_SYNC_CHECK=error..venv/bin/python -m pytest tests/models/deepseek_v41/nvidia/test_fused_markov.py -v # 2 passed on main 51c6dfd8c8The test runs the speculator's loop and the fused path on the same inputs: temperature-0 tokens and every cached logit of temperature-0 requests (and step 0 of all requests) match bit for bit, and sampled tokens follow softmax(cached logits / temperature).
Details
draft_tokens. Here the bias GEMM (cuBLAS) is kept,_markov_sample_kerneladds the base logits as the loop does (fp32 sum rounded once to the cache dtype), writes the draft-logits cache and keeps each vocab block's max and exp-sum, and_markov_select_kernelpicks the token and writes itsmarkov_w1row into the next step's GEMM input.dspark_fused_markovis true and the loop would sample from a full draft-logits cache with plain fp32 Gumbel noise: probabilistic drafting, no adaptive verification, no fp64 Gumbel, no watermarking and no batch-sharded sampling (whose sharded cache keeps the loop). Draft top-k is handled by the speculator before the hook.decode_backend=latency_specializedon GB300 TP), [Perf][Spec Decode] DSpark: run the top-k Markov walk in one kernel #64033 (the top-k Markov walk), [Perf][Spec Decode] DSpark: run the Markov walk in one kernel with int8 W2 on chip (Hopper) #62958 (int8markov_w2on Hopper), [ROCm] Fused DSpark draft sampling: markov GEMV + sample epilogue #63181 / [ROCm][Perf][DSv4.1] Run DSpark's fused Markov sampling on gfx950 with --monokernel #63891 and the merged [ROCm][Perf][DSv4.1] Mono decode on MI300X and MI325X (gfx942) #60731 (ROCm).Pull Request Checklist
I used vLLM's
/pr-checklistskill. (Mandatory for agents, optional for humans).AI assistance was used during the creation of this PR.
Design Fit: Minimizes impact on core components, reuses existing functionality, and justifies added complexity.
Testing and Validation: Validates the change and ensures any added tests are meaningful and reliable, with CI coverage or documented CI resource constraints and validation performed outside CI.
Code Quality and Style: Keeps code and comments clear and concise, and updates relevant documentation and examples.
Pull Request Contents: Includes a brief summary and relevant links, supports claims with evidence, explains root causes and implementation trade-offs, and follows the contributing guide.