Skip to content

[ROCm][Perf] Enable HCA dual-stream overlap for DeepSeek-V4 - #56853

Merged
shen-shanshan merged 3 commits into
vllm-project:mainfrom
shen-shanshan:rocm-dsv4-hca-dual-stream
Sep 17, 2026
Merged

shen-shanshan merged 3 commits into
vllm-project:mainfrom
shen-shanshan:rocm-dsv4-hca-dual-stream

Conversation

@shen-shanshan

@shen-shanshan shen-shanshan commented Sep 14, 2026 •

Copy link
Copy Markdown
Member

Purpose

#51794 enabled multi-stream overlap for CSA layers on ROCm but left HCA layers (main compressor present, no indexer) single-stream, because the ROCm attention subclass dropped its aux streams whenever no indexer exists. On gfx950 the HCA main compressor is a large fraction of the attention-layer decode time and is fully independent of the query/KV chain: both branches only read the layer input (hidden_states) plus their own weights and state, and nothing on the default-stream chain consumes the compressor's outputs until the sparse attention.

For HCA layers the attention forward now forks inside the gated region:

  • Default stream: fused wqa/wkv GEMM → q/kv RMSNorm → wq_b → qnorm/RoPE → SWA KV insert.
  • Aux stream 0: HCA main compressor (fused wkv/wgate score GEMM + DeepseekCompressor).

The streams join before the sparse MLA attention, which reads the compressed KV cache and the SWA window. The serial MHC fused post+pre prelude keeps running on the default stream ahead of the fork; the fork's start event orders the aux chain after it.

Trace Comparison (take conc=4 as an example)

Before:

main

After (7.47% faster for HCA layer):

hca-dual-stream

Test Plan

Benchmark with SA InferenceX 8k1k workload with server launch commands below:

export VLLM_ROCM_USE_AITER=1
export VLLM_ROCM_USE_AITER_FUSION_SHARED_EXPERTS=1
export AITER_LOG_LEVEL=WARNING

vllm serve deepseek-ai/DeepSeek-V4-Pro \
    --port 8333 \
    --tensor-parallel-size 8 \
    --max-model-len 9472 \
    --max-num-seqs 512 \
    --max-num-batched-tokens 16384 \
    --async-scheduling \
    --no-enable-prefix-caching \
    --distributed-executor-backend mp \
    --gpu-memory-utilization 0.9 \
    --kv-cache-dtype fp8 \
    --trust-remote-code \
    --moe-backend aiter \
    --tokenizer-mode deepseek_v4 \
    --reasoning-parser deepseek_v4 \
    --compilation-config '{"mode":3,"cudagraph_mode":"FULL_AND_PIECEWISE"}'

Accuracy test with gsm8k dataset using lm_eval:

lm_eval \
  --model local-completions \
  --model_args model=/shared/models/deepseek-ai/DeepSeek-V4-Pro,base_url=http://0.0.0.0:8333/v1/completions,num_concurrent=64,max_retries=10,max_gen_toks=2048,timeout=60000 \
  --batch_size auto \
  --tasks gsm8k \
  --num_fewshot 5 \
  --output_path . 2>&1 | tee -a eval.log

lm_eval \
  --model local-completions \
  --model_args model=/shared/models/deepseek-ai/DeepSeek-V4-Pro,base_url=http://0.0.0.0:8333/v1/completions,num_concurrent=256,max_retries=10,max_gen_toks=2048,timeout=60000 \
  --batch_size auto \
  --tasks gsm8k \
  --num_fewshot 30 \
  --output_path . 2>&1 | tee -a eval.log

Note

All tests based on latest nightly-rocm100 image.

Test Result

Benchmark

