Repository navigation
[ROCm][Perf][DSV4] Improve sparse decode reduction occupancy on gfx950 - #48788
Conversation
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>
| num_warps=4, | ||
| ) | ||
|
|
||
| _sparse_attn_decode_reduce_kernel[(num_queries, heads_blocks)]( |
There was a problem hiding this comment.
for simplicity, can you guard this change with _ON_GFX950 ?
There was a problem hiding this comment.
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.
|
@shen-shanshan Can you help us to verify this PR on MI300X nodes οΌor GPUs with the same archοΌ? CC @tjtanaa |
OK. |
| 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 |
There was a problem hiding this comment.
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%β) |
There was a problem hiding this comment.
hi @shen-shanshan Thank you for the data, it is very insightful.
vllm-project#48788) Signed-off-by: fai <fangzhouai@gmail.com>
vllm-project#48788) Signed-off-by: fai <fangzhouai@gmail.com>
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 limitsworkgroup-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:
optimize the reducer geometry.
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 main3034c8d38plus this change at5d955f1fc, with the same InferenceX workloadand 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.
Positive output delta means higher throughput; positive latency improvement
means lower latency.
Accuracy
Full GSM8K evaluation on this change (1,319 examples):
Both results exceed the required 94% threshold.
Tests
Result:
40 passed.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.