Skip to content

[ROCm][Perf] Extend default CUDA graph sizes for speculative decoding with breakable graphs on CDNA4 - #66563

Open
tuukkjs wants to merge 5 commits into
vllm-project:mainfrom
tuukkjs:fix/fu-high-concurrency-rocm-breakable-capture
Open

tuukkjs wants to merge 5 commits into
vllm-project:mainfrom
tuukkjs:fix/fu-high-concurrency-rocm-breakable-capture

Conversation

@tuukkjs

@tuukkjs tuukkjs commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Overview

With breakable CUDA graphs, vLLM runs without torch.compile, so a batch wider than every captured graph runs eagerly. On ROCm the default graphs stop at 512 tokens, which K=5 speculative decoding exceeds at 84 requests: DeepSeek-V4.1-Flash, which uses breakable graphs by default on ROCm, then runs DSpark slower than no speculation at high concurrency on MI355X. On CDNA4/gfx950 with breakable graphs and speculative decoding, this PR raises the default prefill and decode CUDA graph sizes to twice the widest decode batch, at most 2048 tokens.

Scope. Only models that run breakable CUDA graphs with speculative decoding on gfx950 change: DeepSeek-V4.1 and HY4 by default, and any model with VLLM_USE_BREAKABLE_CUDAGRAPH=1 (for example the Kimi-K3.1-Pro recipe's MI355X command). Other GPUs, runs without speculation and capture sizes set in --compilation-config resolve as before.

Why change the default. The same graphs can be requested with --compilation-config, and tuned recipes set them by hand, but the default command, which most users run, falls off this cliff. This PR makes the default cover the speculative decode batch, as #49390 (1024-token shared default) and #63406 (prefill graphs and decode token budget at 8192 tokens) did on data-center Blackwell.

Claims

DeepSeek-V4.1-Flash on MI355X with DSpark, main → this PR:

  • TP4, SPEED-Bench, K=5: +109% output throughput at concurrency 128 (0.61x → 1.28x of no speculation) and +49% at 256 (0.70x → 1.05x).
  • Adaptive verification: +10% at 128 and +23% at 256 (0.98x → 1.20x).
  • TP2 with Engram offloaded, K=5: +48% at 128 and +9% at 256.
  • 8K input / 1K output (max_num_seqs 256): K=5 +23% at 128 (1.22x → 1.50x) and +7% at 256; adaptive verification +1% and +5%.
  • No regression up to concurrency 64 or with 60K-128K inputs, and no statistically detectable accuracy difference (GSM8K at concurrency 256, GPQA, NIAH at 64K).
  • Cost: 2.9-3.8 GiB more graph memory per rank (KV pool -4 to -5%) and 5-22 s more capture time. Small configurations (max_num_seqs * (1 + K) <= 256) are unchanged.

Validation

MI355X x4, deepseek-ai/DeepSeek-V4.1-Flash-1017, DSpark with fixed verification (K=5) or adaptive verification (AV). One server per arm: "main" is an unmodified nightly image, "this PR" mounts its vllm/config/{vllm,compilation}.py with this diff applied. Setup and commands are in the fold below.

Accuracy

eval (concurrency) arm main this PR
GSM8K 5-shot (256), mean of 3 runs (min-max) K=5 0.923 (0.917-0.931) 0.922 (0.920-0.923)
AV 0.923 (0.917-0.930) 0.924 (0.923-0.926)
GPQA Diamond, thinking (32) K=5 0.899 0.894
NIAH niah_single_2, 64K (32) K=5 1.000 1.000

No statistically detectable difference. Per GSM8K question, over three runs per arm, this PR minus main is -0.10 ± 0.41 points (K=5) and +0.08 ± 0.38 (AV), and the two disagree on as many questions as two runs of one server (batched serving is not bit-deterministic). GPQA's standard error is about 0.02.

Performance

Results are single runs; this PR's TP4 SPEED-Bench cells at C64-C256 were repeated and agree within 3 points. Bold marks changes beyond the run-to-run spread (about ±5%, up to 10% for the smallest runs) at concurrency 128-256, where main runs most target steps eagerly.

SPEED-Bench (qualitative, output length 512), TP4, output throughput (tok/s), main → this PR:

C no spec K=5 AV
1 276 668 → 667 (-0%) 595 → 593 (-0%)
16 2572 3108 → 3158 (+2%) 3129 → 3207 (+3%)
64 4459 6191 → 6555 (+6%) 6902 → 7016 (+2%)
128 7036 4314 → 9022 (+109%) 8879 → 9740 (+10%)
256 10812 7590 → 11302 (+49%) 10558 → 12948 (+23%)

At C128 / C256, the share of target steps that run eagerly (--cudagraph-metrics logs NONE) falls from 80% / 85% to 2% / 14% for K=5 and from 9% / 18% to 1% / 5% for AV (no spec: 1%). AV's acceptance length at C256 rises from 2.03 to 2.49 (K=5: 2.90 → 2.89). Up to C64, decode steps use the same graphs; only mixed steps above 512 tokens move from eager to graphs (K=5 at C64: 7% → 0% of steps).

TP2 with Engram offloaded, K=5, output throughput (tok/s), main → this PR; eager steps at C128 / C256 fall from 83% / 84% to 3% / 14%:

C K=5
64 4487 → 4587 (+2%)
128 4169 → 6184 (+48%)
256 7276 → 7925 (+9%)

Long-input sweep with SGLang's serving benchmark against the vLLM server (python3 -m sglang.bench_serving, random dataset: ShareGPT text resized to 80-100% of the target input and output lengths), max_num_seqs 256, image nightly-083fbac0 (see the fold below). Output throughput (tok/s), main → this PR:

input / output C no spec K=5 AV
8K / 1K 4 821 1821 → 1821 (-0%) 1953 → 1961 (+0%)
8K / 1K 8 1379 2691 → 2698 (+0%) 2644 → 2565 (-3%)
8K / 1K 16 2050 3689 → 3667 (-1%) 3678 → 3651 (-1%)
8K / 1K 32 2742 4798 → 4859 (+1%) 4855 → 4824 (-1%)
8K / 1K 64 3453 6280 → 6268 (-0%) 6197 → 6205 (+0%)
8K / 1K 128 4835 5901 → 7255 (+23%) 7209 → 7273 (+1%)
8K / 1K 256 6394 7766 → 8314 (+7%) 8027 → 8445 (+5%)
60K / 600 4 484 723 → 721 (-0%) 715 → 701 (-2%)
60K / 600 16 761 900 → 882 (-2%) 890 → 882 (-1%)
60K / 600 64 911 976 → 968 (-1%) 969 → 968 (-0%)
128K / 1K 4 439 614 → 615 (+0%) 615 → 614 (-0%)
128K / 1K 16 632 727 → 725 (-0%) 724 → 723 (-0%)

Below C128 and at 60K-128K inputs, decode stays within 512 tokens and long prompts prefill in chunks above 2048 tokens, so both arms run largely the same graphs.

Startup cost (rank 0), main → this PR:

setup arm graph memory (GiB) KV pool (tokens) graph capture (s)
TP4 K=5 7.52 → 10.44 (1.4x) 35.83M → 34.39M (-4.0%) 624 → 646 (+4%)
TP4 AV 9.26 → 13.03 (1.4x) 35.12M → 33.49M (-4.6%) 647 → 652 (+1%)
TP2 K=5 7.88 → 11.46 (1.5x) 28.94M → 27.60M (-4.6%) 677 → 692 (+2%)
Setup and commands
  • SPEED-Bench, TP2 and GSM8K: vllm/vllm-openai-rocm:nightly-a2bcb5657a881a002e79d0adab3c6b5e39436121; this revision of the change gated on the equivalent get_cdna_version() == 4. Long-input sweep, GPQA and NIAH: nightly-083fbac021348c2c7af8a7bc71ba18199d0dd7a4, with quick_all_reduce.py from [Bugfix][ROCm] Support AITER's preload() in FlyDSL INT4 QuickReduce init #65995 mounted in every arm (INT4 QuickReduce with aiter 0.1.28).
  • Model revision 1bae0e10; main's GSM8K repeats (except K=5), TP2 main and every arm of this PR loaded 08c8657f, the same weights plus chat_template.jinja.
  • The measured code predates two changes that leave these configurations unchanged: the draft-decode guard on the decode budget (no effect at max_num_seqs up to 2048) and keeping explicitly set decode request sizes without the budget.

Server (recipe MI355X command; TP2 adds --tensor-parallel-size 2 --engram-config '{"cpu_offload":true}'; the long-input sweep drops --cudagraph-metrics and adds AITER_USE_FLYDSL_MOE_SORTING=1 --max-num-seqs 256 --no-enable-prefix-caching --enable-auto-tool-choice --tool-call-parser deepseek_v41 --reasoning-parser deepseek_v41):

VLLM_ROCM_USE_AITER=1 VLLM_ROCM_USE_AITER_MOE=1 VLLM_ROCM_USE_AITER_TRITON_SPARSE_MLA=1 \
VLLM_ROCM_QUICK_REDUCE_QUANTIZATION=INT4 VLLM_USE_BREAKABLE_CUDAGRAPH=1 \
vllm serve deepseek-ai/DeepSeek-V4.1-Flash-1017 --tensor-parallel-size 4 \
  --tokenizer-mode deepseek_v41 --language-model-only --gpu-memory-utilization 0.9 \
  --moe-backend aiter --engram-config '{"cpu_offload":false}' \
  --attention-config '{"indexer_kv_dtype":"mxfp4","indexer_sparse_logits":true}' \
  --block-size 128 --monokernel --cudagraph-metrics \
  --speculative-config '{"method":"dspark","num_speculative_tokens":5,"draft_sample_method":"probabilistic","rejection_sample_method":"block","enable_adaptive_verification":<false|true>}'

Clients:

# SPEED-Bench; num-prompts 16 / 64 / 320 / 512 / 1024 at C 1 / 16 / 64 / 128 / 256, after warmup
vllm bench serve --backend openai-chat --endpoint /v1/chat/completions \
  --model deepseek-ai/DeepSeek-V4.1-Flash-1017 --tokenizer-mode deepseek_v41 \
  --dataset-name speed_bench --dataset-path <speed-bench> --speed-bench-dataset-subset qualitative \
  --speed-bench-output-len 512 --skip-chat-template --disable-shuffle --ignore-eos \
  --temperature 1.0 --seed 20261102 --request-rate inf --max-concurrency <C> --num-prompts <N> \
  --extra-body '{"cache_salt":"<unique per run>"}'

# Long-input sweep (SGLang client); num-prompts 32 / 64 / 96 / 128 / 256 / 384 / 768 at C 4 / 8 / 16 / 32 / 64 / 128 / 256
python3 -m sglang.bench_serving --backend vllm --model deepseek-ai/DeepSeek-V4.1-Flash-1017 \
  --dataset-name random --random-input-len <ISL> --random-output-len <OSL> --random-range-ratio 0.8 \
  --request-rate inf --max-concurrency <C> --num-prompts <N> --warmup-requests <C>

# GSM8K
lm_eval --model local-completions --tasks gsm8k --num_fewshot 5 --seed 42 \
  --model_args model=deepseek-ai/DeepSeek-V4.1-Flash-1017,base_url=<server>/v1/completions,num_concurrent=256

# GPQA
python3 -m sglang.test.run_eval --eval-name gpqa --num-threads 32 --max-tokens 100000 \
  --chat-template-kwargs '{"enable_thinking": true, "think_end_token": "</think>"}'

# NIAH
lm_eval --model local-chat-completions --tasks niah_single_2 --metadata '{"max_seq_lengths":[65536]}' \
  --apply_chat_template --gen_kwargs '{"chat_template_kwargs":{"thinking":false}}' --seed 1234 \
  --model_args '{"model":"deepseek-ai/DeepSeek-V4.1-Flash-1017","base_url":"<server>/v1/chat/completions","num_concurrent":32}'

Unit tests

tests/compile/test_config.py builds a real VllmConfig (facebook/opt-125m with n-gram or draft-model speculation); only is_device_capability stands in for the GPU. The cases cover the gfx950 defaults and each term of the bound; no speculation, no breakable graphs, gfx942 and the deprecated fields (unchanged sizes); an explicit setting; sizes up to 512 tokens unchanged; and one-token draft decodes up to max_num_seqs. On MI355X, pytest -v tests/compile/test_config.py -k "rocm_breakable or one_token_draft":

# main (5916cef98e) with these tests
FAILED tests/compile/test_config.py::test_rocm_breakable_speculative_defaults[overrides0-expected0]
E       AssertionError: assert (512, 83, None) == (2048, 341, 2048)
(and the three other extended-default cases)
========== 4 failed, 11 passed, 135 deselected, 16 warnings in 15.23s ==========

# this PR
=============== 15 passed, 135 deselected, 16 warnings in 15.17s ===============

The whole file passes (150 passed). In CI the tests run in the MI300 mirror of PyTorch Compilation and skip off ROCm.

Details

Root cause. The 512-token ceiling assumes torch.compile covers wider batches, but breakable CUDA graphs set CompilationMode.NONE, so a wider batch launches every op from Python. DSpark verifies K+1 = 6 tokens per request, so K=5 decode graphs stop at 83 requests. Adaptive verification prices the eager step as a cost cliff and mostly stays within 512 tokens, which holds acceptance length at 2.03. Variable acceptance also spreads prefills across most steps, so mixed steps of about 1500 decode tokens plus a short prefill are frequent.

Change. In _split_cudagraph_capture_sizes, on ROCm gfx950 (is_device_capability(95)) with breakable CUDA graphs, speculative decoding and none of the deprecated shared fields set, unset kinds extend to min(2 * max_num_seqs * (1 + K), 2048, max_num_batched_tokens) tokens, the shared ceiling's 2 * max_num_seqs * query_len rule:

  • prefill: the shared sizes plus the default prefill grid up to the bound
  • decode: the shared request counts plus the default request grid up to max_num_seqs
  • decode token budget (which also bounds adaptive verification's graphs): the bound, but at least max_num_seqs, so one-token draft decodes (EAGLE, MTP, draft models) keep their graphs as on main.

Sizes up to 512 tokens and explicit settings are unchanged. It reuses the grids of #63406's SM100 defaults (a prefill grid, and a decode request grid within a token budget), but where SM100 applies a fixed 8192 tokens to every model, this applies only with breakable graphs (no compiled fallback) and speculative decoding (1 + K tokens per decode request), scales with the decode batch and stops at 2048, since graph memory comes out of the KV cache. 2048 covers K=5 decode up to 341 requests; a 4096 cap measured the same SPEED-Bench gains at C64-C256 (within 3 points at TP2 and TP4) at more than twice the extra graph memory.

Tradeoffs and limitations.

  • Graph memory comes out of the KV pool (4-5% at TP4 and TP2). When serving is KV-bound, e.g. many long-context sessions near the cache limit, the smaller pool lowers prefix-cache hits and can outweigh the gain.
  • Measured only with DeepSeek-V4.1-Flash on MI355X; the other models in Scope get the same sizes unmeasured.
  • --compilation-config '{"max_prefill_cudagraph_capture_tokens":2048,"max_decode_cudagraph_capture_requests":1024,"max_decode_cudagraph_capture_tokens":2048}' gives the same coverage today; this PR makes it the default. Those caps also switch to the coarser default grids from 1 token (less graph memory), while this PR keeps main's sizes up to 512 tokens.
  • Prefill and mixed steps above 2048 tokens still run eagerly (at C256, 5-14% of steps).
  • Limited to CDNA4: gfx942 has less memory per GPU, so the graph pool would take a larger share of its KV cache (unmeasured). NVIDIA breakable-graph models are not changed.

Duplicate check. No open or recent PR extends capture sizes for speculative decoding on ROCm. #64825 (open) extends the split prefill sizes for Qwen3.5 on NVIDIA in the same function; whichever lands second rebases. #60265 (open) edits the deprecated shared sizes. #63070 (draft, GLM-5.3-Flash) and #66320 (Qwen3.5) would move more models to breakable graphs on gfx950, which then get these sizes when speculating. Recipes set such sizes by hand today, e.g. MiniMax-M3.1-Flash on MI355X (#66188).


Pull Request Checklist
  • I used vLLM's /pr-checklist skill. (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.

AI assistance was used for this PR.

@mergify

mergify Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Documentation preview: https://vllm--66563.org.readthedocs.build/en/66563/

@mergify mergify Bot added documentation Improvements or additions to documentation nvidia rocm Related to AMD ROCm labels Nov 9, 2026
@mergify mergify Bot added the torch.compile label Nov 9, 2026
@github-project-automation github-project-automation Bot moved this to Todo in AMD Nov 9, 2026
@tuukkjs
tuukkjs force-pushed the fix/fu-high-concurrency-rocm-breakable-capture branch 4 times, most recently from b7aaf79 to be6fc40 Compare November 11, 2026 07:11

@jhartika-amd jhartika-amd left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @tuukkjs! This seems like well evidenced change. One change request in inline comment.

Comment thread vllm/config/vllm.py Outdated
max_num_tokens,
)
extend = extended_max_tokens > shared_max
if extend and compilation_config.max_decode_cudagraph_capture_tokens is None:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sets the decode budget even when the user set max_decode_cudagraph_capture_requests or decode_cudagraph_capture_request_sizes. E.g. K=5 with max_decode_cudagraph_capture_requests: 1024: main captures decode graphs up to 1024 requests (6144 tokens); this PR stops at 682 (4092 tokens), and adaptive verification's verify graphs at 4096 instead of 6144. That contradicts "capture sizes set in --compilation-config resolve as before". Either set the budget only when both decode fields are unset (decode_sizes is None and max_decode_requests is None), or state it in the description and docs (SM100's 8192 budget behaves the same way). A test case with max_decode_cudagraph_capture_requests: 1024 would pin it down.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Fixed it. The budget is now set only when neither decode_cudagraph_capture_request_sizes nor max_decode_cudagraph_capture_requests is set, so max_decode_cudagraph_capture_requests: 1024 captures decode graphs up to 1024 requests (6144 tokens) as on main. The test case now uses 1024 and expects no budget. SM100's 8192 budget has the same interaction on main. I left that out of scope here.

