github.devotd.
NewInference & serving

ixmxamar/sageattention-rdna4 v0.4.0 — Quantized Attention Kernels for RDNA4

A HIP attention kernel repository for AMD RX 9070/9070 XT, where v0.4.0 also hand-writes the quantization stage, removing the compile step on first use.

Repositoryixmxamar/sageattention-rdna4 ↗

Quantized attention for AMD RX 9070 / 9070 XT (RDNA4, gfx1201): a hand-written HIP attention kernel behind SageAttention, serving the fused q/k/v views video models send, at 0.87-0.94x PR #368's time over production sizes.

stars
★ 13
Forks
1
Language
Python
License
Apache-2.0
Latest release
v0.4.0
Read original source ↗View on GitHub ↗

ixmxamar/sageattention-rdna4 is a quantized attention package that runs on AMD RX 9070 and 9070 XT (RDNA4, gfx1201). It layers hand-written HIP kernels on top of SageAttention 2.2 and the gfx12 port in PR #368. In v0.4.0 the quantization stage is hand-written as well, so first use no longer compiles. The short call segments that were up to 1.6x slower in earlier versions are now on a comparable level.

This repository quantizes Q and K with per-token scales and computes in int8. With block-wise scales a single outlier can inflate the error of the whole block, while token-wise scaling is a way to reduce the paths where such errors occur. According to the README, at head_dim 128 it is 1.5–2.0x faster than PR #368 for causal attention and 1.06–1.3x faster for non-causal attention. It reports that in layers with outlier keys, the error of token-wise scaling was up to 200x lower than that of block-wise scaling.

That said, the target is limited to the RX 9070 and 9070 XT. In ComfyUI rendering, per-step time at one megapixel dropped from 1.029s to 0.973s, and the portion of the attention speedup that carries over to total step time is 5–14 percent. So it is hard to take the improvement of the attention kernel itself as an improvement in the render as a whole.