Skip to content

gfx1201 (RDNA4) SageAttention attention backend: aiter package or Hub kernel? #15014

Open

Description

@Shan2L

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:

  • SAGE and SAGE_HUB are 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:

  1. AITER_SAGE, using the aiter package. The backend imports aiter and calls the op. It is a small diffusers change, but it adds back an optional aiter dependency and needs an aiter release that contains [HIP] [JIT] [Build] gfx1201: SageAttention forward (INT8 QK, FP8 PV) ROCm/aiter#6390.
  2. AITER_SAGE_HUB, a Hub kernel. We publish the kernel as a kernels package. Like kernels-community/aiter-flash-attn, it would be a universal torch-rocm build: precompiled gfx1201 code objects plus a small Python loader registered as a torch custom op. diffusers would only add a _HubKernelConfig entry and the backend function. This does not depend on an aiter release. The open question is which Hub repo it should live in.
  3. A ROCm variant of kernels-community/sage-attention, so the existing SAGE_HUB works unchanged. Its sageattn would 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_backend or 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

  1. sayakpaul commented on Oct 12, 2026

    @sayakpaul
    Member

    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.

  2. Shan2L commented on Oct 12, 2026

    @Shan2L
    Author

    Thanks @sayakpaul, that works for us.

    Plan:

    1. Package the gfx1201 Sage kernels as a Hub kernel, following kernels-community/aiter-flash-attn-ck: vendor the HIP sources from ROCm/aiter (INT8 Q/K + FP8 V quantization, and the attention kernel), build for gfx1201, and expose a sageattn-style entry point.
    2. Add the diffusers attention backend on top of that Hub kernel, as proposed here.

    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.

  3. Abdennacer-Badaoui commented on Oct 12, 2026

    @Abdennacer-Badaoui
    Member

    Thanks, @Shan2L ! Yes, sure.

  4. Shan2L commented on Oct 13, 2026

    @Shan2L
    Author

    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.

    • The package (aiter-sage-attention, laid out like aiter-flash-attn-ck) builds for gfx1201 and passes its tests. Its outputs are bit-identical to aiter's build of the same commit.
    • It exposes a sageattn(q, k, v, tensor_layout, is_causal, sm_scale, return_lse) entry point, so the diffusers backend can follow _sage_attention_hub.
    • In diffusers, a local aiter_sage_hub backend 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.
    • kernels-community asks new contributors to start with an issue, so I've opened one: aiter-sage-attention: SageAttention for AMD RDNA4 (gfx1201) kernels-community#1222. @Abdennacer-Badaoui, if you have time, that might be a good place to discuss the build.

    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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions