Skip to content

[Triton/Gluon] [gfx1250] unified attention: 128-token tile for 8-heads-per-KV bf16 prefill - #7348

Merged
Boss2002n merged 1 commit into
shaoclee/bench_ua_permfrom
satya/ua_gfx1250_g8_prefill_tile128
Nov 3, 2026
Merged

Boss2002n merged 1 commit into
shaoclee/bench_ua_permfrom
satya/ua_gfx1250_g8_prefill_tile128

Conversation

@Boss2002n

Copy link
Copy Markdown
Contributor

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 fp8
entries 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_bf16 entry), 5 alternating rounds on each of 4 GPUs:

    Mix GPU 0 GPU 1 GPU 2 GPU 3
    17 requests, 33-40k context 0.922 0.932 0.934 0.941
    18 requests, one at 135k 0.933 0.937 0.939 0.939
    3 requests, one 12k new prompt 0.933 0.935 0.934 0.937
    34 requests, 30-40k context 0.932 0.940 0.938 0.939

    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_1536 prefill config
    measured 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 the
    64-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.

@Boss2002n Boss2002n self-assigned this Nov 3, 2026
@Boss2002n
Boss2002n marked this pull request as ready for review November 3, 2026 00:56
@Boss2002n
Boss2002n merged commit 93d5684 into shaoclee/bench_ua_perm Nov 3, 2026
@Boss2002n
Boss2002n deleted the satya/ua_gfx1250_g8_prefill_tile128 branch November 3, 2026 00:56
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