Repository navigation
[Triton/Gluon] [gfx1250] unified attention: 128-token tile for 8-heads-per-KV bf16 prefill - #7348
Merged
Boss2002n merged 1 commit intoNov 3, 2026
Conversation
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.
Motivation: DP4 prefill of Qwen3.5-35B-A3B on gfx1250 (16 query / 2 KV heads, head size 256, shuffled bf16 paged
cache) spends about 39% of a heavy prefill step in the unified-attention 2D kernel. The kernel runs at about 44% of
the bf16 peak with a 64-token tile.
Technical details: stacked on #7100 (config only). For 8 query heads per KV head, bf16, head size >= 256, and a
context of 2048 tokens or more, prefill (17+ query rows) now uses a 128-token tile (two 64-token pages through TDM),
BLOCK_M 128, 4 warps, loop variant 0, 2 buffers: the config that the 4-heads-per-KV entry already uses. Short
contexts (
SKLT, under 2048 tokens) and query lengths up to 16 keep #7100's config; decode, verify, TP4 and fp8entries are unchanged.
Test plan: a config sweep (45 variants: tile 64/128/256, BLOCK_M 64/128/256, loop variant, warps, buffers,
waves) on mixes taken from a c1024 trace (about 16k new tokens over 3-34 requests, 30-135k context), then an
alternating A/B on 4 GPUs; the new path against
ref_paged_attn(fp32); the lookup for each case;test_unified_attention.py(head 256, Gluon, bf16) and the gfx1250 spec-verify tests.Test results (MI455X):
Time, new / default (the generic
D_GEQ_256.DT_bf16_bf16entry), 5 alternating rounds on each of 4 GPUs:For example 5,729 -> 5,282 us (1,735 -> 1,882 TFLOPS). [Triton/Gluon] [GFX12] Add SPEC_DECODE mode to UA with tunned Qwen35 config #7100's current
G_EQ_8.Q_LEQ_1536prefill configmeasured 0.986-1.073 of the same default on these mixes (3 rounds, 2 GPUs), so this entry is about 9-12% faster
than it. On short contexts (8 x 2000-token fresh prompts) [Triton/Gluon] [GFX12] Add SPEC_DECODE mode to UA with tunned Qwen35 config #7100's config is 0.95-0.97 of the default, so it stays
there.
256-token tiles need 512 KB of LDS (320 KB available); loop variants 1/2 with the 128 tile were 2.6-3.3x slower.
Accuracy against fp32
ref_paged_attn: max error 0.00062 / 0.00125 / 0.0156 (three cases), the same as the64-token tile.
Tests: 40 passed, 40 skipped (head 256, Gluon, bf16, 8 query / 1 KV head), 160 passed (spec verify, head 256).
Expected in the model: about 3.4 ms of a heavy (16k-token) DP prefill step. No end-to-end run yet.