Skip to content

[gfx1151] flash_attn_triton_amd: enable in-thread transpose - #1

Closed
mgehre-amd wants to merge 1 commit into
matthias.triton-fa-gfx1151-blockn64from
matthias.gfx1151-enable-itt
Closed

mgehre-amd wants to merge 1 commit into
matthias.triton-fa-gfx1151-blockn64from
matthias.gfx1151-enable-itt

Conversation

@mgehre-amd

Copy link
Copy Markdown
Owner

Stacked on top of ROCm#3419.

Triton 3.7 enables its AMD in-thread-transpose pass only on gfx942 by default
(knobs.amd.use_in_thread_transpose defaults to Nonearch == "gfx942").
Triton main will enable it also on gfx1151 by default. For older triton versions,
this PR enabled it.

Benchmarks

gfx1151, triton 3.6.0, dao_ai fwd_varlen, fp16, causal=False, b1 hq16 hk16.
Min ms over a warm-clock do_bench window (min is robust to the iGPU's DVFS):

shape (sq=sk, d) ITT off ITT on speedup
1024, d72 0.447 0.443 +0.9%
2048, d72 1.299 1.198 +7.8%
3200, d72 2.801 2.479 +11.5%
4096, d72 4.545 4.045 +11.0%
3200, d64 1.660 1.592 +4.1%
3200, d128 3.314 3.096 +6.6%

Win is largest for the ViT-style d=72 long-sequence shapes this kernel targets;
no shape regressed. An explicit TRITON_HIP_USE_IN_THREAD_TRANSPOSE override is
still respected so the pass can be forced on/off for debugging.

Triton only enables its AMD in-thread-transpose pass for gfx1151 by default on
its main branch (the upcoming 3.8); the Triton version in use here still gates
it to gfx942 (use_in_thread_transpose defaults to None -> arch == "gfx942").
On gfx1151 (RDNA3.5) the prefill FMHA kernels are LDS-bound and benefit from it,
so turn it on at kernel import time, gated on arch and on the user not having
set TRITON_HIP_USE_IN_THREAD_TRANSPOSE explicitly.

Measured on gfx1151 with triton 3.6.0, dao_ai fwd_varlen, fp16, causal=False,
b1 hq16 hk16 (min ms over a warm-clock do_bench window):

  shape (sq=sk, d)   ITT off    ITT on    speedup
  1024,  d72          0.447      0.443      +0.9%
  2048,  d72          1.299      1.198      +7.8%
  3200,  d72          2.801      2.479     +11.5%
  4096,  d72          4.545      4.045     +11.0%
  3200,  d64          1.660      1.592      +4.1%
  3200,  d128         3.314      3.096      +6.6%

Changes:
- Win is largest for the ViT-style d=72, long-sequence shapes this kernel
  targets; no shape regressed.
- Respects an explicit TRITON_HIP_USE_IN_THREAD_TRANSPOSE override so the
  pass can still be forced on/off for debugging.
@mgehre-amd mgehre-amd closed this Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant