[AMD] Enable InThreadTranspose pass for RDNA3 / RDNA3.5 (gfx110x/115x)#10390
Merged
Conversation
7 tasks
`InThreadTranspose` rewrites `tt.load -> ttg.local_alloc -> ttg.local_load -> dot_op` so the K-contiguous WMMA/MFMA operand can be read from LDS as wide `ds_load_b128` instead of scalar `ds_load_u16` pairs when the load order doesn't match the consumer's K dimension. The pattern matcher in `matchInThreadTransposePattern` already accepts `AMDWmmaEncodingAttr` alongside `AMDMfmaEncodingAttr`, but the gate in `is_in_thread_transpose_enabled` only activates the pass on gfx942 (CDNA3) and gfx120x (RDNA4). Extend it to also cover RDNA3 (gfx110x/gfx1103) and RDNA3.5 (gfx115x). On AITER's `flash_attn_2.varlen_fwd` at the Qwen3-Omni ViT prefill shape (B=1, S=3200, H=16, head_dim=72, fp16) on gfx1151, this lifts the inner-loop V `local_load` from 512 scalar `ds_load_u16(_d16_hi)` to 144 vectorized `ds_load_b128` and gives a 3.8% median speedup (3.042 -> 2.925 ms) on top of triton-lang/triton:main.
edb28da to
42e9629
Compare
antiagainst
approved these changes
May 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
InThreadTransposerewritestt.load -> ttg.local_alloc -> ttg.local_load -> dot_opso the K-contiguous WMMA/MFMA operand can beread from LDS as wide
ds_load_b128instead of scalards_load_u16pairs when the load order doesn't match the consumer's K dimension.
The pattern matcher in
matchInThreadTransposePatternalready acceptsAMDWmmaEncodingAttralongsideAMDMfmaEncodingAttr, but the gate inis_in_thread_transpose_enabledonly activates the pass on gfx942(CDNA3) and gfx120x (RDNA4, enabled in #10185). Extend it to also
cover RDNA3 (gfx110x/gfx1103) and RDNA3.5 (gfx115x).
Added a
inThreadTranspose_wmmasub-test totest/TritonGPU/amd/in-thread-transpose.mlir(gfx1151, wave32, WMMAencoding) that verifies the pass produces an
amdg.in_thread_transposeop and that the downstream
ttg.local_loadreturns the K-contiguousdot_oplayout (kWidth = 16).On AITER's
flash_attn_2.varlen_fwdat the Qwen3-Omni ViT prefillshape (B=1, S=3200, H=16, head_dim=72, fp16) on gfx1151, this lifts
the inner-loop V
local_loadfrom 512 scalards_load_u16(_d16_hi)to 144 vectorized
ds_load_b128and gives a 3.8% median speedup(3.042 -> 2.925 ms). Stacked with #10389 (D8 int
specialization), the same kernel reaches 2.376 ms (-21.9% vs
main).New contributor declaration
I am not making a trivial change, such as fixing a typo in a comment.
I have written a PR description following these
rules.
I have run
pre-commit run --from-ref origin/main --to-ref HEAD.Select one of the following.
/test/TritonGPU/amd/in-thread-transpose.mlir(lit)FILL THIS IN.Select one of the following.
littests.littests I have added follow these best practices,including the "tests should be minimal" section.