@github-project-automation github-project-automation Bot moved this to In review in NVIDIA Nov 12, 2026
tuukkjs and others added 2 commits November 12, 2026 10:29
… with breakable graphs on CDNA4

Breakable CUDA graphs run without torch.compile, so a batch wider than every
captured graph runs eagerly. On ROCm the default sizes stop at 512 tokens,
which a K=5 speculative decode batch exceeds at 84 requests. With speculative
decoding on breakable CUDA graphs on CDNA4 (gfx950), the default prefill and
decode CUDA graph sizes now reach twice the widest decode batch, at most 4096
tokens. Sizes set explicitly in --compilation-config are kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tuukka Sarvi <tuukka.sarvi@amd.com>
Set the extended decode token budget only when neither
decode_cudagraph_capture_request_sizes nor
max_decode_cudagraph_capture_requests is set. With
max_decode_cudagraph_capture_requests=1024 and K=5, decode graphs now
reach 1024 requests (6144 tokens) as on main instead of stopping at 682.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tuukka Sarvi <tuukka.sarvi@amd.com>
@tuukkjs
tuukkjs force-pushed the fix/fu-high-concurrency-rocm-breakable-capture branch from be6fc40 to a71a983 Compare November 12, 2026 11:03
At 2048 tokens the extended graphs keep the measured throughput gains of
4096 (within 2.5 points on SPEED-Bench at TP2 and TP4), while the extra graph
memory, and with it the KV cache cost, halves. K=5 decode stays graphed up to
341 requests; only mixed steps of 2048-4096 tokens run eagerly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tuukka Sarvi <tuukka.sarvi@amd.com>
@tuukkjs

