[Model] Add PW CUDA graph support for Inkling [2/N] - #48822
Merged
Conversation
WoosukKwon
marked this pull request as ready for review
July 16, 2026 07:26
WoosukKwon
requested review from
AndreasKaratzas,
DarkLight1337,
ProExpertProg,
houseroad,
mgoin,
njhill,
robertgshaw2-redhat,
tlrmchlsmth,
yewentao256,
youkaichao and
ywang96
as code owners
July 16, 2026 07:26
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
WoosukKwon
force-pushed
the
agent/inkling-breakable-cudagraph
branch
from
July 16, 2026 15:46
7dd4824 to
baf523c
Compare
Enable breakable PIECEWISE CUDA graph capture for Inkling while keeping attention metadata padded and static across warmup and capture. Co-authored-by: Bugen Zhao <i@bugenzhao.com> Co-authored-by: Giancarlo Delfin <32987265+TheEpicDolphin@users.noreply.github.com> Co-authored-by: Isotr0py <Isotr0py@outlook.com> Co-authored-by: Isotr0py <mozf@inferact.ai> Co-authored-by: Jee Jee Li <jeejeelee@inferact.ai> Co-authored-by: Roger Wang <hey@rogerw.io> Co-authored-by: Yifan Qiao <yifanqiao@inferact.ai> Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: OpenAI Codex <codex@openai.com> Signed-off-by: Woosuk Kwon <woosuk@inferact.ai>
WoosukKwon
force-pushed
the
agent/inkling-breakable-cudagraph
branch
from
July 16, 2026 15:48
baf523c to
b00967e
Compare
njhill
added a commit
to njhill/vllm
that referenced
this pull request
Jul 21, 2026
vllm-project#48822 made breakable piecewise graph replay pad batch metadata to the captured shape (num_reqs padded to min(num_tokens, max_num_reqs), with zero-length trailing requests). That breaks backends whose attention runs eagerly as graph break points and reads the real batch from the forward context: the DSA indexer decode path expands the padded request count by next_n (deepgemm asserts batch_size * next_n == weights rows), and the sparse MLA prefill path cannot build TMA descriptors for zero-length padding requests. This crashed DeepSeek-V4-Flash on the V2 runner (deepgemm attention.hpp:371 assert on B200; flashmla phase1.cuh TMA failure on GB200) and would equally affect MiniMax-M3 Sparse. The padding is not needed by the in-graph kernels either: the runner always pads slot_mapping to the captured token count, and in-graph kernels self-pad from it - Inkling's sconv_seq_metadata fills the tail rows from slot_mapping.shape[0] and fused_sconv skips slot == -1 rows, independent of the batch metadata shapes. So restore the pre-vllm-project#48822 invariant at both replay-side padding sites: piecewise descriptors carry num_reqs=None again, and the model state builds replay metadata with real (unpadded) sizes for piecewise graphs. Capture-time metadata keeps the padded shapes for free because the capture dummy batch is exactly the captured size. Validated on GB200: DeepSeek-V4-Flash gsm8k (TP2+EP, MTP, fp4 indexer cache, FULL_AND_PIECEWISE) 0.9492 at the previously-crashing commit vs 0.0000/engine-crash without the fix; breakable cudagraph and dispatch unit tests unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Nick Hill <nickhill123@gmail.com>
njhill
added a commit
to njhill/vllm
that referenced
this pull request
Jul 21, 2026
The tests/models/inkling suite (8 files: FA4 kernels, sconv metadata, MoE weight layout, contract validation, MTP input fusion, QKV prep, MM towers) was not referenced by any CI job, so none of it ran in CI - including the contract-validation tests that vllm-project#48822 itself modified. Add a B200 job (the FA4 tests require SM100; they skip elsewhere) to the Models - Basic group. Suite runs in ~6.5 min on 1 GPU; validated 194/194 passing at current main on GB200. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Nick Hill <nickhill123@gmail.com>
This was referenced Aug 30, 2026
Open
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.
Summary
This is the second independently mergeable slice carved out of #48768. It adds breakable (piecewise) CUDA graph support for Inkling on Model Runner V2:
InklingForCausalLMandInklingForConditionalGenerationCudaGraphManagercoverage for fresh capture metadataInkling is assumed to always run with Model Runner V2. The legacy
vllm/v1/worker/gpu_model_runner.pyandvllm/v1/cudagraph_dispatcher.pypaths are unchanged.This PR intentionally contains no LoRA support and no Inkling MTP support. The small autoregressive speculator CUDA-graph utility adjustment is generic MRV2 metadata plumbing required to keep that existing runner compatible with the shared breakable graph path; this PR does not enable or test Inkling speculative decoding.
Duplicate-work check
I searched the open PRs for
breakable Inkling,piecewise Inkling CUDA graph, andPW CUDA graph Inkling. The only match was #48768 because its description records this carve-out. Before publishing this PR, the corresponding breakable-CUDA-graph files and config hunk were removed from #48768, so the diffs do not duplicate each other.Testing
pre-commit run.venv/bin/python -m pytest tests/models/inkling/test_contract_validation.py -q.venv/bin/python -m pytest tests/v1/cudagraph/test_breakable_cudagraph.py::test_piecewise_capture_builds_fresh_metadata_for_both_passes -qModel evaluation
Served
thinkingmachines/Inkling-NVFP4on four GB200 GPUs with TP4, Model Runner V2, and without MTP/speculative decoding:Both PIECEWISE (51/51) and FULL (51/51) CUDA graph capture completed successfully. Four concurrent GSM8K prompts were then sent through
/v1/chat/completionswithmax_tokens=2048andtemperature=0. Result: 4/4 correct, with all requests finishing normally.The lower memory utilization and 8192-token test length leave KV-cache headroom for the approximately 551 GiB checkpoint; the default 0.9 utilization did not leave enough free memory for KV allocation on this host.
AI assistance
AI assistance was used to help carve out the existing implementation, add tests, run validation, and prepare this PR. The human submitter will review every changed line and is responsible for understanding and defending the change end-to-end.