Repository navigation
attention: Triton unified_attention decode kernel for Muse Spark - #80
Merged
Merged
Conversation
…contracts [email protected] is one-token paged decode on vLLM's kv_split_pages cache, timed against aiter's paged_attention_v1; [email protected] is the multi-token decode vLLM's ROCM_AITER_FA backend runs, timed against aiter's Triton unified_attention. Both baselines call aiter as that backend does. An attr value may now be a tuple of ints, so window_size is the attr (-1, -1) or (2047, 0) as vLLM passes it; softcap is a scalar and the descales optional inputs that must be absent. Adds the KvSplitPages and StridedRows layouts and Muse (16/2/64/16) definition schemas for both.
…for Muse decode One program per (request, kv head, KV segment) loads each K/V tile once for all 8 queries x 8 query heads of a kv head; segments are cut from each request's own length on the device (graph-safe launch from the batch alone), edge tiles only are masked, a sliding window restricts the walk, fp32 partials merge in a second kernel. Global layers serve batch 5..64 (1..4 stay on aiter), sliding window 2047 layers batch 1..64.
…ified_attention The drafter calls unified_attention with max_seqlen_q 7 on its window-2047 layers (total_q = 7 x batch, batch 1..64), which had no schema and fell back to aiter. Add the q=7 window (2047, 0) kernel schema with the q=8 kernel unchanged: a 7-query request runs the same 8-row query tile with its last row masked, and the launch plan depends only on batch and window.
vLLM's Muse recipe runs --max-num-seqs 128, so decode batches 65..128 reach the unified_attention schemas. Measure all three at batches 1..128 with the same kernel. The q8 global schema leaves batch 2 to AITER: both sit near the launch floor there and six plans ran 0.71-0.98x of it, while batches 1, 3 and 4 clear it.
fanxingran
requested review from
jiejingzhangamd and
xiaobochen-amd
as code owners
November 6, 2026 04:53
fanxingran
requested review from
irvineoy,
kyle-256 and
zhenhuang12
as code owners
November 6, 2026 04:53
…-attention # Conflicts: # aklr/ops/README.md # tests/ops/names.txt
…d_attention, pinned to Triton 3.8 The q8 global, q8 sliding window (2047, 0) and DSpark drafter's q7 window kernels at batches 1-128, with software pipelining (num_stages 2/3) and per-batch segment counts sized to about 2 programs per CU (non-power-of-two segments merged); rows without a consistent gain keep the previous config. The schemas this PR adds now pin kernel.requires (#168), and main's q8 and q8 window schemas they replace are removed.
fanxingran
changed the base branch from
fanxingran/muse-spark-attention-contracts
to
main
November 16, 2026 06:37
This was referenced Nov 16, 2026
fanxingran
temporarily deployed
to
gpu-trusted
November 16, 2026 07:20 — with
GitHub Actions
Inactive
Collaborator
|
please rebase main to pass the CI |
fanxingran
temporarily deployed
to
gpu-trusted
November 17, 2026 09:15 — with
GitHub Actions
Inactive
kyle-256
approved these changes
Nov 18, 2026
This branch was previously deployed
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.
Why
Muse Spark's multi-token decode (DSpark verify, q=8; drafter, q=7) on vLLM's ROCM_AITER_FA backend
runs aiter's Triton
unified_attention. This adds a split-KV, GQA-packed Triton kernel for[email protected]: one program per (request, KV head, KV segment) loads each K/V tile once forall of the request's queries and the 8 query heads sharing that KV head, and a second kernel merges
the segments.
The contract and its definition schemas reached main in #114 (#79, this PR's former base, is
closed); this PR now targets main.
Scope
recipe runs
--max-num-seqs 128): q=8 global, q=8 window (2047, 0) and q=7 window (2047, 0),each
requires: {"triton": ">=3.8"}.98e71b8c93780330.json,9e6e990978c3fdd3.json), whose workloads the kernel schemas list.num_stages2 or 3)and per-batch segment counts sized to about 2 programs per CU (non-power-of-two segment counts
merged); batches without a consistent gain keep the previous config. Main is merged in (no
force-push).
Tradeoffs
this kernel both sit near the launch floor. Six plans (tile, chunk, segments) ran 0.71 - 0.98x;
this run 0.949x. It stays in the schema, measured but below the 1.05 bar (feat(validation): one 5% bar for admission and dispatch, and acceptance criteria for kernel and plugin PRs #153), so dispatch
keeps it on AITER.
Verification
Environment: head
eacb09c(main78496c0merged in), MI355X x1,lmsysorg/sglang:v0.5.22-rocm10-mi35x(sha256:1438dd8b), torch 2.11.0+rocm10.0.0, FlyDSL 0.3.2,Triton 3.8.0, AITER
dbd8bf5bd(AKLR_BASELINE_AITER)Gate overrides: none
Kernels
unified_attentionunified_attentionunified_attentionValidation log
The one test failure (
qwen3_next_gdn_prefill_group_fp8_quant'sdelta_statebound) fails thesame on main
78496c0and touches nothing here.Muse Spark on vLLM (manual, outside CI)
With the previous revision of these kernels (before the split-KV retune):
vllm/vllm-openai-rocm:nightly(vllm 0.33.0rc1.dev806+ga2bcb5657, aiter 0.1.27), Muse's recipe(TP8 + expert parallel, DSpark k=7,
--max-num-seqs 128, FULL_AND_PIECEWISE graphs), MI355X x8.A
sitecustomizehook (not in this PR) routes vLLM'sunified_attentioncalls throughaklr.ops.unified_attention; calls no schema serves fall back to aiter. Decode there is q=8 on 46window and 16 global layers and q=7 on the drafter's 5 window layers, contexts 8k - 9k at batch 1,
4 and 32.
Greedy outputs differ run to run on either side (two aiter runs agree on 69 of 200 gsm8k answers'
texts), so the accuracy rows are within noise (one question is 0.005).
Not run
main yet, and no vLLM plugin route calls
aklr.ops.unified_attentionyet.Risk
Affects: Muse Spark multi-token decode (
unified_attention, 16/2/64/16, q=8 and q=7) on MI355X.If wrong: wrong attention output for Muse decode.
Undo:
[email protected]runs AITER; otherwisegit revert. New schemas carry nospeedupuntil the publish-measurement bot measures them on main, so nothing serves before that.