tuukkjs commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

Lowered the default bound from 4096 to 2048 tokens. On SPEED-Bench, 2048 measured the same gains as 4096 at C64-C256 (within 3 points at TP2 and TP4) with less than half the extra graph memory.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@njhill

njhill commented Nov 13, 2026

Copy link
Copy Markdown
Member

cc @Pb314314

@jhartika-amd jhartika-amd left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM now

@Pb314314 Pb314314 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the detailed benchmarks and the explicit-override fix. The goal of the questions below is to help justify the new default across the configurations it affects: understand where the gains come from, whether the token grid and number of graphs are appropriate, and what accounts for the extra memory use and whether it could be reduced.

  • Scope / Validation: these defaults also affect HY4 and forced-breakable models on gfx950, while reported end-to-end results cover DeepSeek-V4.1-Flash + DSpark. Graph coverage and memory costs can differ across models/drafters. Could we add representative end-to-end validation beyond that pair, or narrow enablement until validated?
  • Details: prefill/PW and FULL decode settings apply differently across target/drafter paths. Could we document how the prefill token grids, decode request counts and token budgets apply to each, following #63406, §3?
  • Performance: the shared-cap comparison changes both PW and decode coverage. Could we hold decode settings fixed and compare PW=2K/4K/8K on larger prefill/mixed batches, reporting the capture grids and graph counts, throughput, graph memory and remaining KV capacity? #63406, Appendix A offers GB200 workload examples beyond 4K, not an AMD cap recommendation. If memory drives the limit, could we break down target PW/FULL versus drafter allocations and check whether buffer/workspace reuse helps?

Two smaller description/docs points: CPU sizing with gfx950 mocked (9fbe012b → fbc0dc0e) changes the prefill cap from 248 to 252 at max_num_seqs=21, K=5, despite Claims saying small configurations are unchanged. Could we preserve that behavior or qualify the claim and cover this case? Could we also update “no budget elsewhere” in docs/design/torch_compile.md to reflect the CDNA4 budget?

The two inline comments cover scope and budget behavior. Our checks used model-free configs and simulated capture completion for dispatch lookup; no real GPU capture, model execution or AMD performance/memory measurement was run.

Comment thread vllm/config/vllm.py
and current_platform.is_rocm()
and current_platform.is_device_capability(95)
and compilation_config.use_breakable_cudagraph
and self.uniform_decode_query_len > 1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CPU sizing check shows prefill max changing from 512 to 2048 (9fbe012b → fbc0dc0e) with simulated gfx950/breakable graphs, no speculative config, diffusion canvas 256 and eight requests. One scope concern is that uniform_decode_query_len also includes the diffusion canvas length, so the default extension in this PR reaches beyond the intended speculative-decoding scope. Could we explicitly require speculation and add a regression test, leaving diffusion tuning to separate work? The check used a mocked platform and model-free config; it did not run a diffusion model, GPU capture or AMD benchmark.

