Skip to content

Hand-written prologue: faster short calls, no compiler, RX 9060 XT opt-in (v0.4.0)

Latest

Choose a tag to compare

@IxMxAMAR IxMxAMAR released this 17 Oct 08:33

The quantization step in front of the attention kernel is hand-written HIP now. That brings short calls level with PR #368's instead of up to 1.6× slower, takes the Triton compiler off the default path, and removes the sequence-length ceiling.

python -m pip install --no-deps sageattention-2.2.0+amd.gfx12.4-cp312-cp312-win_amd64.whl

Requirements (unchanged): Windows 10/11, Python 3.12, PyTorch 2.13.0+rocm10.0.0, an RX 9070 or RX 9070 XT. Linux runs from source; Linux testing of this release is in #2.

What changed

  • Short calls are faster. A call of a few hundred tokens took up to 1.6× PR #368's time; now it's about even (0.85–1.13, timed one call at a time). Image and video sizes are unchanged.
  • Nothing to compile on first use. In ComfyUI with an empty Triton cache, the first call takes about 0.5 s instead of about 2 s.
  • No length ceiling. v0.3.0 stopped serving around 100 000 tokens at H3's layout; the new prologue uses 64-bit offsets.
  • Same output. Bit-identical to v0.3.0 with smooth_k off. With smooth_k on, the key mean is now summed in fp64, so a small share of outputs differ by rounding, with the same accuracy against exact attention.
  • RX 9060 XT (gfx1200), opt in. Set SAGEATTN_SK1_GFX1200=1. The machine code is byte-identical to the RX 9070 builds, but nobody has run it on a 9060 XT yet. If you have one, docs/GFX1200-TESTING.md takes about 15 minutes.
  • SAGEATTN_SK1_PROLOGUE=triton brings back v0.3.0's prologue if you ever need it.

Worth knowing

  • head_dim 64 still uses PR #368's kernel. A second attempt, on the new prologue, was still slower, so that one needs its own design.
  • PyTorch 2.14 / ROCm 10.1 isn't supported yet: on the current WHQL driver PyTorch 2.14's own kernels don't run. An experimental build is in #3.

Details in CHANGELOG.md and docs/FINDINGS.md (F162–F166).

sha256 0f2055e46a217f8490ab963ed4f8bfc82b669a621f048a7e72df0ff728416504

Re-packaged on 2026-10-19 with the corrected README and credits. The code and binaries are byte-identical to the first upload (sha256 1801413a…5762), so there is no need to reinstall.