[Perf] Fuse DSV4.1 input metadata preparation with Triton - #56562
Merged
WoosukKwon merged 2 commits intoSep 12, 2026
Merged
Conversation
Co-authored-by: OpenAI Codex <noreply@openai.com> Signed-off-by: Woosuk Kwon <woosuk@inferact.ai>
Co-authored-by: OpenAI Codex <noreply@openai.com> Signed-off-by: Woosuk Kwon <woosuk@inferact.ai>
WoosukKwon
marked this pull request as ready for review
September 12, 2026 04:26
WoosukKwon
requested review from
LucasWilkinson,
MatthewBonanni,
alexm-redhat,
njhill,
pavanimajety,
youkaichao and
zhuohan123
as code owners
September 12, 2026 04:26
Collaborator
Author
|
/ci run |
|
✅ Triggered Buildkite CI #88471 for commit |
maeehart
added a commit
to maeehart/vllm
that referenced
this pull request
Sep 12, 2026
Adaptive verification writes query_start_loc on device. DeepseekV41IndexerBackend inherits supports_device_cpu_query_lens_mismatch() from the V3.2 indexer, and that helper was CUDA plus DeepGEMM only, so the published DSpark JSON dies during determine_available_memory on ROCm. Reuse the Triton decode-metadata kernel from vllm-project#56562 on the ROCm flatten path when the flag is on. NVIDIA is unchanged.
4 tasks
Shreya-gaur
pushed a commit
to Shreya-gaur/vllm_private
that referenced
this pull request
Sep 14, 2026
ItsRoy69
pushed a commit
to ItsRoy69/vllm
that referenced
this pull request
Sep 15, 2026
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.
Purpose
DSV4.1 prepares token-to-request mappings and flattened indexer decode metadata with chains of PyTorch operations on every model step. Replace those operations with Triton kernels that write directly into the existing buffers:
The replaced paths call Triton directly. No new JIT warmup-framework wrappers or registrations are added. The existing non-varlen indexer implementation is unchanged.
Duplicate-work checks: searched open PRs for
DeepSeek V4 metadata,indexer metadata triton,token_to_req_indices, andmetadata DSpark. No existing PR addresses this replacement. Related work is distinct: #56344 fuses attention math, #56254 changes sparse MQA-logit computation, #52628 enables ROCm fused draft-step updates, and #55692 hardens the downstream top-k block-table gather. No associated issue was supplied.Test Plan
Tested against
9dcf6bf344caa7793bae0b45a7896d3f8e03a01aon four NVIDIA GB200 GPUs, withdeepseek-ai/DeepSeek-V4.1-Flash, TP=4, and FP8 KV cache.Test Result
rtol=atol=0).git diff --checkpassed.Metadata profile and microbenchmark
Measured with a local benchmark harness that is not included in this PR. CUPTI GPU timings of the five relevant builders (SWA, MLA ratios 1/2, indexer ratios 1/2), CUDA-graph replay with cold L2, batch size 16. These are metadata-only speedups.
Batch-16 decode GPU launches decrease from 77 to 17 per builder suite. Across three profiled iterations, CPU
aten::repeat_interleaveevents decrease from 54 to zero. A full-model baseline trace also confirmed these operations occur in the input-preparation path.Batch-size-1 TPOT, 512 input / 128 output tokens
One repeated prompt, greedy generation, full decode CUDA graphs, compilation mode 0, FlashInfer autotuning disabled. Median of four interleaved samples per implementation on the same loaded model; engine first/last-token timestamps exclude prefill. All eight generated sequences match within each mode. The optimized adaptive run includes a retained 2.142 ms outlier.
SPEED-Bench: 8K input / 1K output, DSpark adaptive enabled
NVIDIA SPEED-Bench
throughput_8k/low_entropy, 512 source rows, normalized to exactly 8,192 DSV4.1 chat-template tokens using padding/truncation, default thinking, greedy sampling, 1,024 forced output tokens. Two runs per implementation in baseline/optimized then optimized/baseline order;max(32, 2 × concurrency)requests per run, identical seed and request order. At concurrency 1024, the source dataset is repeated to produce 2,048 requests per run.Same loaded model, V2 runner, Rust frontend, Python
vllm bench serveclient, five speculative tokens, full decode graphs, compilation mode 0, FlashInfer autotuning and prefix caching disabled. Fixed server limits:max_num_seqs=256,max_num_batched_tokens=16384,max_model_len=16384, GPU memory utilization 0.9. GPU clocks were not locked. Metadata methods were switched outside model CUDA graphs; no profiling or validation wrappers during timing.Mean TTFT, including queueing
Mean TPOT, excluding TTFT
Output throughput
Latency means pool all requests across both repetitions; throughput is total output tokens / total measured duration. All 16 runs completed with exact requested token counts and zero preemptions. Concurrency-1024 TTFT includes substantial queueing behind the fixed 256 active-request limit. The concurrency-128 throughput difference is within observed run variation.
These TPOT values are not directly comparable to the earlier 512/128 test: context length, prompts, measurement boundary (streaming client vs engine), and aggregation differ. Long-prompt outputs also vary between baseline-only repetitions; universal generated-token parity is not claimed. Mean acceptance lengths before/after are 3.294/3.274, 3.177/3.153, 2.846/2.840, and 3.122/3.110 at the four concurrency levels.
GSM8K accuracy
Optimized implementation, full 1,319-question test set, repository five-shot prompts, default thinking/high effort, greedy sampling, seed 0, maximum 16,384 output tokens, context limit 32,768. Extract answers from final text after
</think>; unfinished reasoning is invalid.These are single-run speculative-mode evaluations of the optimized implementation, not before/after accuracy-equivalence measurements.
AI assistance: OpenAI Codex implemented the change and ran the reported checks and evaluations under the submitter's direction. This PR is a draft; human review of every changed line and human-run validation remain required before marking it ready.