Skip to content

[Perf] [AMD] attention: Switch MLA decode to Aiter on gfx1250 - #47193

Draft
mqhc2020 wants to merge 4 commits into
sgl-project:mainfrom
mqhc2020:marv/use_aiter_mla_decode_gfx1250
Draft

mqhc2020 wants to merge 4 commits into
sgl-project:mainfrom
mqhc2020:marv/use_aiter_mla_decode_gfx1250

Conversation

@mqhc2020

@mqhc2020 mqhc2020 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

On gfx1250, MLA decode runs the Triton kernel. AITER has a faster ASM decode kernel (fp8 Q, fp8 KV). This PR switches decode to it and folds its input preparation into the existing fused RoPE/KV-cache kernel, so no extra kernels are added per layer.

Changes

  • ASM decode path (opt-in: SGLANG_AITER_MLA_GFX1250_ASM=1 with --decode-attention-backend aiter)
    • Non-persistent AITER ASM kernel; fp8 KV cache, page size 64.
    • The KV cache uses the page layout the ASM kernel reads. Prefill and prefix reads go through the pool, so other paths are unaffected.
    • CUDA-graph compatible.
  • Fusion
    • The fused RoPE + concat + KV-cache kernel also writes the ASM page layout and emits the fp8, padded Q the kernel takes directly, removing the separate Q quantization and KV-write pass.

Default behavior (flag off) is unchanged.

Dependencies

Results

Kimi-K2-Thinking MXFP4, 8× gfx1250, TP8, input/output 8192/1024, same server args apart from the decode backend:

Concurrency TPOT (ms) Triton → ASM Total throughput (tok/s) Triton → ASM TTFT
4 20.56 → 15.98 (−22%) 1680 → 2144 (+28%) −3%
8 27.40 → 20.27 (−26%) 2528 → 3362 (+33%) −3%
16 37.28 → 27.64 (−26%) 3728 → 4990 (+34%) −4%
32 57.52 → 40.36 (−30%) 4838 → 6812 (+41%) −7%
64 96.64 → 64.54 (−33%) 5862 → 8728 (+49%) −12%

GSM8K (1319 questions, 5-shot): Triton 0.934, ASM 0.929.

Test

  • Unit checks: the fused kernel's paged layout is byte-identical to the token-major write, the fp8 Q matches, and CUDA graph capture works.
  • End-to-end benchmark and GSM8K above.

Checklist

Review and Merge Process

  1. Ping Merge Oncalls to start the process. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments or contact authorized users to do so.
    • Common commands include /tag-and-rerun-ci, /tag-run-ci-label, /rerun-failed-ci
  4. After green CI and required approvals, ask Merge Oncalls or people with Write permission to merge the PR.

CI States

Latest PR Test (Base): ❌ Missing run-ci label -- add it to run CI tests.
Latest PR Test (Extra): ❌ Blocked -- run-ci is required first.
Latest PR Test (AMD ROCm 10): ➖ No AMD PR run found for this commit.

jiaryang and others added 4 commits October 29, 2026 04:07
On gfx1250 the aiter ASM MLA decode kernels need FP8 Q and a KV layout
that sglang's KV pool does not use. With SGLANG_USE_AITER=1, MLA decode
in the aiter backend calls aiter's paged Gluon mla_decode_fwd (bf16 Q,
bf16 or FP8 KV) for a paged KV pool and plain causal attention with one
query token. Other single-rank calls use decode_attention_fwd; DCP keeps
its existing path.

The paged kernel is used only when aiter carries ROCm/aiter#5935; before
it, a batch with one segment per sequence writes softmax state over the
output without an error.

Co-authored-by: Cursor <cursoragent@cursor.com>
With SGLANG_USE_AITER=1 on gfx1250, aiter or triton MLA decode skips the
standalone RoPE and uses aiter fused_qk_rope_cat_and_cache_mla, the same
fused branch aiter MLA takes on gfx95, with a bf16 Q. sglang's
RotaryEmbedding keeps cos and sin in one cos_sin_cache, so the kernel gets
its two halves as strided views. Limited to plain rope modules whose table
covers the whole rope head, without DSA or DCP, and to bf16 or fp8 e4m3 KV
caches. Requires aiter with ROCm/aiter#5501.

The layer-static terms of the gate are computed once in __init__. A CPU
unit test pins down each term of the gate and the cos/sin order of the
tables.

Co-authored-by: Cursor <cursoragent@cursor.com>
@mqhc2020 mqhc2020 changed the title [AMD] gfx1250: switch MLA decode to Aiter [Perf][AMD] attention: switch MLA decode to Aiter on gfx1250 Oct 29, 2026
@mqhc2020 mqhc2020 changed the title [Perf][AMD] attention: switch MLA decode to Aiter on gfx1250 [Perf][AMD] attention: Switch MLA decode to Aiter on gfx1250 Oct 29, 2026
@mqhc2020 mqhc2020 changed the title [Perf][AMD] attention: Switch MLA decode to Aiter on gfx1250 [Perf] [AMD] attention: Switch MLA decode to Aiter on gfx1250 Oct 29, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants