Repository navigation
[Triton/Gluon] Route short sliding-window queries to the gfx950 split grid - #6594
Conversation
… grid Spec-decode verify batches (q <= 8, kv >= 512, <= 1024 tokens) on sliding-window layers were forced onto the 2D prefill grid. On MI355X with Muse Spark Open DSpark shapes (16/2 heads, D=64, window 2048, kv 8704), the split grid is 1.13-1.91x faster across q=2..8 and batch 1..256; batches above 1024 tokens stay on the 2D grid. Extends test_triton_unified_attn_3d with short-query and sliding-window cases. Co-authored-by: Cursor <[email protected]> Signed-off-by: Hongxia Yang <[email protected]>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
There was a problem hiding this comment.
🟡 Changes recommended
Tests do not assert grid selection at the new dispatch boundaries.
1 open finding
What changed in this PR
Updates gfx950 Gluon unified-attention dispatch to use the split grid for short sliding-window queries.
Changes:
- Enables split routing for q ≤ 8, KV ≥ 512, and total query tokens ≤ 1024.
- Adds short-query and sliding-window output test cases.
| File | Description |
|---|---|
op_tests/triton_tests/attention/test_unified_attention.py |
Extends short-query and sliding-window coverage. |
aiter/ops/triton/attention/unified_attention.py |
Adds bounded sliding-window split routing. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Human review: This PR speeds things up not because actual kv splitting but 3d has a mechanism to combine spec tokens to a degree as they share kv cache. Better to enable spec. decode heuristics by getting 3d spec decode heuristics to 2d as well. Main idea is to adjust block_m for cases where we have few queries but not enough to fill whole BLOCK_M, so we lower it to to match actual workload, this is mainly for spec. decode. I think the ideal situation is to enable actual splitting for such workloads as such large SWA might benefit from actual split (that requires kernel changes). I am fine whichever path you wanna take but enabling 3d without kernel fixes creates footgun. So, in that situation, better to do stick to 2d, with heuristics update for SWA + spec. decode. Claude review: What actually runs: Latent bug if SW is ever split (
Suggestions:
Nits:
|
…k sizing Per review: the speedup came from the 3D launch's query-block sizing (the SW kv_split entry has MAX_SEGMENTS 1, so nothing was split), and routing sliding-window batches to the 3D grid would drop sinks if SW ever split. Restore the upstream routing and instead apply the unsplit 3D BLOCK_M/num_warps sizing (shared via _gfx950_3d_block_m) in the 2D launcher for sliding-window batches with q*heads_per_kv <= 128 and <= 1024 tokens. MI355X, Muse Spark Open DSpark shapes (16/2 heads, D=64, window 2048, kv 8704), vs upstream main: 1.13-1.83x at q=2..8 x batch 1..128, 1.33-1.48x at q=2..4 x batch 256; kv 1024: 1.24-1.31x; kv 256: 1.10-1.13x. Full-attention shapes unchanged (0.99-1.06x). Applying the 3D sizing to all short queries regressed large full-attention batches (to 0.54x at q=8 x 256), hence the sliding-window and token limits. Also fixes the stale 'gfx950 -> Triton' test comment. Co-authored-by: Cursor <[email protected]> Signed-off-by: Hongxia Yang <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
The selection condition exceeds the stated workload, the tuning cutoff belongs in JSON, and boundary selection tests are missing.
6 open issues
Bound launch settings to the documented query and KV length range · New Add cutoff boundary tests for launch-setting selection · New Extend NVFP4 skip guard for long and sliding-window queries Restrict tuning gate to stated query and KV bounds Add boundary tests for gfx950 Gluon dispatch routing Move gfx950 cutoff tuning value into the JSON configuration · New
Review effort: Balanced
Replace the 3D config borrowed by the gfx950 2D launch with config entries.
- unified_attention.py: back to main.
- unified_attention_utils.py: new P axis, 2D programs per CU rounded up to a power of 2.
- gfx950 gluon DEFAULT.json: attn_2d schema adds Q and P; four
D_LEQ_64.Q_LEQ_{2,4,8,16}.P_LEQ_8.SW.DT_bf16_bf16 entries.
Signed-off-by: Giuseppe Grossi <[email protected]>
… grid (#6594) * [Triton/Gluon] Route short sliding-window queries to the gfx950 split grid Spec-decode verify batches (q <= 8, kv >= 512, <= 1024 tokens) on sliding-window layers were forced onto the 2D prefill grid. On MI355X with Muse Spark Open DSpark shapes (16/2 heads, D=64, window 2048, kv 8704), the split grid is 1.13-1.91x faster across q=2..8 and batch 1..256; batches above 1024 tokens stay on the 2D grid. Extends test_triton_unified_attn_3d with short-query and sliding-window cases. Signed-off-by: Hongxia Yang <[email protected]> * [Triton/Gluon] Keep SWA spec-decode on the 2D grid with 3D query-block sizing Per review: the speedup came from the 3D launch's query-block sizing (the SW kv_split entry has MAX_SEGMENTS 1, so nothing was split), and routing sliding-window batches to the 3D grid would drop sinks if SW ever split. Restore the upstream routing and instead apply the unsplit 3D BLOCK_M/num_warps sizing (shared via _gfx950_3d_block_m) in the 2D launcher for sliding-window batches with q*heads_per_kv <= 128 and <= 1024 tokens. MI355X, Muse Spark Open DSpark shapes (16/2 heads, D=64, window 2048, kv 8704), vs upstream main: 1.13-1.83x at q=2..8 x batch 1..128, 1.33-1.48x at q=2..4 x batch 256; kv 1024: 1.24-1.31x; kv 256: 1.10-1.13x. Full-attention shapes unchanged (0.99-1.06x). Applying the 3D sizing to all short queries regressed large full-attention batches (to 0.54x at q=8 x 256), hence the sliding-window and token limits. Also fixes the stale 'gfx950 -> Triton' test comment. Signed-off-by: Hongxia Yang <[email protected]> * [Triton/Gluon] SWA spec-decode attn_2d entries gated on programs per CU Replace the 3D config borrowed by the gfx950 2D launch with config entries. - unified_attention.py: back to main. - unified_attention_utils.py: new P axis, 2D programs per CU rounded up to a power of 2. - gfx950 gluon DEFAULT.json: attn_2d schema adds Q and P; four D_LEQ_64.Q_LEQ_{2,4,8,16}.P_LEQ_8.SW.DT_bf16_bf16 entries. Signed-off-by: Giuseppe Grossi <[email protected]> --------- Signed-off-by: Hongxia Yang <[email protected]> Signed-off-by: Giuseppe Grossi <[email protected]> Co-authored-by: Mehmet Cagri <[email protected]> Co-authored-by: Giuseppe Grossi <[email protected]>
… grid (ROCm#6594) * [Triton/Gluon] Route short sliding-window queries to the gfx950 split grid Spec-decode verify batches (q <= 8, kv >= 512, <= 1024 tokens) on sliding-window layers were forced onto the 2D prefill grid. On MI355X with Muse Spark Open DSpark shapes (16/2 heads, D=64, window 2048, kv 8704), the split grid is 1.13-1.91x faster across q=2..8 and batch 1..256; batches above 1024 tokens stay on the 2D grid. Extends test_triton_unified_attn_3d with short-query and sliding-window cases. Signed-off-by: Hongxia Yang <[email protected]> * [Triton/Gluon] Keep SWA spec-decode on the 2D grid with 3D query-block sizing Per review: the speedup came from the 3D launch's query-block sizing (the SW kv_split entry has MAX_SEGMENTS 1, so nothing was split), and routing sliding-window batches to the 3D grid would drop sinks if SW ever split. Restore the upstream routing and instead apply the unsplit 3D BLOCK_M/num_warps sizing (shared via _gfx950_3d_block_m) in the 2D launcher for sliding-window batches with q*heads_per_kv <= 128 and <= 1024 tokens. MI355X, Muse Spark Open DSpark shapes (16/2 heads, D=64, window 2048, kv 8704), vs upstream main: 1.13-1.83x at q=2..8 x batch 1..128, 1.33-1.48x at q=2..4 x batch 256; kv 1024: 1.24-1.31x; kv 256: 1.10-1.13x. Full-attention shapes unchanged (0.99-1.06x). Applying the 3D sizing to all short queries regressed large full-attention batches (to 0.54x at q=8 x 256), hence the sliding-window and token limits. Also fixes the stale 'gfx950 -> Triton' test comment. Signed-off-by: Hongxia Yang <[email protected]> * [Triton/Gluon] SWA spec-decode attn_2d entries gated on programs per CU Replace the 3D config borrowed by the gfx950 2D launch with config entries. - unified_attention.py: back to main. - unified_attention_utils.py: new P axis, 2D programs per CU rounded up to a power of 2. - gfx950 gluon DEFAULT.json: attn_2d schema adds Q and P; four D_LEQ_64.Q_LEQ_{2,4,8,16}.P_LEQ_8.SW.DT_bf16_bf16 entries. Signed-off-by: Giuseppe Grossi <[email protected]> --------- Signed-off-by: Hongxia Yang <[email protected]> Signed-off-by: Giuseppe Grossi <[email protected]> Co-authored-by: Mehmet Cagri <[email protected]> Co-authored-by: Giuseppe Grossi <[email protected]>


Motivation
Muse Spark Open's DSpark speculative decoding verifies 8 tokens per request (7 drafts + 1) on layers with a 2,048-token sliding window. On Day 0, the vLLM image's aiter build sped these batches up behind
AITER_UNIFIED_ATTN_SHORT_QUERY_3D=1(blog). This PR covers the sliding-window case, so Muse gets the Day 0 gain from upstream aiter without using a flag.attn_2d config entries plus one new matcher axis
co-authors: @giuseppegrossi @cagrikymk
Technical Details
unified_attention_utils.py: new numeric axisP, the 2D grid's programs per CU:next_power_of_2(cdiv(num_2d_prgms, num_sms)). It is part of the lookup's cache key and ofexplain(). Rounding to a power of 2 keeps the cache small, soPbounds must be powers of 2.DEFAULT.json: the attn_2d schema becomes["D", "Q", "P", "SW", "SKLT", "DT"], with four new entries. No existing entry mentionsQorP, so every other lookup is unchanged.D_LEQ_64.Q_LEQ_2.P_LEQ_8.SW.DT_bf16_bf16D_LEQ_64.Q_LEQ_4.P_LEQ_8.SW.DT_bf16_bf16D_LEQ_64.Q_LEQ_8.P_LEQ_8.SW.DT_bf16_bf16D_LEQ_64.Q_LEQ_16.P_LEQ_8.SW.DT_bf16_bf16All four use MFMA 16, waves_per_eu 1, 2 buffers and a 64 tile.
P_LEQ_8: decode-style settings win while CUs are idle and lose once the grid fills the GPU.P_LEQ_8(at most 2,048 programs on 256 CUs) is where they stop winning. Without it, Muse drops to 0.61–0.80x of main at batch 256–512.DT_bf16_bf16tag is required: fp8 with MFMA 16 uses the 16x16x128 instruction, which needs a tile of at least 128. fp8 and larger head sizes can get their own entries later.unified_attention.py: identical to main.test_triton_unified_attn_3dgains spec-decode cases ([(2, 8704), (7, 8704)],[(8, 8704)] * 32) andsliding_window=2048.Test Plan
On one MI355X node in
rocm/pytorch:rocm7.2.4_ubuntu24.04_py3.12_pytorch_release_2.10.0:op_tests/triton_tests/attention/test_unified_attention.py, split over 8 GPUs.unified_attention(..., backend="gluon")against main on 4,212 shapes:Test Result
With plain K/V caches and 64-token pages, batch 1–64 is 1.37–1.67x / 1.40–1.71x. The DSpark recipe caps the server at 64 requests.
P_LEQ_8The three worst are 16/2 heads with a 128-token window at batch 128 (0.82x warm). The other 11 are at 0.89x or better.
Submission Checklist