Repository navigation
gfx1201 (RDNA4) SageAttention attention backend: aiter package or Hub kernel? #15014
Description
Is your feature request related to a problem? Please describe.
On AMD Radeon RDNA4 GPUs (gfx1201: Radeon AI PRO R9700 / R9600D, RX 9070 series), diffusers has no quantized attention backend:
SAGEandSAGE_HUBare CUDA builds.- The ROCm Hub FlashAttention kernel (
kernels-community/aiter-flash-attn) ships tuning configs for gfx942 / gfx950 / gfx1250 only.
So these GPUs use native SDPA.
aiter has a SageAttention kernel for gfx1201: aiter.gfx1201_sage_attention(q, k, v, softmax_scale), ROCm/aiter#6390 (under review).
- INT8 QK^T and FP8 PV with FP32 accumulation; Q/K are quantized per 32-row block and V per channel inside the kernel.
- Inputs: BF16
[B, S, H, 128], Q/K/V of equal shape, no mask, non-causal.
MiniMax-H3 in diffusers matches that contract exactly. MiniMaxH3AttnProcessor passes no mask, the attention is self-attention with head dim 128, and the input is BF16. The same applies to the token refiner.
For reference, the same kernel as an opt-in vLLM-Omni backend (vllm-project/vllm-omni#8792, draft) on MiniMax-H3 T2VA: 2 x R9700 TP2, 1344x768, 4 s, 8 steps.
| Backend | Denoise per step | Request latency | Video PSNR vs SDPA |
|---|---|---|---|
| SDPA | 20.9 s | 186 s | reference |
| gfx1201 SageAttention | 11.3 s | 109 s | 33.9 dB |
Describe the solution you'd like.
An opt-in diffusers attention backend for gfx1201 SageAttention. It would never be selected by default, and it would reject unsupported inputs (masks, causal, head dim other than 128, unequal Q/K/V shapes) with a clear error.
It would support Ulysses context parallelism (inference only, no LSE needed), so MiniMax-H3 can run with its existing _cp_plan on 2+ GPUs.
Before writing it, I'd like to check which delivery you prefer, given that #14436 moved ROCm FlashAttention from the aiter pip package to a Hub kernel:
AITER_SAGE, using theaiterpackage. The backend importsaiterand calls the op. It is a small diffusers change, but it adds back an optionalaiterdependency and needs an aiter release that contains [HIP] [JIT] [Build] gfx1201: SageAttention forward (INT8 QK, FP8 PV) ROCm/aiter#6390.AITER_SAGE_HUB, a Hub kernel. We publish the kernel as akernelspackage. Likekernels-community/aiter-flash-attn, it would be a universaltorch-rocmbuild: precompiled gfx1201 code objects plus a small Python loader registered as a torch custom op. diffusers would only add a_HubKernelConfigentry and the backend function. This does not depend on an aiter release. The open question is which Hub repo it should live in.- A ROCm variant of
kernels-community/sage-attention, so the existingSAGE_HUBworks unchanged. Itssageattnwould route gfx1201 inputs it supports to this kernel and the rest to SDPA.
Describe alternatives you've considered.
- Keep SDPA on gfx1201. That leaves about 1.8x on MiniMax-H3 attention unused.
- A custom attention processor in user code. It works, but every model needs its own processor, and it does not compose with
set_attention_backendor context parallelism.
Additional context.
I can implement whichever option you prefer, with tests and a MiniMax-H3 end-to-end comparison against SDPA on 2 x R9700 using Ulysses CP. A sparse variant (Sol-Attn, ROCm/aiter#6292) also exists. Following the note in attention_dispatch.py about per-model-tuned sparse methods, I am not proposing it here.
cc @sayakpaul
AI assistance: this proposal was drafted with the help of an AI coding assistant (GitHub Copilot). The numbers above were measured on the listed hardware.
Activity
sayakpaul commentedon Oct 12, 2026
Thanks for the proposal! Would it be possible to package the AITER Sage kernel with the Kernels project (similar to how SAGE and other attention backends like FA3 are listed here)?
Once we have that I think we could add the attention backend as you're proposing here. @Abdennacer-Badaoui could help further with the build I think.
Shan2L commentedon Oct 12, 2026
Thanks @sayakpaul, that works for us.
Plan:
kernels-community/aiter-flash-attn-ck: vendor the HIP sources from ROCm/aiter (INT8 Q/K + FP8 V quantization, and the attention kernel), build forgfx1201, and expose asageattn-style entry point.The kernels are still under review in ROCm/aiter (ROCm/aiter#6390). I'd like to vendor a reviewed aiter commit, so I'll open the Kernels PR once that lands and follow up here. @Abdennacer-Badaoui, I'll ping you on that PR for the build setup.
Abdennacer-Badaoui commentedon Oct 12, 2026
Thanks, @Shan2L ! Yes, sure.
Shan2L commentedon Oct 13, 2026
A quick update: the aiter review (ROCm/aiter#6390) is taking a bit longer than I expected, so I've gone ahead and started the Kernels package from that PR's current commit rather than waiting. I hope that's okay.
aiter-sage-attention, laid out likeaiter-flash-attn-ck) builds for gfx1201 and passes its tests. Its outputs are bit-identical to aiter's build of the same commit.sageattn(q, k, v, tensor_layout, is_causal, sm_scale, return_lse)entry point, so the diffusers backend can follow_sage_attention_hub.aiter_sage_hubbackend runs MiniMax-H3 text-to-video+audio end to end on one R9700 (960x544, 124 frames, 9 steps). Each transformer call took 12.0 s instead of 16.5 s with the native backend, and the output looks the same (26.1 dB video PSNR to native). The VAE's attention uses head dim 64, so the backend sends calls the kernel can't take to SDPA.I'll re-sync the vendored sources once the aiter PR is merged, and open the diffusers backend PR (as a draft) once the Hub kernel is available. Thanks again for the guidance!