Repository navigation
[Perf][Spec Decode] DSpark: run the Markov walk in one kernel with int8 W2 on chip (Hopper) - #62958
Open
ischencheng wants to merge 4 commits into
Open
ischencheng wants to merge 4 commits into
ischencheng wants to merge 4 commits into
Conversation
…t8 W2 on chip (Hopper)
Add dspark_markov_quantization="int8". On sm_90 the whole DSpark Markov walk
runs in one cooperative launch: W2 is quantized to int8 with one fp32 scale
per row, most of it stays in shared memory across all SMs and the rest
streams from L2, and the per-step argmax across CTAs goes through one atomic
{key, count} pair. Sampling runs in the kernel and writes the bf16 logits it
drew from into draft_logits for rejection sampling. Off by default.
The kernel is adapted from MIT-licensed int8 Markov walk kernels; the notice
is kept in csrc/dspark_markov_walk.cu.
Signed-off-by: Chen Cheng <85005591+ischencheng@users.noreply.github.com>
Contributor
|
This pull request has merge conflicts that must be resolved before it can be |
ischencheng
marked this pull request as ready for review
October 22, 2026 21:29
ischencheng
requested review from
AndreasKaratzas,
Harry-Chen,
LucasWilkinson,
ProExpertProg,
TheEpicDolphin,
WoosukKwon,
houseroad,
khluu,
mgoin,
njhill,
robertgshaw2-redhat,
tlrmchlsmth,
yewentao256,
youkaichao and
zyongye
as code owners
October 22, 2026 21:29
6 tasks done
6 tasks done
6 tasks done
6 tasks done
Follow the speculator config classes (vllm-project#63205): dspark_markov_quantization is a DSpark supported option, validated in DSparkSpeculatorConfig.apply_options and part of its hash factors. Follow the batch-sharded draft logits and sequential block (vllm-project#63554, vllm-project#64356, vllm-project#63886): the walk writes DraftLogitsCache.values at full size, so it keeps the cache replicated and the sequential sampling on every rank. Loading now also fails for a draft model with its own sample_sequential or an output logit transform, and for a non-bf16 draft logits cache. The benchmark's eager arm uses greedy_argmax, as _sample_logits does since vllm-project#57770. Signed-off-by: Chen Cheng <85005591+ischencheng@users.noreply.github.com>
…ire on the count
A 16-B relaxed load is not one atomic snapshot of {key, count}, so a CTA could
see the full count with a stale key. Poll the count with acquire, then load the
key. Also reject FP8 Markov heads: their stored values are not the weights, and
the int8 layouts do not apply their separate scales.
Signed-off-by: Chen Cheng <85005591+ischencheng@users.noreply.github.com>
…te per launch cudaFuncSetAttribute applies to the current device, so a process-wide flag left a second GPU without the shared memory opt-in. Signed-off-by: Chen Cheng <85005591+ischencheng@users.noreply.github.com>
This branch has not been deployed
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
DSpark walks its draft block left to right: each step adds
W2 @ W1[prev]to the base logits (W2 is V x 256) and then takes the argmax or a sample. Today every draft token is a full-vocab GEMV, an add and a sampler, and W2 (78 MB in bf16 at V = 151936) is read from HBM again on every step.This adds
dspark_markov_quantization="int8"to the speculative config. With it, sm_90 runs the whole walk in one cooperative kernel. W2 is quantized to int8 with one fp32 scale per row, most of it stays in shared memory across all SMs and the rest streams from L2, and the per-step argmax across CTAs goes through one atomic {key, count} pair. Off by default.The kernel is adapted from the MIT-licensed int8 Markov walk kernels in https://github.com/tie-pilot-qxw/dspark-markov-walk (notice kept in
csrc/dspark_markov_walk.cu).Claims
Validation
All on 1x H100 at 5af18a7. The one later commit only changes how the launch sets its shared memory attribute, and the kernel tests pass on it too.
Kernel (
python benchmarks/kernels/benchmark_dspark_markov_walk.py, CUPTI, CUDA graph, cold L2, median us per call for all draft steps). The eager arm is_sample_sequential's loop, withgreedy_argmaxandgumbel_sample:e2e, Qwen3-4B, GSM8K prompts (80 at c1, 320 at c16, max 512 tokens), eager and int8 arms interleaved, 2 runs each in a fresh process (runs of an arm within 0.7%), mean output tok/s:
Tests:
pytest tests/kernels/test_dspark_markov_walk.py: 66 passed.pytest "tests/v1/e2e/spec_decode/acceptance_rates/dspark/test_dspark.py::test_dspark_correctness_and_acceptance_rate[qwen3-deepspec-int8-walk]"withVLLM_GPU_SYNC_CHECK=error: passed (GSM8K 0.791, acceptance length 4.009; the stockqwen3-deepspeccase in the same run: 0.778, 4.011).Details
draft_logits, so rejection sampling uses exactly that distribution.sample_sequential,dspark_draft_topk, or a quantized W2.qwen3-deepspec-int8-walkcase skips on GPUs with too few SMs to hold W2 (e.g. a MIG slice), so I ran it on a full H100 (above).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.