You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 6350 --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.
github-actionsBot
changed the title
[gfx1250]mla decode qh32 version4
[ASM] [gfx1250]mla decode qh32 version4
Oct 10, 2026
When num_kv_splits == 1, mla.py passes output.view(...) as splitData and also passes the same output tensor here. Declaring both aliases as independently mutable violates the alias contract used by custom-op auto-functionalization, so the advertised torch.compile(fullgraph=True) path can fail for every single-split launch. Expose only one mutable alias (the raw launcher never launches through output) or otherwise redesign the schema, and cover this case with a full-graph compile test.
The reason will be displayed to describe this comment to others. Learn more.
E2E test results: qh32 fp8 decode (DSv4-Pro, TP4, fp8 KV)
Setup: image rocm/fw-bringup:gfx1250-atom-20260930 (ATOM as shipped), aiter at this PR head (490d94b), serve_dsv4_tp4_kvcache_fp8.sh, FAKE_EPLB=0, OPUS prefill (ATOM_FORCE_V4_PREFILL_OPUS=1), gsm8k 3-shot.
With the default pool, the first token (from prefill) is correct and decode produces garbage right after it. This happens in both CUDA-graph and eager modes.
Root cause: KV row indices >= 2^24 break both qh32 kernels (mla_a8w8_qh32_1tg_32mx1_16nx4_sparse and fused_mla_a8w8_qh32_1tg_32mx1_16nx4_sparse). To show this, I placed the inputs from test_mla_v4_kargpreld.py (batch 4, kv_len 256) at different row offsets in a 40M-row KV pool:
Row offset
Result (num_kv_splits = None / 1 / 4)
0, 7M, 9M, 16,776,191
correct (cos 0.999998)
16,777,217 to 33M
GPU memory access fault
34M
no fault, but wrong output (cos 0.893)
The boundary at exactly 2^24 rows, plus wrap-around past 2^32 bytes, looks like a signed 32-bit byte offset on the 128-B-row RoPE plane (row * 128). This is inferred from the boundary only; I did not inspect the asm. In e2e, each layer's KV view covers well over 100M rows, and the per-request SWA window slots sit at the top of the plane, so every decode step reads garbage without raising an error. The current op tests use small pools (and arange page indices), so they don't catch this. Please add a large-pool / high-row-index case.
Secondary issue: zero-length sequences in a batch (e.g. CUDA-graph padded slots with kv_len = 0). For lens = [20, 0, 0, 0]:
num_kv_splits=1: the real sequence's output is also wrong (cos ≈ 0; it looks like results are written to the wrong rows).
num_kv_splits = None / 2 / 4 / 16: the real sequence is correct, but the empty rows come out as NaN.
It didn't visibly hurt gsm8k with the capped pool, but it should be fixed or covered too.
Unrelated to this PR (FYI for anyone reproducing): on this branch's upstream base, the Qwen3.5 grouped-MoE model config (#6090) makes the pandas CSV merge emit floats like '128.0', and _as_int() in grouped_moe_gfx1250.py crashes during warmup. Workaround: AITER_CONFIG_GROUPED_FMOE=<aiter>/aiter/configs/tuned_grouped_fmoe.csv.
E2E test results: qh32 fp8 decode (DSv4-Pro, TP4, fp8 KV)
Setup: image rocm/fw-bringup:gfx1250-atom-20260930 (ATOM as shipped), aiter at this PR head (490d94b), serve_dsv4_tp4_kvcache_fp8.sh, FAKE_EPLB=0, OPUS prefill (ATOM_FORCE_V4_PREFILL_OPUS=1), gsm8k 3-shot.
Config gsm8k exact_match (flexible / strict)
fp8 KV, default KV pool (89169 blocks/rank) 0.00 / 0.00 (1319 q)
fp8 KV, KV pool capped below 2^24 rows (--gpu-memory-utilization 0.60 --max-num-seqs 96) 95.07 ± 0.60 / 95.15 (1319 q)
bf16 KV control, same aiter 96.4 / 96.0 (250 q)
With the default pool, the first token (from prefill) is correct and decode produces garbage right after it. This happens in both CUDA-graph and eager modes.
Root cause: KV row indices >= 2^24 break both qh32 kernels (mla_a8w8_qh32_1tg_32mx1_16nx4_sparse and fused_mla_a8w8_qh32_1tg_32mx1_16nx4_sparse). To show this, I placed the inputs from test_mla_v4_kargpreld.py (batch 4, kv_len 256) at different row offsets in a 40M-row KV pool:
Row offset Result (num_kv_splits = None / 1 / 4)
0, 7M, 9M, 16,776,191 correct (cos 0.999998)
16,777,217 to 33M GPU memory access fault
34M no fault, but wrong output (cos 0.893)
The boundary at exactly 2^24 rows, plus wrap-around past 2^32 bytes, looks like a signed 32-bit byte offset on the 128-B-row RoPE plane (row * 128). This is inferred from the boundary only; I did not inspect the asm. In e2e, each layer's KV view covers well over 100M rows, and the per-request SWA window slots sit at the top of the plane, so every decode step reads garbage without raising an error. The current op tests use small pools (and arange page indices), so they don't catch this. Please add a large-pool / high-row-index case.
Secondary issue: zero-length sequences in a batch (e.g. CUDA-graph padded slots with kv_len = 0). For lens = [20, 0, 0, 0]:
num_kv_splits=1: the real sequence's output is also wrong (cos ≈ 0; it looks like results are written to the wrong rows).
num_kv_splits = None / 2 / 4 / 16: the real sequence is correct, but the empty rows come out as NaN.
It didn't visibly hurt gsm8k with the capped pool, but it should be fixed or covered too.
Unrelated to this PR (FYI for anyone reproducing): on this branch's upstream base, the Qwen3.5 grouped-MoE model config (#6090) makes the pandas CSV merge emit floats like '128.0', and _as_int() in grouped_moe_gfx1250.py crashes during warmup. Workaround: AITER_CONFIG_GROUPED_FMOE=<aiter>/aiter/configs/tuned_grouped_fmoe.csv.
The reason will be displayed to describe this comment to others. Learn more.
Re-test at 8ad88d9: large-KV and zero-length issues both fixed
E2E setup: same as my previous run (image rocm/fw-bringup:gfx1250-atom-20260930, ATOM as shipped, serve_dsv4_tp4_kvcache_fp8.sh, FAKE_EPLB=0, OPUS prefill via ATOM_FORCE_V4_PREFILL_OPUS=1, gsm8k 3-shot, 1319 q), with aiter at this PR head 8ad88d9 and the default KV pool, no capping.
aiter
KV pool
gsm8k exact_match (flexible / strict)
490d94b (previous)
default (89169 blocks/rank)
0.00 / 0.00
490d94b (previous)
capped below 2^24 rows
95.07 ± 0.60 / 95.15
8ad88d9 (this run)
default (89875 blocks/rank)
94.77 ± 0.61 / 94.84
With the default pool, accuracy goes from 0 to the same level as the capped-pool run (the 0.3 pt gap is within one stderr). The server log had no errors during the eval.
Op-level check (standalone script reusing the op test's fp8 packing and torch reference; qh32, num_kv_splits = 1 / None / 2 / 4 / 16, covering the single-pass, fused, and stage1 + stage2 paths):
High row indices: batch 4 × kv_len 256 placed at row offsets from 0 up to 2^27 (134M) in a 140M-row pool, including just below/at/above 2^24 and 34M, plus rows scattered randomly over the whole pool. All cases match the reference (cos ≥ 0.999997) with no faults.
Zero-length sequences: lens [20,0,0,0], [0,0,0,20], [256,0,256,0], [0,300,0,1]. Real sequences match (cos ≥ 0.999997) and empty rows are written as 0 (no NaN) on every path, including num_kv_splits=1.
Remaining request: the op test itself still only builds a small pool (num_page = batch * kv_seq_lens) and has no zero-length case, so CI would not catch a regression of either bug. Please add a high-row-index case and a zero-length-sequence case.
FYI: the unrelated _as_int() crash from the Qwen3.5 grouped-MoE CSV merge is still present on this base; the e2e run used the same AITER_CONFIG_GROUPED_FMOE workaround.
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
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.
Motivation
Technical Details
Test Plan
Test Result
Submission Checklist