Repository navigation
Studio: an aiter attention pick on ROCm runs the auto pick when diffusers has no local aiter backend - #18924
Merged
Conversation
…e on ROCm diffusers 0.41+ (Studio pins 0.42.1) removed the local aiter attention backend and only ships aiter_fa2_hub, a hub-downloaded kernel. Studio still mapped attention_backend=aiter to the dead name, so set_attention_backend raised and every ROCm load silently fell to native SDPA, ~20% slower than the default flash pick on gfx1151 (FLUX.3 klein 1024^2: 1.70 vs 1.40 s/step). On ROCm, aiter now resolves to Studio's auto pick when diffusers has no usable local aiter backend, and the status reports fell_back with the reason. Where the local backend is usable (diffusers 0.36 with aiter installed) the pick is honored as before; off ROCm it stays unsupported. Every other alias is unchanged (frozen table test).
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Member
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
danielhanchen
added a commit
that referenced
this pull request
Nov 22, 2026
… since #18924 (#18942) ## Summary `Backend tests` (the `(Python 3.13, rest)` shard) is red on `main` since #18924: ``` tests/test_xformers_stub_diffusion_parity.py:407: in test_xformers_is_never_selected_on_a_rocm_target E AssertionError: assert None == 'aiter' ``` Both ROCm wheel parametrizations fail. It shows on unrelated PRs, for example the staging run for #18737, which only touches translate files. #18924 made an explicit `aiter` pick on ROCm run the auto pick when diffusers has no usable local aiter backend (`_diffusers_aiter_usable()`), so the pick no longer fails mid-render. That change is correct. #18924 patched `_diffusers_aiter_usable` in its own tests, but this older parity test still asserted that `aiter` is always honoured on a ROCm target. On a runner whose diffusers has no local aiter backend, which is every CI runner, that is no longer true. ## Fix The test now pins both outcomes explicitly instead of depending on the runner's diffusers: - With `_diffusers_aiter_usable` returning True, an `aiter` pick on ROCm is still `aiter`. - With it returning False, an `aiter` pick resolves to the same backend as `auto`. The xformers assertions the test exists for are unchanged. Only the test changes. ## Testing - `tests/test_xformers_stub_diffusion_parity.py`: 2 failed on `main`, all pass with this change. - The file plus `tests/test_diffusion_attention.py` and `tests/test_diffusion_attention_aiter_alias.py`: 193 passed. - Sabotage: with #18924's fallback (`if alias == "aiter" and _is_cuda_rocm(target) and not _diffusers_aiter_usable(): alias = ATTN_AUTO`) removed, the new no-aiter assertion fails for both ROCm wheels, alongside #18924's own `test_dead_aiter_on_rocm_is_the_auto_pick` cases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Picking
attention_backend=aiteron an AMD ROCm GPU silently ran native SDPA, which is slower than the default pick.diffusers 0.41 removed the local
aiterattention backend. Onlyaiter_fa2_hubis left, and that one downloads its kernel from the Hub. Studio pins 0.42.1 (0.41.0 on Python 3.10) but still mappedaiterto the old name.set_attention_backend("aiter")raised, and the load fell back to native SDPA. On gfx1151 (Radeon 8060S) with FLUX.3 klein bf16 at 1024x1024, that was 1.70 s/step against 1.40 s/step for the default flash pick. Every cell of the AITER arm reportednative (requested aiter, fell_back).Change
_diffusers_aiter_usable()returns True only when the installed diffusers has anaiterentry inAttentionBackendNameand its_CAN_USE_AITER_ATTNcheck passes. It never raises.select_attention_backend: on ROCm, anaiterrequest where that check fails becomes Studio's auto pick. This is the same rewriteunsloth_int8already gets. In practice it gives verified ROCm flash when the speed profile allows it, otherwise native, exactly whatautoreturns. Studio does not fetch the hub kernel.explicit_attention_decline: for that case the status readsfell_backand says why, so the reported state stays accurate.aiteris honored as before. Off ROCm (NVIDIA, MPS, CPU) it is stillunsupported, the same as other platform-gated picks.attention_backend=aiter. The request field descriptions now say whenaitercan engage.The Images and Video pages do not offer
aiter(their selector lists auto / native / cudnn / flash3 / sage), so nothing changes in the UI. Only API requests can send it.Tests
tests/test_diffusion_attention_aiter_alias.py(CPU, hermetic):aiterwith a hub-only diffusers equals theautopick for every speed state and flash-verified state. Fails on main, where it returnsaiter.fell_backwith the reason. Fails on main.aiteris stillunsupported. Passes on both.Against the real diffusers 0.42.1 package,
_diffusers_aiter_usable()is False and ROCmaiterresolves to the flash candidate (main:aiter, which diffusers rejects).tests/test_diffusion_attention*.py: 541 passed, 2 skipped.