Skip to content

[ROCm] Enable fused AR draft metadata updates for DeepSeek V4 - #52628

Open
tpopp wants to merge 1 commit into
vllm-project:mainfrom
tpopp:rocm-dsv4-fused-ar-spec
Open

tpopp wants to merge 1 commit into
vllm-project:mainfrom
tpopp:rocm-dsv4-fused-ar-spec

Conversation

@tpopp

@tpopp tpopp commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Builds on vLLM PR #46849, which restores fused multi-step draft decode graphs for autoregressive speculative decoding when every attention backend can update step-dependent draft metadata in place. That PR left DeepSeek V4 ROCm sparse SWA disabled because the AMD path also materializes ROCm-specific ragged SWA indices and indptrs.

Enable the ROCm DeepSeek V4 AITER SparseSWA metadata builder for fused draft decode by refreshing its ragged SWA representation after the generic dense SWA update. The refresh writes directly into the persistent metadata buffers returned by build(), avoiding temporary ragged flat/indptr allocations so captured HIPGraph replay keeps stable tensor storage addresses. Add focused tests for the direct-to-buffer helper and in-place metadata update.

Validation used TP4 on MI355X against patched and control images built from vllm/main@c4e9692. Runtime logs confirmed the patched image used the fused speculator graph path, while control logged fallback because DEEPSEEK_SPARSE_SWA did not support fused multi-step draft decode metadata updates. Smoke, GSM8K, c16, and c128 runs completed with no HIPGraph/cudagraph replay errors, illegal memory access, stale metadata symptoms, or failed benchmark requests.

Serve command shape:
VLLM_ROCM_USE_AITER=1 SAFETENSORS_FAST_GPU=1
vllm serve deepseek-ai/DeepSeek-V4-Flash
--tensor-parallel-size 4
--attention_backend ROCM_AITER_UNIFIED_ATTN
--compilation-config '{"mode":3,"cudagraph_mode":"FULL_DECODE_ONLY"}'
--speculative-config '{"method":"mtp","num_speculative_tokens":3,"attention_backend":"ROCM_AITER_UNIFIED_ATTN"}'
--kv-cache-dtype fp8
--distributed-executor-backend mp
--max_model_len 4096
--max-num-batched-tokens 8192
--max_num_seqs 256
--tokenizer-mode deepseek_v4
--tool-call-parser deepseek_v4
--trust-remote-code

Accuracy command shape:
lm_eval --model local-completions
--tasks gsm8k
--num_fewshot 8
--model_args model=deepseek-ai/DeepSeek-V4-Flash,base_url=http://localhost:/v1/completions,num_concurrent=16,tokenized_requests=False

Accuracy results, full GSM8K 8-shot, no limit:
patched flexible/strict: 0.9492 / 0.9500
control flexible/strict: 0.9416 / 0.9424

Benchmark command shapes:
vllm bench serve --model deepseek-ai/DeepSeek-V4-Flash
--dataset-name random
--random-input-len 512
--random-output-len 1024
--temperature 0
--ignore-eos
--max-concurrency 16
--num-prompts 160
--num-warmups 16

vllm bench serve --model deepseek-ai/DeepSeek-V4-Flash
--dataset-name random
--random-input-len 512
--random-output-len 1024
--temperature 0
--ignore-eos
--max-concurrency 128
--num-prompts 1024
--num-warmups 128

Performance results, output throughput:
c16 patched/control: 2000.58 / 1958.82 tok/s (+2.13%)
c128 patched/control: 7852.55 / 7751.43 tok/s (+1.30%)

@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.

@mergify mergify Bot added deepseek Related to DeepSeek models rocm Related to AMD ROCm labels Aug 17, 2026
@github-project-automation github-project-automation Bot moved this to Todo in AMD Aug 17, 2026
@mergify mergify Bot added the DSv4 label Aug 19, 2026
@maeehart

Copy link
Copy Markdown
Contributor

