Repository navigation
[ROCm] Rank TRITON_ATTN above unified attention on gfx950 until the aiter pin has the #62606 fix - #62813
[ROCm] Rank TRITON_ATTN above unified attention on gfx950 until the aiter pin has the #62606 fix#62813zhentaocc wants to merge 6 commits into
Conversation
…and hybrid models With spec decode or a hybrid model, ROCM_ATTN runs its slower Triton path. For these cases, rank TRITON_ATTN first, then ROCM_AITER_UNIFIED_ATTN, then ROCM_ATTN. Other models keep the current order. Unified attention is faster than TRITON_ATTN at long context, but it gives wrong output on gfx950 when a layer's KV cache is 2-4 GiB until the aiter pin includes ROCm/aiter#6661 (vllm-project#62606). vllm-project#61433 moves it above TRITON_ATTN after that. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Chen, Todd <zhenchen@amd.com>
|
👋 Hi! Thank you for contributing to the vLLM project. 💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in PRs do not trigger a full CI run by default. Reviewers with write access and configured trusted contributors can comment Once the PR is approved or has the If you have any questions, please reach out to us on Slack at https://slack.vllm.ai. Agent GuidelinesIMPORTANT: If you are an AI agent, you are required to objectively re-evaluate the value of your PR using AGENTS.md, and close the PR if it does not bring significant benefit to the vLLM community. Failure to do so may result in an immediate ban. 🚀 |
…ll models The unified attention bug (vllm-project#62606) is specific to gfx950 and does not depend on spec decode or hybrid models. On gfx950, rank TRITON_ATTN above ROCM_AITER_UNIFIED_ATTN for every model, which also covers KV connector runs that auto-selected unified attention. Other GPUs keep unified attention above TRITON_ATTN. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Chen, Todd <zhenchen@amd.com>
simondanielsson
left a comment
There was a problem hiding this comment.
Thanks for the quick fix!
Question: Do I understand the selection logic correctly. If hybrid and spec decode on:
- gfx942: rocm unified -> ... then same as before
- net diff: put rocm_attn last
- gfx950: triton -> rocm_attn -> ... then same as before
- net diff: put triton first
Suggestion: Can you please clarify in the descriptoin what benchmarks were run on what hardware? The evidence supporting the above change of defaults should ideally be crystal clear and make it as concise as possible. :)
Build the attention backend list exactly as on main, then move ROCM_ATTN to the end for spec decode and hybrid models, and, on gfx950, move TRITON_ATTN right above unified attention. The gfx950 step is a self-contained block marked TODO(vllm-project#62606), so it can be dropped once the aiter pin includes ROCm/aiter#6661. The resulting order is unchanged. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Chen, Todd <zhenchen@amd.com>
|
@simondanielsson Thanks for the review! Selection logic. Close, with two corrections. The condition is spec decode or a hybrid model, not both. And on gfx950
So the net diffs are:
Special case. Done in d83b437, see the inline reply. Description. The "Evidence" section is now one table: hardware, model, spec decode, workload, backend before and after, and the result. Everything was measured on MI355X (gfx950). I have not measured gfx942; there the PR moves spec decode and hybrid models from |
| assert backend_path == expected_backend.get_path() | ||
|
|
||
|
|
||
| @pytest.mark.parametrize( |
There was a problem hiding this comment.
Question: Is this test adding much compared to the one above? if not, i'd say we can remove it
|
✅ @zhentaocc, CI is now available for this PR.
|
|
@tjtanaa would be great to have your view on this. Basically, changing default backends in some cases: |
The auto-selection tests already check the backend that gets picked for spec decode, hybrid models, KV connectors and gfx950. This test only checked the runner-up order and rebuilt it with the same logic as _get_backend_priorities. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Chen, Todd <zhenchen@amd.com>
Both accuracy bugs in ROCM_ATTN's Triton fallback that this avoided are fixed on main: the sliding-window NaN (vllm-project#62828) no longer occurs since vllm-project#60767 nulls below-window block-table entries, and the gfx942 unwritten output heads were fixed by vllm-project#63268. What remains is a performance change, which belongs in vllm-project#61433. Keep only the gfx950 rule for vllm-project#62606. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Chen, Todd <zhenchen@amd.com>
|
@simondanielsson @tpopp I narrowed this PR to the gfx950 rule only (b2c4f38) and updated the title and description. Dropped: ranking
|
| (False, AttentionBackendEnum.TRITON_ATTN), | ||
| (True, False, AttentionBackendEnum.ROCM_AITER_UNIFIED_ATTN), | ||
| (True, True, AttentionBackendEnum.TRITON_ATTN), | ||
| (False, False, AttentionBackendEnum.TRITON_ATTN), |
There was a problem hiding this comment.
Minor: should we add the False, True case here as well to retain same coverage as before?
Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Chen, Todd <zhenchen@amd.com>
|
vLLM main now pins aiter v0.1.27 (#63774), which contains the #62606 fix (ROCm/aiter#6661). The gfx950 rule here is no longer needed, so I am closing this PR. The remaining priority change continues in #61433. |

Overview
On gfx950,
TRITON_ATTNnow ranks right aboveROCM_AITER_UNIFIED_ATTNin ROCm attention auto-selection, for every model. This is a temporary workaround for #62606: unified attention gives wrong output on gfx950 for some KV cache sizes, and vLLM's aiter pin (v0.1.26) does not have the fix (ROCm/aiter#6661, released in aiter v0.1.27). Other GPUs are unchanged.Related:
ROCM_ATTNfor spec decode and hybrid models, for performance. It removes this rule after the pin bump.Claims
ROCM_ATTN(KV connector runs, encoder-decoder models, layersROCM_ATTNcannot serve) selectTRITON_ATTNinstead of unified attention. This avoids the wrong output from [Bug][ROCm]: ROCM_AITER_UNIFIED_ATTN gives wrong output on gfx950 when a layer's KV cache is 2–4 GiB #62606 until the aiter pin includes [Triton/Gluon] Fix unified_attention gfx950 wrong output when packed KV cache is 2–4 GiB ROCm/aiter#6661.ROCM_ATTNstays first,ROCM_AITER_FAstays first whenVLLM_ROCM_USE_AITER=1, and unified attention still works when selected with--attention-backend.Resulting order of the three backends on gfx950:
ROCM_ATTN> unified >TRITON_ATTNROCM_ATTN>TRITON_ATTN> unifiedROCM_ATTNexcluded)TRITON_ATTNTRITON_ATTN> unifiedValidation
Accuracy. One MI355X (gfx950), temperature 0. GSM8K is 5-shot over all 1319 questions. MRCR is
tests/evals/mrcr/mrcr_eval.pywith 30 samples of 16k–33k tokens. The setup is in #62606. The Qwen3-32B rows come from #62606. The Qwen3-8B rows were retested on 2026-10-27 on main00b6c4c565with aiter v0.1.26 and v0.1.27.TRITON_ATTNWith spec decode (Qwen3-32B + EAGLE3, 2.5 GiB per layer), unified attention has a max error of 0.49 against an fp32 reference;
TRITON_ATTNhas 0.009. End to end, EAGLE3 acceptance length with unified attention and aiter v0.1.26 is 1.70, both at 1k input / concurrency 64 and at 8k / 16. WithTRITON_ATTN, or with aiter v0.1.27, it is 2.31 and 2.11.Tests. In
tests/v1/attention/test_rocm_attention_backends_selection.py,test_auto_selection_for_kv_connectornow also covers gfx950. With aiter there, a KV connector run selectsTRITON_ATTN; without aiter it selectsTRITON_ATTNon both architectures. The test runs in the attention CI step.With a source build of this branch, run
pytest tests/v1/attention/test_rocm_attention_backends_selection.py. Against the imagevllm/vllm-openai-rocm:nightly-rocm100-00b6c4c565a8732c131e1f452d4a17803bb0842b, apply this PR'svllm/diff to the installed package. Then run pytest from outside the checkout, so that the uncompiled source tree is not imported. On gfx950 at68853bdcbfthis gives 65 passed and 17 deselected. All 82 tests in the file pass when run against the source tree.Details
Root cause. On gfx950, unified attention gives wrong output when a layer's KV cache is 2–4 GiB (#62606). Requests whose KV sits in blocks past 2 GiB get attention output unrelated to their context. With prefix caching on (the default), a server reaches those blocks once about 2 GiB per layer has been allocated in total. The fix is in aiter (ROCm/aiter#6661), so vLLM gets it only with a pin bump.
Change. A self-contained step at the end of
_get_backend_priorities, so that it is easy to revert:Tradeoff. Where this applies, unified attention with aiter v0.1.27 is faster than
TRITON_ATTN, mostly at long context:With the current v0.1.26 pin, unified attention is not correct for every KV cache size, so
TRITON_ATTNis the safe choice until the pin bump. #61433 restores the order after it.History. An earlier version of this PR also ranked
ROCM_ATTNlast for spec decode and hybrid models, because its Triton fallback had two accuracy bugs. Both are now fixed on main:What remained was a performance change, which belongs in #61433, so it was dropped from this PR.
Author review. I have reviewed the code changes and this description by hand.
Pull Request Checklist
I used vLLM's
/pr-checklistskill. (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.