Comment thread vllm/config/vllm.py Outdated
Comment on lines +2672 to +2675
# One-token draft decodes keep their graphs up to max_num_seqs.
compilation_config.max_decode_cudagraph_capture_tokens = max(
extended_max_tokens, min(max_num_seqs, max_num_tokens)
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CPU checks (9fbe012b → fbc0dc0e, gfx950 mocked) showed two budget concerns.

One concern is lost coverage: with max_num_seqs=1024, dynamic K=5 for batches 1–512 and K=0 for 513–1024, the 512-request/3072-token batch changes from FULL to NONE. Could we preserve existing coverage and add a regression test?

Another concern is that n-gram with K=5, max_num_seqs=8192, and max_num_batched_tokens=16384 expands planned target graphs to 8190 tokens, despite having no draft-model graphs to preserve. Could we bound new target expansion separately from draft coverage and add a regression test?

These model-free CPU checks simulated capture completion for real dispatch-table lookup; no GPU capture, model execution, or AMD performance/memory measurement was run.

…uests

Require a speculative config, so a diffusion canvas no longer triggers the
extension, and extend only where 2 * max_num_seqs * (1 + K) exceeds the
512-token ceiling, so smaller configurations keep main's sizes.

Bound the new target decode request sizes by the extended token bound instead
of setting a decode token budget. The budget also capped the graphs that the
shared sizes give at other query lengths (dynamic speculative decoding's
512-request graphs), and its one-token-draft floor widened n-gram target graphs
up to max_num_seqs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tuukka Sarvi <tuukka.sarvi@amd.com>
@mergify

mergify Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @tuukkjs.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase label Nov 19, 2026

Copy link
Copy Markdown
Contributor

Thanks for working on this! #68552 just merged and adds Platform hooks for capture defaults and grids. Could you take a look and see if they fit the AMD sizing changes here?

@simondanielsson simondanielsson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the work! Agree let's use the platform hook

Question: whats the extra memory consumption from this? Would be good to have numbers for a few different models

Comment thread vllm/config/vllm.py
not legacy_sizes
and not wide_defaults
and current_platform.is_rocm()
and current_platform.is_device_capability(95)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: what's the reason for why we only update CDNA4? I'd imagine it makes sense to update on cdna 3 and above

Suggestion: When we move this to a platform hook we should use get_cdna_version() if we want to keep this

Comment thread vllm/config/vllm.py
_ROCM_BREAKABLE_MAX_CAPTURE_TOKENS,
max_num_tokens,
)
extend = extended_max_tokens > 512

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: How did we determine this value 512?

GPUs, otherwise the platform's default `max_cudagraph_capture_size`; at most
`max_num_batched_tokens`. More and wider graphs take memory from the KV
cache and lengthen startup."""
GPUs; with speculative decoding on breakable CUDA graphs on CDNA4 (gfx950),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: was it intentional to update the prefill cudagraph capture sizes if we're mainly concerned with decodes operating outside CGs?


With adaptive verification, the target model's decode batches mix query lengths, so they take token-keyed graphs. Those graphs reach `max_decode_cudagraph_capture_requests * (1 + num_speculative_tokens)` tokens, within `max_decode_cudagraph_capture_tokens`; the decode request sizes then set only the draft decode graphs.

Breakable CUDA graphs run without torch.compile, so a batch wider than every graph runs eagerly. On ROCm CDNA4 (gfx950) with breakable CUDA graphs and speculative decoding, unset kinds therefore extend past the platform default where `2 * max_num_seqs * (1 + num_speculative_tokens)` exceeds its 512 tokens: prefill graphs reach that many tokens, at most 2048, and decode graphs reach as many requests of `1 + num_speculative_tokens` tokens as fit in them.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor question: Isn't the first sentence true independent of if torch.compile is enabled or not? I'm thinking if we should even remove the breakable cudagraphs checks from the PR if this holds independent of we're using torch.compile.

`max_num_batched_tokens`. More and wider graphs take memory from the KV
cache and lengthen startup."""
GPUs; with speculative decoding on breakable CUDA graphs on CDNA4 (gfx950),
`2 * max_num_seqs * (1 + num_speculative_tokens)` up to 2048 where that

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: What's the rationale for stopping at 2048? Considering SM100 goes up to 8k :)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation needs-rebase nvidia rocm Related to AMD ROCm torch.compile

Projects

Status: Todo
Status: In review
Status: To triage

Development

Successfully merging this pull request may close these issues.

5 participants