pre-commit failed on ruff in vllm/platforms/cpu.py. Lines 184 and 190 are E501 (90 and 98 cols, limit 88), and ruff format wants to rewrite that same file. Can you wrap those two lines, run ruff format on vllm/platforms/cpu.py, and push?

Builds on vLLM PR vllm-project#46849, which restores fused multi-step draft decode graphs for autoregressive speculative decoding when every attention backend can update step-dependent draft metadata in place. That PR left DeepSeek V4 ROCm sparse SWA disabled because the AMD path also materializes ROCm-specific ragged SWA indices and indptrs.

Enable the ROCm DeepSeek V4 AITER SparseSWA metadata builder for fused draft decode by refreshing its ragged SWA representation after the generic dense SWA update. The refresh writes directly into the persistent metadata buffers returned by build(), avoiding temporary ragged flat/indptr allocations so captured HIPGraph replay keeps stable tensor storage addresses. Add focused tests for the direct-to-buffer helper and in-place metadata update.

Validation used TP4 on MI355X against patched and control images built from vllm/main@c4e9692. Runtime logs confirmed the patched image used the fused speculator graph path, while control logged fallback because DEEPSEEK_SPARSE_SWA did not support fused multi-step draft decode metadata updates. Smoke, GSM8K, c16, and c128 runs completed with no HIPGraph/cudagraph replay errors, illegal memory access, stale metadata symptoms, or failed benchmark requests.

Serve command shape:
  VLLM_ROCM_USE_AITER=1 SAFETENSORS_FAST_GPU=1 \
  vllm serve deepseek-ai/DeepSeek-V4-Flash \
    --tensor-parallel-size 4 \
    --attention_backend ROCM_AITER_UNIFIED_ATTN \
    --compilation-config '{"mode":3,"cudagraph_mode":"FULL_DECODE_ONLY"}' \
    --speculative-config '{"method":"mtp","num_speculative_tokens":3,"attention_backend":"ROCM_AITER_UNIFIED_ATTN"}' \
    --kv-cache-dtype fp8 \
    --distributed-executor-backend mp \
    --max_model_len 4096 \
    --max-num-batched-tokens 8192 \
    --max_num_seqs 256 \
    --tokenizer-mode deepseek_v4 \
    --tool-call-parser deepseek_v4 \
    --trust-remote-code

Accuracy command shape:
  lm_eval --model local-completions \
    --tasks gsm8k \
    --num_fewshot 8 \
    --model_args model=deepseek-ai/DeepSeek-V4-Flash,base_url=http://localhost:<PORT>/v1/completions,num_concurrent=16,tokenized_requests=False

Accuracy results, full GSM8K 8-shot, no limit:
  patched flexible/strict: 0.9492 / 0.9500
  control flexible/strict: 0.9416 / 0.9424

Benchmark command shapes:
  vllm bench serve --model deepseek-ai/DeepSeek-V4-Flash \
    --dataset-name random \
    --random-input-len 512 \
    --random-output-len 1024 \
    --temperature 0 \
    --ignore-eos \
    --max-concurrency 16 \
    --num-prompts 160 \
    --num-warmups 16

  vllm bench serve --model deepseek-ai/DeepSeek-V4-Flash \
    --dataset-name random \
    --random-input-len 512 \
    --random-output-len 1024 \
    --temperature 0 \
    --ignore-eos \
    --max-concurrency 128 \
    --num-prompts 1024 \
    --num-warmups 128

Performance results, output throughput:
  c16 patched/control: 2000.58 / 1958.82 tok/s (+2.13%)
  c128 patched/control: 7852.55 / 7751.43 tok/s (+1.30%)

Co-authored-by: Cursor <cursoragent@cursor.com>

Signed-off-by: Tres Popp <tres.popp@amd.com>
@tpopp
tpopp force-pushed the rocm-dsv4-fused-ar-spec branch from 7485e34 to 78fae58 Compare September 3, 2026 12:58
@tpopp

tpopp commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Branch is updated and pre-commit is fixed.

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

Labels

deepseek Related to DeepSeek models DSv4 rocm Related to AMD ROCm

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants