Skip to content

[HIP] [FlyDSL] [gfx1250] MLA PS1: take 32/64-head multi-token decode as several qo tiles - #7913

Open
gbyu-amd wants to merge 2 commits into
gyu/mla-decode-num-headsfrom
gyu/mla-ps1-64h-multitoken-gfx1250
Open

gbyu-amd wants to merge 2 commits into
gyu/mla-decode-num-headsfrom
gyu/mla-ps1-64h-multitoken-gfx1250

Conversation

@gbyu-amd

@gbyu-amd gbyu-amd commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #8181 (get_mla_decode_num_heads), whose test expectations this PR moves with the new routing; retarget to main once it merges.

Summary

On gfx1250 the FlyDSL PS1 MLA decode kernel takes a 32- or 64-head query only while heads x max_seqlen_q <= 128 (32 heads up to 4 tokens, 64 heads up to 2). This lets it take 32 and 64 heads up to 8 query tokens, as the several qo tiles the metadata planner already cuts such a query into. A 64-head, 4-token decode (e.g. a speculative draft block) no longer has to be padded to 96 heads: stage 1 is 13–45% faster than the padded 96-head JIT kernel and 6–32% faster than the 96-head code object on MI455X.

Motivation

mla_v12_num_qo_tiles already splits a request whose heads x max_seqlen_q rows exceed the 128-row budget into ceil(rows / 128) tiles of ceil(max_seqlen_q / tiles) positions, e.g. 64 heads x 4 tokens into two 2-row tiles. The PS1 kernel did not take those tiles:

  • its wave layout assumed one tile per request (q_tile_rows = max_seqlen_q) below 64 heads;
  • its causal mask measures each row's distance from the request's last row through the tile's kv_end, which the planner trims by the tiles after it, not by rows;
  • _validate_pagesize1_inputs and mla_decode_backend / mla_decode_head_plan_v1_2 stop at heads x max_seqlen_q <= 128, so these shapes leave PS1 on gfx1250.

So a caller with 64 query heads and a multi-token query (an MTP verify, or a draft block with the query all-gathered over decode context parallel) pads the heads to 96. A third of stage 1's work then goes to pad heads, and with one query row per work item each request's KV is read once per token.

Changes

  • Wave layout (mla_gfx1250/mla_common.py). planner_q_tile_rows(heads, max_seqlen_q) mirrors mla_v12_num_qo_tiles; wave_layout sizes a work item to one planner tile. It still rejects tiles of more than 4 rows or 128 head-rows, and caps a tiled query at MAX_TILED_SEQLEN_Q = 8 (what is tested).
  • Causal mask (mla_pagesize1_fp8_fp8.py, mla_pagesize1_bf16_bf16.py). When the query is cut into several multi-row tiles, a row's distance from the request's last row comes from qo_indptr[batch + 1] (the work's batch from work_info), not from the trimmed kv_end. Single-tile layouts compile as before.
  • Launcher (aiter/ops/flydsl/mla_kernels.py). Validation defers to wave_layout; a tiled causal decode requires and passes qo_indptr (as round-robin CP already does).
  • Routing (csrc/include/mla_decode_shape.h). mla_decode_head_plan_v1_2 and mla_decode_backend send 32/64 heads with max_seqlen_qo <= 8 to FlyDSL PS1 without a 16-head fold; 16 heads stay at <= 4, 96/128 unchanged. There is no code object for these shapes, so they run on the FlyDSL JIT.
  • Tests. test_mla_flydsl.py: PS1_Q_SEQ_LENS 32/64 → 1–8, the metadata check accepts a shorter last tile, --causal 0 1 runs the non-causal (draft block) form, and --q-seq-len choices follow PS1_Q_SEQ_LENS. test_mla_shape_support.py: (64,3) (64,4) (64,8) (32,5) (32,8) route to FlyDSL PS1 with fold 1; (64,9) does not; get_mla_decode_num_heads now keeps 32/64 heads up to qlen 8 (heads(16, 5) 32, heads(64, 8) 64) instead of padding to 96.

The routing header and the kernel change go together: the header only admits the shapes the kernel now takes, and without it the new layouts are unreachable through mla_decode_fwd.

Performance (if applicable)

MI455X (gfx1250), one GPU. Whole call: CUDA graph replay with a 2 GB cache flush before each, median of 50. Stage 1 and reduce: torch profiler kernel times over 30 of those replays. 64 query heads, a 4-token non-causal draft block (max_seqlen_q 4), fp8 Q/KV, page size 1, persistent metadata as built for decode, per-rank KV of 512 or 8192 tokens. "96 heads" is the same query padded to 96 heads (what callers do today): FlyDSL JIT, or the 96-head code object (AITER_MLA_DECODE_PS1_ASM=1, mla_a8w8_qh96_1tg_16mx6_64nx1_msk0_lse_ps).

Stage 1:

Hardware Workload/configuration 96 heads JIT 96 heads code object 64 heads (this PR, JIT) Change vs JIT / vs code object
MI455X batch 8, 512 KV tokens 11.6 us 11.3 us 9.7 us -16% / -14%
MI455X batch 8, 8192 KV tokens 29.8 us 26.4 us 24.7 us -17% / -6%
MI455X batch 32, 512 KV tokens 17.9 us 17.0 us 15.6 us -13% / -8%
MI455X batch 32, 8192 KV tokens 72.1 us 61.3 us 48.8 us -32% / -20%
MI455X batch 128, 512 KV tokens 26.3 us 23.1 us 16.5 us -37% / -29%
MI455X batch 128, 8192 KV tokens 259.3 us 208.7 us 141.4 us -45% / -32%

Whole call (stage 1 + kn_mla_reduce_v1), same runs:

Hardware Workload/configuration 96 heads JIT 96 heads code object 64 heads (this PR)
MI455X batch 8, 512 / 8192 KV tokens 23.5 / 43.1 us 22.8 / 39.2 us 22.0 / 42.4 us
MI455X batch 32, 512 / 8192 KV tokens 39.4 / 94.7 us 37.8 / 81.4 us 32.2 / 65.8 us
MI455X batch 128, 512 / 8192 KV tokens 32.4 / 265.2 us 28.6 / 213.0 us 22.5 / 147.6 us

Known cost: at batch 8 x 8192 tokens the reduce takes 13.2 us instead of 8.5 us. 64 heads give 16 two-row tiles of ~13 splits, which kn_mla_reduce_v1 walks row by row, against 32 one-row tiles at 96 heads. The call is still 0.7 us faster than the padded JIT path but 3.2 us slower than the 96-head code object there. #7876 now has a multi-row instance of its wave-per-head reduce for exactly these tiles: rows over row parts, one head per wave, 4 split loads in flight. With it, the 64-head draft block's reduce drops from 7.7 / 13.3 to 6.6 / 12.7 us at batch 8 (512 / 8192 KV tokens), 13.6 → 10.8 us at batch 32 and 19.6 → 10.6 us at batch 64 (8192 tokens); see #7876. Forced kn_mla_reduce_v1_wide does not help (14.9 us at batch 8 x 8192).

Where 64 heads is slower. A caller that picks the narrowest width aiter reports (for example the DCP decode path in ROCm/ATOM#2760, through get_mla_decode_num_heads) gathers 64 heads with this PR instead of padding to 96. On the full draft-block sweep (batch 8–128 x 4k–256k context, measured with #7876 and #7912 applied), 64 heads is faster than the padded 96-head code object in 27 of 35 cells and slower in 8:

  • Batch 64, 512–2048 KV tokens per rank: +26% to +86% (35.3 vs 19.0 µs at 512 tokens). 64 requests x 2 tiles = 128 tiles on 256 CUs, so the metadata planner splits every tile's KV in two. That doubles the partial output and adds a reduce (21.7 µs stage 1 + 9.9 µs reduce), where the 96-head layout fills the GPU with 256 unsplit one-row tiles (13.1 µs + 1.2 µs).
  • Batch 8, 1024–16384 KV tokens per rank: +3% to +19%. Stage 1 here is the FlyDSL JIT, while 96 heads uses an exported code object (3–20% faster than its JIT on these shapes).

This PR changes neither the planner nor the code objects.

Needs #7912 (on main since 2026-11-18). These shapes reduce multi-row tiles on kn_mla_reduce_v1's massive path. That path had an LDS race once a workgroup reduces more than one row; #7912 fixes it. Without the fix, synthetic 64-head 2-row and 32-head 4-row reduces of 64+ tiles give wrong output in many runs on gfx1250. The numbers above are unchanged with #7912 applied (64-head draft block: 22.1 / 42.8 / 32.2 / 66.5 / 22.3 / 148.5 us).

Testing

  • Unit tests added or updated
  • Performance benchmarks run (above)
  • Tested on MI250X
  • Tested on MI300X

On MI455X, aiter main at ffd4a3f (which has #7912) plus #8181 and this change, every case against the torch reference:

  • op_tests/test_mla_shape_support.py: 20 passed, 2 skipped.
  • test_mla_flydsl.py --mode ps1 --num-heads 32 64 --q-seq-len 1 2 3 4 5 6 7 8 --causal 0 1 -b 1 4 -c 1 64 65 2048 --varlen (fp8): 256 cases, all pass.
  • Same with --dtype bf16 --q-seq-len 3 4 5 8 -b 4 -c 65 2048: 32 cases, all pass.
  • --mode cp (round-robin, causal), 64 heads q 3/4/8 and 32 heads q 5/8, --cp-world-size 2 8 -c 64 1200 --varlen: 20 cases, all pass (merged output exact in all; one per-rank partial has 1 element of ~1M outside the tolerance, within the test's 5% gate).
  • Unchanged layouts: --mode ps1 16/96/128 heads at q 1/2/4, causal 0/1, -b 4 -c 65 2048: 28 cases, all pass.

Earlier, on main at 111fbd8: the --mode cp run at all tiled lengths (64 heads q 3–8, 32 heads q 5–8, 40 cases) and --mode ps1-asm 96 heads at q 1/4 passed; with #7912, #7876 and #7914, test_mla_reduce.py ALL PASSED, and the 64-head draft-block benchmark above checked two sampled requests per case against a torch reference with 0 mismatches.

gfx9 is not affected: the routing change is under the gfx1250 FlyDSL PS1 branch and the kernels are gfx1250-only.

Documentation

  • Docstrings updated
  • User guide updated
  • Performance guide updated
  • No documentation change is needed, with the reason stated below

The shapes are selected automatically; the bounds are documented next to the routing code and in mla_common.py.

Dependencies

  • No new third-party dependencies added
  • New dependencies are listed and justified below

Breaking Changes

None. Shapes PS1 took before keep their layout and code path (16/96/128 heads, and 32/64 heads within 128 rows: the regression runs above). 32/64-head queries of 3–8 tokens that went elsewhere now run on FlyDSL PS1, and get_mla_decode_num_heads returns 32/64 for them instead of 96.

Update 2026-11-22: a work item's first KV tile runs outside the tile loop (967a3e3)

compute_tile_state decided at run time whether a tile is the work item's first one (no pending PV yet) with if tile_start > kv_start. The branch sat between the tile's QK and the previous tile's PV, so every iteration of the tile loop was two basic blocks, and the sched_group_barrier interleave of the QK / PV WMMAs and the V loads could not span them. run_tiles now runs the first full tile before the loop (first_tile=True), the loop body with first_tile=False, and compiles the masked last tile for both cases behind last_tile_start > kv_start. first_tile is a compile-time argument of process_tile / compute_tile_state (None keeps the run-time check); gather-only waves are unchanged. Only mla_pagesize1_fp8_fp8.py changes; the BF16 kernel is untouched.

Stage-1 kernel time, MI455X (gfx1250, 256 CUs), one GPU, FlyDSL JIT (AITER_MLA_DECODE_PS1_ASM=0), this branch's kernel before / after the commit, FP8, page size 1:

shape batch, ctx before (us) after (us) after / before
64 heads, q 4, causal, DCP 8 (cp, max rank) 8, 8k 23.96 23.46 0.979
8, 32k 33.39 31.38 0.940
32, 8k 34.48 33.36 0.967
32, 32k 50.34 46.01 0.914
128, 8k 34.52 30.91 0.895
128, 32k 104.28 88.56 0.849
64 heads, q 4, causal, DCP 2 6 shapes as above geomean 0.875 (0.823-0.933)
64 heads, q 4, causal, no CP (ps1) 6 shapes as above geomean 0.865 (0.840-0.914)

DCP 8 geomean 0.923. The 96-head JIT kernel gains 4-13% as well (its code object path is unchanged).

Testing (same build): op_tests/test_mla_flydsl.py against its reference, JIT only, all err 0: --mode ps1 for 16 / 32 / 64 / 96 / 128 heads (q_seq up to 4 / 8 / 8 / 4 / 1, batch 8 / 128, ctx 1000 / 8192: 52 rows) and --mode cp with DCP 2 / 8 for 32 / 64 / 96 / 128 heads (72 rows). black 26.10.1 and ruff 0.16.0 are clean on the changed file.

@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter standard tests on MI35X
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:mi300x Run Aiter standard tests on MI300X in PRs; main branch always runs them
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs (added automatically when gfx942 configs change); main branch always runs both MI35X and MI300X
ci:triton-355 Run the full Triton test suite on MI35X, not only the tests the change affects
ci:windows Windows JIT op smoke test on the Radeon R9700 ROCm runner
ci:multi-gpu Aiter multi-GPU tests on the 8-GPU runner
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: DeepSeek-V4-Pro, MiniMax-M3-MXFP4
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 7913 --add-label <label>

One backend per PR:
A PR changes one kernel backend: [Triton/Gluon] (Triton and Gluon count as one), [HIP], [ASM], [CK], [OPUS] or [FlyDSL]. If the title ends up with two backend tags, split the PR -- as stacked pull requests when one part cannot merge without the other.

PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to stop the title rewrites; labels stay in sync either way.

Reviews:
A reviewer is usually assigned within one working day after the PR is ready for review (see Code Review Process). If nobody has responded for about a week, mention the area contact listed in CONTACTS.md. Want to help review? See REVIEWERS.md.

ganyi1996ppo pushed a commit to ROCm/ATOM that referenced this pull request Nov 13, 2026
The PS1 kernel serves a multi-token query only at some head counts, and which
depends on the query length, the KV dtype and the call (16 heads only up to 4
rows; 32/64 up to 8 with ROCm/aiter#7913). Instead of a width table of its own,
ATOM asks aiter's get_mla_decode_num_heads (ROCm/aiter#7913) with the call it
makes: LSE for the merge, round-robin KV shards over the DCP group.

- The layer and both metadata builders (native and vLLM plugin) size the
  gathered width from one query length, mla_dcp_decode_query_len.
- Speculative decode + DCP is gated on the decode's own persistent predicate,
  so ATOM_MLA_PAGE_SIZE > 1 is refused rather than run non-persistent.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
gbyu-amd added a commit to ROCm/ATOM that referenced this pull request Nov 13, 2026
The PS1 kernel serves a multi-token query only at some head counts, and which
depends on the query length, the KV dtype and the call (16 heads only up to 4
rows; 32/64 up to 8 with ROCm/aiter#7913). Instead of a width table of its own,
ATOM asks aiter's get_mla_decode_num_heads (ROCm/aiter#7913) with the call it
makes: LSE for the merge, round-robin KV shards over the DCP group.

- The layer and both metadata builders (native and vLLM plugin) size the
  gathered width from one query length, mla_dcp_decode_query_len.
- Speculative decode + DCP is refused in the layer, where the head width is
  known: aiter's shape-support query at that width and query length, plus
  ATOM_MLA_PAGE_SIZE <= 1. The config-time gate is gone.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
gbyu-amd added a commit to ROCm/ATOM that referenced this pull request Nov 13, 2026
The PS1 kernel serves a multi-token query only at some head counts, and which
depends on the query length, the KV dtype and the call (16 heads only up to 4
rows; 32/64 up to 8 with ROCm/aiter#7913). Instead of a width table of its own,
ATOM asks aiter's get_mla_decode_num_heads (ROCm/aiter#7913) with the call it
makes: LSE for the merge, round-robin KV shards over the DCP group.

- The layer and both metadata builders (native and vLLM plugin) size the
  gathered width from one query length, mla_dcp_decode_query_len.
- Speculative decode + DCP is refused in the layer, where the head width is
  known: aiter's shape-support query at that width and query length, plus
  ATOM_MLA_PAGE_SIZE <= 1. The config-time gate is gone.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
gbyu-amd added a commit to ROCm/ATOM that referenced this pull request Nov 13, 2026
The PS1 kernel serves a multi-token query only at some head counts, and which
depends on the query length, the KV dtype and the call (16 heads only up to 4
rows; 32/64 up to 8 with ROCm/aiter#7913). Instead of a width table of its own,
ATOM asks aiter's get_mla_decode_num_heads (ROCm/aiter#7913) with the call it
makes: LSE for the merge, round-robin KV shards over the DCP group.

- The layer and both metadata builders (native and vLLM plugin) size the
  gathered width from one query length, mla_dcp_decode_query_len.
- Both aiter queries (persistent support and the gfx1250 width) describe the
  call through mla_dcp_decode_call: a causal verify takes the round-robin
  kernel, the DSpark draft's non-causal block (causal_decode=False) does not.
- Speculative decode + DCP is refused in the layer, where the head width is
  known: aiter's shape-support query at that width and query length, plus
  ATOM_MLA_PAGE_SIZE <= 1. The config-time gate is gone.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
gbyu-amd added a commit to ROCm/ATOM that referenced this pull request Nov 14, 2026
The PS1 kernel serves a multi-token query only at some head counts, and which
depends on the query length, the KV dtype and the call (16 heads only up to 4
rows; 32/64 up to 8 with ROCm/aiter#7913). Instead of a width table of its own,
ATOM asks aiter's get_mla_decode_num_heads (ROCm/aiter#7913) with the call it
makes: LSE for the merge, round-robin KV shards over the DCP group.

- The layer and both metadata builders (native and vLLM plugin) size the
  gathered width from one query length, mla_dcp_decode_query_len.
- Both aiter queries (persistent support and the gfx1250 width) describe the
  call through mla_dcp_decode_call: a causal verify takes the round-robin
  kernel, the DSpark draft's non-causal block (causal_decode=False) does not.
- Speculative decode + DCP is refused in the layer, where the head width is
  known: aiter's shape-support query at that width and query length, plus
  ATOM_MLA_PAGE_SIZE <= 1. The config-time gate is gone.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
gbyu-amd added a commit to ROCm/ATOM that referenced this pull request Nov 14, 2026
The PS1 kernel serves a multi-token query only at some head counts, and which
depends on the query length, the KV dtype and the call (16 heads only up to 4
rows; 32/64 up to 8 with ROCm/aiter#7913). Instead of a width table of its own,
ATOM asks aiter's get_mla_decode_num_heads (ROCm/aiter#7913) with the call it
makes: LSE for the merge, round-robin KV shards over the DCP group.

- The layer and both metadata builders (native and vLLM plugin) size the
  gathered width from one query length, mla_dcp_decode_query_len.
- Both aiter queries (persistent support and the gfx1250 width) describe the
  call through mla_dcp_decode_call: a causal verify takes the round-robin
  kernel, the DSpark draft's non-causal block (causal_decode=False) does not.
- Speculative decode + DCP is refused in the layer, where the head width is
  known: aiter's shape-support query at that width and query length, plus
  ATOM_MLA_PAGE_SIZE <= 1. The config-time gate is gone.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@gbyu-amd

Copy link
Copy Markdown
Contributor Author

Update: 64 heads vs padded 96 heads — small batches with skewed contexts still lose

Measured the full mla_decode_fwd call (stage 1 + reduce) for a 64-query-head, 4-token, non-causal draft block. Setup:

  • fp8 Q/KV, page size 1, persistent metadata sized for the server's max batch.
  • MI455X (gfx1250), one GPU, CUDA graph replay, median.
  • 96 heads = padded, code object mla_a8w8_qh96_1tg_16mx6_64nx1_msk0_lse_ps; 64 heads = this PR (FlyDSL JIT).
  • Both widths use the same reduce: an adaptive follow-up to [HIP] [Perf] Wave-per-head MLA reduce for wave32 (gfx1250) decode with few splits per tile #7876 that splits tiles with many splits across waves. It is a separate change and not in this PR.
batch metadata sized for 96 heads, µs 64 heads (this PR), µs 64 − 96
5–7 requests, context 2K–190K tokens (15 sampled batches) 32 seqs 39.3 (stage 1 24.6 + reduce 10.3) 42.6 (stage 1 24.8 + reduce 13.1) +3.3 µs (+8%)
24 / 32 requests 64 seqs 57.1 / 59.4 54.9 / 55.5 −2.2 / −3.9
96 / 128 requests 128 seqs 146.0 / 179.0 109.1 / 127.6 −36.9 / −51.4

Still slower: small batches with skewed contexts (first row)

  • Stage 1 is even: 24.8 vs 24.6 µs.
  • The reduce costs 2.8 µs more. The planner cuts each 64-head request into 2-row qo tiles, and the long requests' tiles get 31–65 splits each.

Next steps

  1. A reduce path for multi-row tiles with many splits.
  2. A code object for the 64-head multi-token stage 1. This PR runs the FlyDSL JIT kernel; at 96 heads the code object is faster than the JIT.

Correctness on the same build

  • op_tests/test_mla_flydsl.py (the PR's command: 32/64 heads × q 3/4/6/8 × causal 0/1, varlen): 64/64 pass.
  • op_tests/test_mla_shape_support.py: 20 passed, 2 skipped.

gbyu-amd added a commit to ROCm/ATOM that referenced this pull request Nov 16, 2026
The PS1 kernel serves a multi-token query only at some head counts, and which
depends on the query length, the KV dtype and the call (16 heads only up to 4
rows; 32/64 up to 8 with ROCm/aiter#7913). Instead of a width table of its own,
ATOM asks aiter's get_mla_decode_num_heads (ROCm/aiter#7913) with the call it
makes: LSE for the merge, round-robin KV shards over the DCP group.

- The layer and both metadata builders (native and vLLM plugin) size the
  gathered width from one query length, mla_dcp_decode_query_len.
- Both aiter queries (persistent support and the gfx1250 width) describe the
  call through mla_dcp_decode_call: a causal verify takes the round-robin
  kernel, the DSpark draft's non-causal block (causal_decode=False) does not.
- Speculative decode + DCP is refused in the layer, where the head width is
  known: aiter's shape-support query at that width and query length, plus
  ATOM_MLA_PAGE_SIZE <= 1. The config-time gate is gone.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
zufayu pushed a commit that referenced this pull request Nov 17, 2026
…n row's stage-2 k-tile to K (#7963)

kimik3tp8_tuned_grouped_fmoe.csv runs the token=16384 row's stage 2
(K = inter_dim = 384 per TP8 expert slice) with tile_k2 = 512, larger
than K. The gfx1250 TDM grouped GEMM then reads past the expert slice and
the GPU faults in mxfp4_tdm_fp4_t128x128x512_..._K384_e896 ("Page not
present"). ATOM's warmup prefills 2 x 8192 tokens, so Kimi-K3 TP8 hits
this row at every server start.

Use tile_k2 = 128, which every other row of the table uses and which
divides 384. The row came from #7296; the other 14 rows are unchanged.

Verified on two MI455X nodes (Kimi-K3 TP8 + DCP8 with DSpark, ATOM main
9fec99786 + ROCm/ATOM#2647 + #2760, aiter main b6f1ff6 + #7912 + #7913
+ this change). The server starts where it faulted in warmup before.
GSM8K 5-shot is 0.9606 flexible / 0.9613 strict, and the MLPerf Endpoints
agentic bench completes 293/293 samples at c4 and 1703/1703 at c64.
@gbyu-amd
gbyu-amd requested a review from xiangM99 November 17, 2026 06:57
@gbyu-amd
gbyu-amd force-pushed the gyu/mla-ps1-64h-multitoken-gfx1250 branch from c6aeb29 to 89b36a8 Compare November 18, 2026 10:00
@gbyu-amd
gbyu-amd changed the base branch from main to gyu/mla-decode-num-heads November 18, 2026 10:00
gbyu-amd added a commit to ROCm/ATOM that referenced this pull request Nov 18, 2026
get_mla_decode_num_heads now comes from its own aiter PR, ROCm/aiter#8181. ROCm/aiter#7913 keeps only the 32/64-head multi-token PS1 tiles: with it the 64-head draft block runs unpadded, without it the draft pads to 96 heads.
@gbyu-amd
gbyu-amd marked this pull request as ready for review November 19, 2026 02:28
@gbyu-amd
gbyu-amd added this pull request to stack #8247 November 19, 2026 02:33
@aiter-bot

aiter-bot commented Nov 19, 2026 •

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision 51bb7c651879 · mode shadow

Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision.

Questions to answer in the PR description

  1. What behavior does this PR change, and why is the existing behavior insufficient?
  2. What did you validate, and what remains unverified? Include commands, hardware/configuration and results.
  3. Which architecture, dtype and shape boundaries select the changed kernel path, and what invariant prevents unsupported inputs from reaching it?
  4. For every changed op_tests/ file, what behavior does it cover and why is it not redundant? Write None if no op test changed.

Edit the PR Self-Review section in the PR description. Include the current revision SHA; this comment refreshes automatically.

Missing or invalid answers

  • FAIL — missing ### Reviewed revision in the PR description
  • FAIL — missing ### Behavior and intent in the PR description
  • FAIL — missing ### Validation and unverified scope in the PR description
  • FAIL — missing ### PR-specific question in the PR description
  • FAIL — missing ### Changed op tests in the PR description
  • FAIL — Reviewed revision must contain at least the first 7 characters of the current head SHA
  • FAIL — Behavior and intent has no substantive answer
  • FAIL — Validation and unverified scope has no substantive answer
  • FAIL — PR-specific question has no substantive answer
  • FAIL — changed op test not explained in Changed op tests: op_tests/test_mla_flydsl.py
  • FAIL — changed op test not explained in Changed op tests: op_tests/test_mla_shape_support.py
  • FAIL — Changed op tests must explain why each changed op test is necessary and non-redundant

Shadow mode reports what would block but keeps the status successful. Set AITER_PR_SELF_REVIEW_MODE=enforce only after reviewing real false positives.

xiangM99
xiangM99 previously approved these changes Nov 19, 2026
@xiangM99
xiangM99 requested a review from a team November 19, 2026 03:08
@gbyu-amd
gbyu-amd force-pushed the gyu/mla-ps1-64h-multitoken-gfx1250 branch from 89b36a8 to 067fee3 Compare November 19, 2026 06:16
@github-actions github-actions Bot changed the title [FlyDSL] [gfx1250] MLA PS1: take 32/64-head multi-token decode as several qo tiles [HIP] [FlyDSL] [gfx1250] MLA PS1: take 32/64-head multi-token decode as several qo tiles Nov 19, 2026
@gbyu-amd
gbyu-amd force-pushed the gyu/mla-ps1-64h-multitoken-gfx1250 branch from 967a3e3 to 5fb8410 Compare November 24, 2026 07:28
…eral qo tiles

get_mla_decode_num_heads now keeps 32/64 heads for these shapes (32 and 64 heads up to qlen 8) instead of padding to 96; its test expectations move with the routing.
…he tile loop

compute_tile_state decided at run time whether a tile is the work item's
first one (no pending PV yet) with `if tile_start > kv_start`. The branch
sat between the tile's QK and the previous tile's PV, so every iteration of
the tile loop was two basic blocks, and the sched_group_barrier interleave of
the QK / PV WMMAs and the V loads could not span them.

run_tiles now runs the first full tile before the loop (first_tile=True), the
loop body with first_tile=False, and compiles the masked last tile for both
cases behind `last_tile_start > kv_start`. first_tile is a compile-time
argument of process_tile / compute_tile_state; None keeps the run-time check.
Gather-only waves are unchanged.
@gbyu-amd
gbyu-amd force-pushed the gyu/mla-ps1-64h-multitoken-gfx1250 branch from 5fb8410 to 51bb7c6 Compare November 25, 2026 07:19
gbyu-amd added a commit to ROCm/ATOM that referenced this pull request Nov 26, 2026
…#3889)

mla_min_query_heads padded every gfx1250 draft block wider than one row to
96 query heads. It now asks aiter's get_mla_decode_num_heads for the call the
draft makes without DCP (non-causal, no LSE, persistent PS1) and keeps the
fixed rule only for an aiter without that query or with no answer.

With ROCm/aiter#7913 (in aiter k3-455-dev) the Kimi-K3 DSpark draft at TP 1
(DP8 EP8 decode: 64 heads, T = 4) runs at its 64 heads instead of 96. DCP
layers already size their gathered width with aiter; this stays their lower
bound.
gbyu-amd added a commit that referenced this pull request Nov 26, 2026
… VGPR pins (#8736 @ 13b071f, head 2026-11-26T06:02:59Z) (#8743)

Port of #8736's commits d9926d2 and 13b071f onto k3-455-dev; its
first commit (#8181 + #7913) is already here.

Conflicts:
- mla_pagesize1_fp8_fp8.py: #8736's file. It carries #7913 @ 51bb7c6
  (k3-455-dev had 067fee3), the only difference in that file.
- mla_reduce_kernels.cuh: k3-455-dev's file (keeps #7876 and #7914) plus
  #8736's row-parallel reducer and its dispatch, checked first as in #8736.

Co-authored-by: xiangM99 <[email protected]>
gbyu-amd added a commit that referenced this pull request Dec 3, 2026
…@ 067fee3, head 2026-11-19T06:16:26Z)

Applied as the diff 2d34816..067fee3 (7 files) onto the rebased 1116 tree; PR state: open, author gbyu-amd, base gyu/mla-decode-num-heads.

(cherry picked from commit 9d4e935)

Updated 12-03 to the PR head #7913 @ 51bb7c6: folds in the PR's later commits 51bb7c6 [FlyDSL] [gfx1250] MLA PS1: run a work item's first KV tile outside the tile loop.
gbyu-amd added a commit that referenced this pull request Dec 3, 2026
… VGPR pins (#8736 @ 13b071f, head 2026-11-26T06:02:59Z) (#8743)

Port of #8736's commits d9926d2 and 13b071f onto k3-455-dev; its
first commit (#8181 + #7913) is already here.

Conflicts:
- mla_pagesize1_fp8_fp8.py: #8736's file. It carries #7913 @ 51bb7c6
  (k3-455-dev had 067fee3), the only difference in that file.
- mla_reduce_kernels.cuh: k3-455-dev's file (keeps #7876 and #7914) plus
  #8736's row-parallel reducer and its dispatch, checked first as in #8736.

Co-authored-by: xiangM99 <[email protected]>
(cherry picked from commit 5b18892)
gbyu-amd added a commit to ROCm/ATOM that referenced this pull request Dec 3, 2026
…#3889)

mla_min_query_heads padded every gfx1250 draft block wider than one row to
96 query heads. It now asks aiter's get_mla_decode_num_heads for the call the
draft makes without DCP (non-causal, no LSE, persistent PS1) and keeps the
fixed rule only for an aiter without that query or with no answer.

With ROCm/aiter#7913 (in aiter k3-455-dev) the Kimi-K3 DSpark draft at TP 1
(DP8 EP8 decode: 64 heads, T = 4) runs at its 64 heads instead of 96. DCP
layers already size their gathered width with aiter; this stays their lower
bound.

(cherry picked from commit 9b6bb9d)

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