Conc Version Output token throughput (tok/s) Change Mean TTFT (ms) Change Mean TPOT (ms) Change
1 Main 69.61 — 429.89 — 13.92 —
1 This PR 72.00 3.43% ↑ 365.36 15.01% ↓ 13.51 2.95% ↓
4 Main 229.96 — 454.21 — 16.50 —
4 This PR 236.13 2.68% ↑ 445.49 1.92% ↓ 16.07 2.61% ↓
16 Main 642.98 — 711.37 — 23.36 —
16 This PR 653.01 1.56% ↑ 708.66 0.38% ↓ 22.99 1.58% ↓
64 Main 1298.06 — 1600.01 — 46.73 —
64 This PR 1310.56 0.96% ↑ 1601.33 0.08% ↑ 46.28 0.96% ↓

In summary, the PR provides a positive overall performance impact, primarily through higher output token throughput and lower TPOT. The improvements are particularly noticeable at low concurrency, while at high concurrency the throughput and TPOT gains remain positive but become smaller. The TTFT results at high concurrency are essentially neutral, with no meaningful regression.

Accuracy Test

Conc=64, numshot=5 (default):

Tasks Version Filter n-shot Metric Value Stderr
gsm8k 3 flexible-extract 5 exact_match ↑ 0.9477 ± 0.0061
strict-match 5 exact_match ↑ 0.9484 ± 0.0061

Conc=256, numshot=30:

Tasks Version Filter n-shot Metric Value Stderr
gsm8k 3 flexible-extract 30 exact_match ↑ 0.9515 ± 0.0059
strict-match 30 exact_match ↑ 0.9522 ± 0.0059

Full GSM8K evaluation on this change (1,319 examples) and both results exceed the required 94% threshold.


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

@mergify mergify Bot added deepseek Related to DeepSeek models DSv4 rocm Related to AMD ROCm labels Sep 14, 2026
@github-project-automation github-project-automation Bot moved this to Todo in AMD Sep 14, 2026
Signed-off-by: Shanshan Shen <87969357+shen-shanshan@users.noreply.github.com>
@shen-shanshan
shen-shanshan force-pushed the rocm-dsv4-hca-dual-stream branch from de96a98 to f6b0554 Compare September 15, 2026 07:07
@shen-shanshan
shen-shanshan marked this pull request as ready for review September 15, 2026 10:31

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

@tjtanaa

tjtanaa commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

@shen-shanshan can you provide gsm8k conc 256 numshot 30 acc results ? LGTM. As long as accuracy passed. 🙌

@shen-shanshan

shen-shanshan commented Sep 17, 2026 •

Copy link
Copy Markdown
Member Author

@shen-shanshan can you provide gsm8k conc 256 numshot 30 acc results ? LGTM. As long as accuracy passed. 🙌

@tjtanaa Sorry for late reply, since I have just fixed the DSV4 acc issue on main in #57132 yesterday. I have attached the gsm8k test results and it shows well.

@shen-shanshan

Copy link
Copy Markdown
Member Author

/ci run

@github-actions

Copy link
Copy Markdown

❌ This PR is 128 commits behind upstream main. Your branch must contain every commit currently on upstream main. No new CI build was started. Merge or rebase onto the latest main, then rerun /ci run. To test this branch at your own risk, use /ci run --allow-stale.

@shen-shanshan

Copy link
Copy Markdown
Member Author

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #89542 for commit 9af583443fab.

@shen-shanshan
shen-shanshan enabled auto-merge (squash) September 17, 2026 05:12
@github-actions github-actions Bot added the ready ONLY add when PR is ready to merge/full CI is needed label Sep 17, 2026
@shen-shanshan
shen-shanshan merged commit fdcd423 into vllm-project:main Sep 17, 2026
73 of 74 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in AMD Sep 17, 2026
michael-gpu pushed a commit to practical-inference/vllm-ampere-extended that referenced this pull request Oct 20, 2026
…ject#56853)

Signed-off-by: Shanshan Shen <87969357+shen-shanshan@users.noreply.github.com>
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 ready ONLY add when PR is ready to merge/full CI is needed rocm Related to AMD ROCm

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants