Skip to content

[ROCm][Perf][DSV4] Improve sparse decode reduction occupancy on gfx950 - #48788

Merged
tjtanaa merged 1 commit into
vllm-project:mainfrom
Fangzhou-Ai:afz/dsv4-gfx950-sparse-decode-reducer
Jul 17, 2026
Merged

tjtanaa merged 1 commit into
vllm-project:mainfrom
Fangzhou-Ai:afz/dsv4-gfx950-sparse-decode-reducer

Conversation

@Fangzhou-Ai

Copy link
Copy Markdown
Collaborator

Summary

The split-K sparse decode reducer currently processes 16 heads per workgroup,
which keeps a [16, COMB_DIM] FP32 accumulator in each workgroup and limits
workgroup-level parallelism.

This change processes one head per reducer workgroup. It lowers per-workgroup
accumulator/register pressure and exposes up to 16 times more independent
workgroups while preserving the per-head reduction math and ordering.

On current upstream, this changes only the gfx950 split-K decode path. gfx942
remains on the fallback path and requires separate correctness, accuracy, and
performance verification. If #46275 broadens the split-K path to gfx942, this
reducer geometry must be validated there or separately gated before combining
the changes.

Duplicate-work check

I searched the open vLLM PRs using DSV4, sparse decode, split-K reduction,
reducer, and gfx950-related keywords and did not find another PR implementing
this reducer launch-geometry change.

The closest related work is:

There is no linked issue for this focused performance change.

Performance

The reference results come from the official InferenceX MI355X TP8
sweep

using vllm-openai-rocm:nightly-09663ab. Candidate results use upstream main
3034c8d38 plus this change at 5d955f1fc, with the same InferenceX workload
and serving recipe.

Both runs use 8 x MI355X/gfx950, TP8, DeepSeek-V4-Pro, FP8 KV cache, async
scheduling, disabled prefix caching, randomized 8K/1K requests with range ratio
0.8, 2 x CONC warmups, and 10 x CONC measured requests. Other scheduler and
model limits use vLLM defaults.

Because the reference and candidate use different vLLM revisions and separate
runs, these are directional end-to-end comparisons rather than an isolated
same-build A/B measurement of this patch.

CONC Output tok/s (reference -> change) Delta Mean TPOT ms (reference -> change) Improvement Mean TTFT ms (reference -> change) Improvement
4 143.56 -> 149.78 +4.34% 26.41 -> 25.40 3.82% 738.32 -> 613.71 16.88%
16 431.65 -> 452.40 +4.81% 34.75 -> 33.17 4.54% 1034.67 -> 932.43 9.88%
64 888.84 -> 926.45 +4.23% 68.28 -> 65.50 4.06% 2263.22 -> 2154.13 4.82%

Positive output delta means higher throughput; positive latency improvement
means lower latency.

Accuracy

Full GSM8K evaluation on this change (1,319 examples):

Metric This change
Strict match 1262/1319 (95.679%)
Flexible extract 1261/1319 (95.603%)

Both results exceed the required 94% threshold.

Tests

HIP_VISIBLE_DEVICES=0 .venv/bin/python -m pytest \
  tests/kernels/attention/test_rocm_triton_attn_dsv4.py -q

Result: 40 passed.

.venv/bin/pre-commit run --from-ref upstream/main --to-ref HEAD

Result: all hooks passed.

AI assistance

AI assistance was used for implementation support, validation orchestration,
and drafting this PR. This Draft is intended for human inspection. Before
marking it ready for review, the human submitter will review every changed line,
confirm the reported results, and take responsibility for understanding and
defending the change.

Use one local head per split-K reduce workgroup to raise reducer occupancy on gfx950 while preserving the existing per-head reduction order.

Co-authored-by: OpenAI Codex <noreply@openai.com>

Signed-off-by: fai <fangzhouai@gmail.com>
@Fangzhou-Ai
Fangzhou-Ai marked this pull request as ready for review July 15, 2026 21:20

@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 rocm Related to AMD ROCm v1 labels Jul 15, 2026
@github-project-automation github-project-automation Bot moved this to Todo in AMD Jul 15, 2026
num_warps=4,
)

_sparse_attn_decode_reduce_kernel[(num_queries, heads_blocks)](

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

for simplicity, can you guard this change with _ON_GFX950 ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Hi @tjtanaa the whole decode path for this kernel is gated for gfx950 only, that's why I don't gate it here. Please let me know if you still want an extra gate here.

@tjtanaa tjtanaa added the ready ONLY add when PR is ready to merge/full CI is needed label Jul 15, 2026
@Fangzhou-Ai

Copy link
Copy Markdown
Collaborator Author

@shen-shanshan Can you help us to verify this PR on MI300X nodes (or GPUs with the same archοΌ‰? CC @tjtanaa

@shen-shanshan

Copy link
Copy Markdown
Member

@shen-shanshan Can you help us to verify this PR on MI300X nodes (or GPUs with the same archοΌ‰? CC @tjtanaa

OK.

Comment on lines 2100 to 2135
if not _ON_GFX950: # Fallback path for un-tuned architectures.
block_k = 16 if head_dim >= 256 else 32
_sparse_attn_decode_ragged_kernel[(num_queries, heads_blocks)](
q,
main_cache,
main_indices,
main_indptr,
extra_cache,
extra_indices,
extra_indptr,
attn_sink,
out,
q.stride(0),
q.stride(1),
out.stride(0),
out.stride(1),
main_cache.stride(0),
extra_cache.stride(0),
main_cache.shape[0] * main_cache.shape[1],
extra_cache.shape[0] * extra_cache.shape[1],
main_cache.shape[1],
extra_cache.shape[1],
scale,
num_heads,
HAS_ATTN_SINK=has_attn_sink,
HAS_EXTRA=has_extra,
NOPE_DIM=nope_head_dim,
NOPE_BLOCK=nope_block,
ROPE_DIM=rope_head_dim,
IS_FNUZ_MAIN=is_fnuz,
IS_FNUZ_EXTRA=False,
BLOCK_H=block_h,
BLOCK_K=block_k,
num_warps=8,
)
return out

@shen-shanshan shen-shanshan Jul 17, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I have evaluated bypassing the original kernel on MI300X GPU and its performance can also benefit from the two new kernels. CC @Fangzhou-Ai @tjtanaa


Acc:

Full GSM8K evaluation on this change (1,319 examples):

Tasks Version Filter n-shot Metric Value Stderr
gsm8k 3 flexible-extract 5 exact_match ↑ 0.9598 Β± 0.0054
strict-match 5 exact_match ↑ 0.9606 Β± 0.0054

Both results exceed the required 94% threshold.


Perf Comparison:

Conc Throughput (tok/s) Mean TPOT (ms) Mean TTFT (ms)
04 60.71 -> 83.45 (37.46%↑) 62.76 -> 45.42 (27.63%↓) 1391.39 -> 1274.60 (8.39%↓)
16 183.48 -> 228.39 (24.48%↑) 82.04 -> 65.74 (19.87%↓) 2093.63 -> 2022.59 (3.39%↓)
64 386.58 -> 426.57 (10.34%↑) 157.07 -> 142.32 (9.39%↓) 5008.96 -> 4906.74 (2.04%↓)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

hi @shen-shanshan Thank you for the data, it is very insightful.

@tjtanaa
tjtanaa merged commit efed8a1 into vllm-project:main Jul 17, 2026
11 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in AMD Jul 17, 2026
michael-gpu pushed a commit to practical-inference/vllm-ampere-extended that referenced this pull request Oct 20, 2026
lengrongfu pushed a commit to lengrongfu/vllm that referenced this pull request Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready ONLY add when PR is ready to merge/full CI is needed rocm Related to AMD ROCm v1

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants