Repository navigation
Fp8 pa update kvcache - #24
Merged
Merged
Conversation
valarLip
approved these changes
Dec 24, 2024
junhaha666
approved these changes
Dec 25, 2024
Jasen2201
pushed a commit
to Jasen2201/aiter
that referenced
this pull request
Dec 18, 2025
dim 4096,384 bugfix
valarLip
added a commit
that referenced
this pull request
Mar 18, 2026
* kv-quant update * update cache * fix bug * add new cache kernels to rocm_ops.cpp * fix build err of cache_kernels.cu * add quant_kvcache_fp8 to test_pa * update test_pa and quant function --------- Co-authored-by: chenjun <[email protected]> Co-authored-by: valarLip <[email protected]>
yanxuer-999
added a commit
to yanxuer-999/aiter
that referenced
this pull request
Aug 19, 2026
…on->mla_gluon rename aiter commit b50066a (2026-07-05, PR ROCm#3833 "Add DSv4 sparse MLA prefill Triton and unified MLA Gluon kernel") merged aiter/ops/triton/gluon/mla_decode_gluon.py into a new unified aiter/ops/triton/gluon/mla_gluon.py and renamed the entry point mla_decode_gluon -> mla_gluon. This benchmark script kept importing the old module/function, so it has crashed with ModuleNotFoundError on every daily CI run since build ROCm#24 (2026-07-07) and produced zero data for ~6 weeks (confirmed via central benchmark.db: last successful row was build ROCm#22, 2026-07-05). mla_gluon's decode-path signature is unchanged from mla_decode_gluon (q_nope, q_pe, kv_c, o, page_table, seq_info, sm_scale, use_2d_view, min_kv_seq_len, ...), so this is a drop-in rename with no other logic changes needed. Co-authored-by: Cursor <[email protected]>
Fangzhou-Ai
pushed a commit
to Fangzhou-Ai/aiter
that referenced
this pull request
Aug 27, 2026
…urce
Removes hsa/gfx950/dsv4_mla_prefill_opus/ (the .co and build_co.sh), the
ctypes loader, its python wrapper, the JSON entry, the __init__ export
and the bit-identity test. The kernel now ships only as source and is
JIT-compiled like every other aiter op.
Nothing is lost: the .co was a second delivery of the same kernel that
csrc/include/pa_sparse_prefill_opus.h already contains, reached through
pa_sparse_prefill_fp8_opus_paged instead of dsv4_mla_prefill_opus. The
two were verified bit-identical on 4 shapes x {CSR, dense} before this
commit, so the end-to-end numbers measured against the code object hold
for the source build.
What the code object bought was a 5.6 s loader compile against the JIT's
28.5 s at worker start. What it cost was a hand-maintained mirror of
pa_fp8_paged_kargs guarded by ten offsetof asserts, a hardcoded mangled
symbol name, a binary in the tree, and a build recipe that cannot be run
from this checkout because the source deliberately lived elsewhere. For
a kernel still being tuned that is the wrong trade; it can be re-added
later from this same source, which is how ROCm#28 relates to ROCm#24.
Accuracy re-verified after the removal with the JIT path and a cleared
cache: 2.635e-02 .. 2.657e-02 against Triton, unchanged in every digit.
yanxuer-999
added a commit
to yanxuer-999/aiter
that referenced
this pull request
Sep 15, 2026
…on->mla_gluon rename aiter commit b50066a (2026-07-05, PR ROCm#3833 "Add DSv4 sparse MLA prefill Triton and unified MLA Gluon kernel") merged aiter/ops/triton/gluon/mla_decode_gluon.py into a new unified aiter/ops/triton/gluon/mla_gluon.py and renamed the entry point mla_decode_gluon -> mla_gluon. This benchmark script kept importing the old module/function, so it has crashed with ModuleNotFoundError on every daily CI run since build ROCm#24 (2026-07-07) and produced zero data for ~6 weeks (confirmed via central benchmark.db: last successful row was build ROCm#22, 2026-07-05). mla_gluon's decode-path signature is unchanged from mla_decode_gluon (q_nope, q_pe, kv_c, o, page_table, seq_info, sm_scale, use_2d_view, min_kv_seq_len, ...), so this is a drop-in rename with no other logic changes needed. Co-authored-by: Cursor <[email protected]>
1 task done
yanxuer-999
added a commit
to yanxuer-999/aiter
that referenced
this pull request
Oct 15, 2026
…on->mla_gluon rename aiter commit b50066a (2026-07-05, PR ROCm#3833 "Add DSv4 sparse MLA prefill Triton and unified MLA Gluon kernel") merged aiter/ops/triton/gluon/mla_decode_gluon.py into a new unified aiter/ops/triton/gluon/mla_gluon.py and renamed the entry point mla_decode_gluon -> mla_gluon. This benchmark script kept importing the old module/function, so it has crashed with ModuleNotFoundError on every daily CI run since build ROCm#24 (2026-07-07) and produced zero data for ~6 weeks (confirmed via central benchmark.db: last successful row was build ROCm#22, 2026-07-05). mla_gluon's decode-path signature is unchanged from mla_decode_gluon (q_nope, q_pe, kv_c, o, page_table, seq_info, sm_scale, use_2d_view, min_kv_seq_len, ...), so this is a drop-in rename with no other logic changes needed. Co-authored-by: Cursor <[email protected]> (cherry picked from commit 7ad610b)
yanxuer-999
added a commit
to yanxuer-999/aiter
that referenced
this pull request
Oct 22, 2026
…on->mla_gluon rename aiter commit b50066a (2026-07-05, PR ROCm#3833 "Add DSv4 sparse MLA prefill Triton and unified MLA Gluon kernel") merged aiter/ops/triton/gluon/mla_decode_gluon.py into a new unified aiter/ops/triton/gluon/mla_gluon.py and renamed the entry point mla_decode_gluon -> mla_gluon. This benchmark script kept importing the old module/function, so it has crashed with ModuleNotFoundError on every daily CI run since build ROCm#24 (2026-07-07) and produced zero data for ~6 weeks (confirmed via central benchmark.db: last successful row was build ROCm#22, 2026-07-05). mla_gluon's decode-path signature is unchanged from mla_decode_gluon (q_nope, q_pe, kv_c, o, page_table, seq_info, sm_scale, use_2d_view, min_kv_seq_len, ...), so this is a drop-in rename with no other logic changes needed. Co-authored-by: Cursor <[email protected]> (cherry picked from commit 7ad610b)
luocheng25
added a commit
to luocheng25/aiter
that referenced
this pull request
Nov 10, 2026
MiMo block-8 verify (BF16 Q/KV, Q/K 192, V 128, page 64, 16 query heads per KV head, query_length 8, one KV head, no window or sinks, query_splits 1, masked unowned KV) runs a dedicated kernel on gfx942 by default; AITER_PA_MIMO_REGP=0 selects the tile kernel. Four waves are two token groups x two row groups of 64 query rows. QK computes S^T = K Q^T, whose accumulators are PV's B operand, so the probabilities stay in registers: Q is held in registers and the tile loop has no LDS traffic and no barrier. Each wave keeps its own online softmax with a lazily moved reference max; the token groups merge once per task through LDS and write the shared reducer's partials. - Software pipeline: step c runs the softmax of c with the QK of c + 1, then PV(c); K(c + 2) and V(c + 1) are prefetched about a step ahead. - The softmax is emitted slot by slot with the QK MFMAs (one exponential or up to three scalar VALU per 16x16x16 MFMA), and packed FP32 is disabled: v_pk_* never co-issue with an MFMA on gfx942. - K/V use per-page buffer resources (page base in SGPRs, one lane VGPR, constants in the instruction offset); page ids come from one s_buffer_load per iteration, issued an iteration ahead; the loop counter is i32 and V lives in AGPRs. 488 VGPR, no scratch. MI300X, one layer (kernel + reduce) vs PR ROCm#24's tile kernel with the same partitions and query_splits 1: 1.23-1.47x (152x64K 2.974 -> 2.198 ms, 10x1M 3.402 -> 2.308 ms). MiMo-V2.6-Flash DP2/TP8 decode matrix (DFlash block 8): +1.0% (4K), +8.4% (64K), +17.2% (1M) output tok/s; GSM8K 1319 0.908. op_tests/test_flydsl_pa_decode.py + test_flydsl_pa_compat.py: 271 passed.
luocheng25
added a commit
to luocheng25/aiter
that referenced
this pull request
Nov 10, 2026
MiMo block-8 verify (BF16 Q/KV, Q/K 192, V 128, page 64, 16 query heads per KV head, query_length 8, one KV head, no window or sinks, query_splits 1, masked unowned KV) runs a dedicated kernel on gfx942 by default; AITER_PA_MIMO_REGP=0 selects the tile kernel. Four waves are two token groups x two row groups of 64 query rows. QK computes S^T = K Q^T, whose accumulators are PV's B operand, so the probabilities stay in registers: Q is held in registers and the tile loop has no LDS traffic and no barrier. Each wave keeps its own online softmax with a lazily moved reference max; the token groups merge once per task through LDS and write the shared reducer's partials. - Software pipeline: step c runs the softmax of c with the QK of c + 1, then PV(c); K(c + 2) and V(c + 1) are prefetched about a step ahead. - The softmax is emitted slot by slot with the QK MFMAs (one exponential or up to three scalar VALU per 16x16x16 MFMA), and packed FP32 is disabled: v_pk_* never co-issue with an MFMA on gfx942. - K/V use per-page buffer resources (page base in SGPRs, one lane VGPR, constants in the instruction offset); page ids come from one s_buffer_load per iteration, issued an iteration ahead; the loop counter is i32 and V lives in AGPRs. 488 VGPR, no scratch. The calibrated default of this geometry (prepare_pa_decode_plan without a tuning-cache entry) keeps one query split and sizes the partitions so that batch x P CTAs fill whole waves of CUs: P = floor(k x CUs / batch) for the fewest waves k <= 5 keeping >= 95% of them busy, 2 <= P <= 64. It replaces the per-batch table, whose two-split entries (24, 40, 208, 240, 256) ran the tile kernel and whose other batches took 16 partitions. PA cache keys now cover pa_decode_mimo.py. MI300X, one layer (kernel + reduce) vs PR ROCm#24's tile kernel with the same partitions and query_splits 1: 1.23-1.47x (152x64K 2.974 -> 2.198 ms, 10x1M 3.402 -> 2.308 ms). MiMo-V2.6-Flash DP2/TP8 decode matrix (DFlash block 8): +1.0% (4K), +8.4% (64K), +17.2% (1M) output tok/s; GSM8K 1319 0.908. op_tests/test_flydsl_pa_decode.py + test_flydsl_pa_compat.py: 271 passed.
luocheng25
added a commit
to luocheng25/aiter
that referenced
this pull request
Nov 10, 2026
MiMo block-8 verify (BF16 Q/KV, Q/K 192, V 128, page 64, 16 query heads per KV head, query_length 8, one KV head, no window or sinks, query_splits 1, masked unowned KV) runs a dedicated kernel on gfx942 by default; AITER_PA_MIMO_REGP=0 selects the tile kernel. Four waves are two token groups x two row groups of 64 query rows. QK computes S^T = K Q^T, whose accumulators are PV's B operand, so the probabilities stay in registers: Q is held in registers and the tile loop has no LDS traffic and no barrier. Each wave keeps its own online softmax with a lazily moved reference max; the token groups merge once per task through LDS and write the shared reducer's partials. - Software pipeline: step c runs the softmax of c with the QK of c + 1, then PV(c); K(c + 2) and V(c + 1) are prefetched about a step ahead. - The softmax is emitted slot by slot with the QK MFMAs (one exponential or up to three scalar VALU per 16x16x16 MFMA), and packed FP32 is disabled: v_pk_* never co-issue with an MFMA on gfx942. - K/V use per-page buffer resources (page base in SGPRs, one lane VGPR, constants in the instruction offset); page ids come from one s_buffer_load per iteration, issued an iteration ahead; the loop counter is i32 and V lives in AGPRs. 488 VGPR, no scratch. When this kernel will run (AITER_PA_MIMO_REGP not 0 and no query split above 1 requested), the calibrated default of this geometry (prepare_pa_decode_plan without a tuning-cache entry) keeps one query split and sizes the partitions so that batch x P CTAs fill whole waves of CUs: P = floor(k x CUs / batch) for the fewest waves k <= 5 keeping >= 95% of them busy, 2 <= P <= 64. Otherwise the tile kernel keeps the per-batch table (304 CUs), whose two-split entries (24, 40, 208, 240, 256) would bypass this kernel and whose other batches take 16 partitions. PA cache keys now cover pa_decode_mimo.py. MI300X, one layer (kernel + reduce) vs PR ROCm#24's tile kernel with the same partitions and query_splits 1: 1.23-1.47x (152x64K 2.974 -> 2.198 ms, 10x1M 3.402 -> 2.308 ms). MiMo-V2.6-Flash DP2/TP8 decode matrix (DFlash block 8): +1.0% (4K), +8.4% (64K), +17.2% (1M) output tok/s; GSM8K 1319 0.908. op_tests/test_flydsl_pa_decode.py + test_flydsl_pa_compat.py: 281 passed.
luocheng25
added a commit
to luocheng25/aiter
that referenced
this pull request
Nov 10, 2026
MiMo block-8 verify (BF16 Q/KV, Q/K 192, V 128, page 64, 16 query heads per KV head, query_length 8, one KV head, no window or sinks, query_splits 1, masked unowned KV) runs a dedicated kernel on gfx942 by default; AITER_PA_MIMO_REGP=0 selects the tile kernel. Four waves are two token groups x two row groups of 64 query rows. QK computes S^T = K Q^T, whose accumulators are PV's B operand, so the probabilities stay in registers: Q is held in registers and the tile loop has no LDS traffic and no barrier. Each wave keeps its own online softmax with a lazily moved reference max; the token groups merge once per task through LDS and write the shared reducer's partials. - Software pipeline: step c runs the softmax of c with the QK of c + 1, then PV(c); K(c + 2) and V(c + 1) are prefetched about a step ahead. - The softmax is emitted slot by slot with the QK MFMAs (one exponential or up to three scalar VALU per 16x16x16 MFMA), and packed FP32 is disabled: v_pk_* never co-issue with an MFMA on gfx942. - K/V use per-page buffer resources (page base in SGPRs, one lane VGPR, constants in the instruction offset); page ids come from one s_buffer_load per iteration, issued an iteration ahead; the loop counter is i32 and V lives in AGPRs. 488 VGPR, no scratch. When this kernel will run (AITER_PA_MIMO_REGP not 0 and no query split above 1 requested), the calibrated default of this geometry (prepare_pa_decode_plan without a tuning-cache entry) keeps one query split and sizes the workgroup budget so that batch x P CTAs fill whole waves of CUs: P = floor(k x CUs / batch) for the fewest waves k <= 5 keeping >= 95% of them busy, 2 <= P <= 64. The per-sequence cap is 64 rather than P: the planner splits the budget by context length, so equal lengths still get P partitions each, while a long sequence in a mixed batch is no longer limited to P. One layer: 255 x 4K + 1 x 128K 1.95 -> 0.40 ms, 63 x 8K + 1 x 1M 2.10 -> 0.68 ms, padded graph batch 88 (82 live) 2.52 -> 2.44 ms, other equal-length batches within 1%. Otherwise the tile kernel keeps the per-batch table (304 CUs), whose two-split entries (24, 40, 208, 240, 256) would bypass this kernel and whose other batches take 16 partitions. PA cache keys now cover pa_decode_mimo.py. MI300X, one layer (kernel + reduce) vs PR ROCm#24's tile kernel with the same partitions and query_splits 1: 1.23-1.47x (152x64K 2.974 -> 2.198 ms, 10x1M 3.402 -> 2.308 ms). MiMo-V2.6-Flash DP2/TP8 decode matrix (DFlash block 8): +1.0% (4K), +8.4% (64K), +17.2% (1M) output tok/s; GSM8K 1319 0.908. op_tests/test_flydsl_pa_decode.py + test_flydsl_pa_compat.py: 281 passed.
luocheng25
added a commit
to luocheng25/aiter
that referenced
this pull request
Nov 10, 2026
MiMo block-8 verify (BF16 Q/KV, Q/K 192, V 128, page 64, 16 query heads per KV head, query_length 8, one KV head, no window or sinks, query_splits 1, masked unowned KV) runs a dedicated kernel on gfx942 by default; AITER_PA_MIMO_REGP=0 selects the tile kernel. Four waves are two token groups x two row groups of 64 query rows. QK computes S^T = K Q^T, whose accumulators are PV's B operand, so the probabilities stay in registers: Q is held in registers and the tile loop has no LDS traffic and no barrier. Each wave keeps its own online softmax with a lazily moved reference max; the token groups merge once per task through LDS and write the shared reducer's partials. - Software pipeline: step c runs the softmax of c with the QK of c + 1, then PV(c); K(c + 2) and V(c + 1) are prefetched about a step ahead. - The softmax is emitted slot by slot with the QK MFMAs (one exponential or up to three scalar VALU per 16x16x16 MFMA), and packed FP32 is disabled: v_pk_* never co-issue with an MFMA on gfx942. - K/V use per-page buffer resources (page base in SGPRs, one lane VGPR, constants in the instruction offset); page ids come from one s_buffer_load per iteration, issued an iteration ahead; the loop counter is i32 and V lives in AGPRs. 488 VGPR, no scratch. When this kernel will run (AITER_PA_MIMO_REGP not 0 and no query split above 1 requested), the calibrated default of this geometry (prepare_pa_decode_plan without a tuning-cache entry) keeps one query split and sizes the workgroup budget so that batch x P CTAs fill whole waves of CUs: P = floor(k x CUs / batch) for the fewest waves k <= 5 keeping >= 95% of them busy, 2 <= P <= 64. Its plan caps each sequence at 64 tasks instead of P and uses the planner's new balanced split (plan_pa_decode(balanced=True); proportional stays the default): each sequence gets ceil(tiles / X) tasks for the smallest X that fits the budget and is no less than the capped longest sequence's tiles per task (24-step bisection over block reductions in the plan kernel); leftover slots go to the sequences that would split further. Equal lengths keep the same plan (P partitions each); mixed lengths share one bound on the tiles per task. One layer, P cap -> this plan: 255 x 4K + 1 x 128K 1.95 -> 0.36 ms, 148 x 16K + 4 x 256K 3.78 -> 0.91 ms, 63 x 8K + 1 x 1M 2.10 -> 0.56 ms; 152 sequences of 4K-128K tokens 3.18 -> 2.61 ms against the proportional split at cap 64; equal lengths within 1% (graph batch 88 with 82 live -3.6%); plan refresh +8-13 us. Otherwise the tile kernel keeps the per-batch table (304 CUs), whose two-split entries (24, 40, 208, 240, 256) would bypass this kernel and whose other batches take 16 partitions. PA cache keys now cover pa_decode_mimo.py. MI300X, one layer (kernel + reduce) vs PR ROCm#24's tile kernel with the same partitions and query_splits 1: 1.23-1.47x (152x64K 2.974 -> 2.198 ms, 10x1M 3.402 -> 2.308 ms). MiMo-V2.6-Flash DP2/TP8 decode matrix (DFlash block 8): +1.0% (4K), +8.4% (64K), +17.2% (1M) output tok/s; GSM8K 1319 0.908. op_tests/test_flydsl_pa_decode.py + test_flydsl_pa_compat.py: 287 passed.
luocheng25
added a commit
to luocheng25/aiter
that referenced
this pull request
Nov 11, 2026
MiMo block-8 verify (BF16 Q/KV, Q/K 192, V 128, page 64, 16 query heads per KV head, query_length 8, one KV head, no window or sinks, query_splits 1, masked unowned KV, positive softmax scale) runs a dedicated kernel on gfx942 by default; AITER_PA_MIMO_REGP=0 selects the tile kernel. The kernel masks unscaled scores and divides by the scale, so other scales keep the tile kernel, which scales before masking. Four waves are two token groups x two row groups of 64 query rows. QK computes S^T = K Q^T, whose accumulators are PV's B operand, so the probabilities stay in registers: Q is held in registers and the tile loop has no LDS traffic and no barrier. Each wave keeps its own online softmax with a lazily moved reference max; the token groups merge once per task through LDS and write the shared reducer's partials. - Software pipeline: step c runs the softmax of c with the QK of c + 1, then PV(c); K(c + 2) and V(c + 1) are prefetched about a step ahead. - The softmax is emitted slot by slot with the QK MFMAs (one exponential or up to three scalar VALU per 16x16x16 MFMA), and packed FP32 is disabled: v_pk_* never co-issue with an MFMA on gfx942. - K/V use per-page buffer resources (page base in SGPRs, one lane VGPR, constants in the instruction offset); page ids come from one s_buffer_load per iteration, issued an iteration ahead; the loop counter is i32 and V lives in AGPRs. 488 VGPR, no scratch. - Packed partials are addressed from a 64-bit slot base: they can exceed 2**31 elements (e.g. 2049 sequences x 64 partitions). When this kernel will run (AITER_PA_MIMO_REGP not 0 and no query split above 1 requested), the calibrated default of this geometry (prepare_pa_decode_plan without a tuning-cache entry) keeps one query split and sizes the workgroup budget so that batch x P CTAs fill whole waves of CUs: P = floor(k x CUs / batch) for the fewest waves k <= 5 keeping >= 95% of them busy, 2 <= P <= 64. Its plan caps each sequence at 64 tasks instead of P and uses the planner's new balanced split (plan_pa_decode(balanced=True); proportional stays the default): each sequence gets ceil(tiles / X) tasks for the smallest X that fits the budget and is no less than the capped longest sequence's tiles per task (24-step bisection over block reductions in the plan kernel); leftover slots go to the sequences that would split further. Equal lengths keep the same plan (P partitions each); mixed lengths share one bound on the tiles per task. One layer, P cap -> this plan: 255 x 4K + 1 x 128K 1.95 -> 0.36 ms, 148 x 16K + 4 x 256K 3.78 -> 0.91 ms, 63 x 8K + 1 x 1M 2.10 -> 0.56 ms; 152 sequences of 4K-128K tokens 3.18 -> 2.61 ms against the proportional split at cap 64; equal lengths within 1% (graph batch 88 with 82 live -3.6%); plan refresh +8-13 us (+23-34 us at plan capacity above 1024). Otherwise the tile kernel keeps the per-batch table (304 CUs), whose two-split entries (24, 40, 208, 240, 256) would bypass this kernel and whose other batches take 16 partitions. PA cache keys now cover pa_decode_mimo.py. MI300X, one layer (kernel + reduce) vs PR ROCm#24's tile kernel with the same partitions and query_splits 1: 1.23-1.47x (152x64K 2.974 -> 2.198 ms, 10x1M 3.402 -> 2.308 ms). MiMo-V2.6-Flash DP2/TP8 decode matrix (DFlash block 8): +1.0% (4K), +8.4% (64K), +17.2% (1M) output tok/s; GSM8K 1319 0.908. op_tests/test_flydsl_pa_decode.py + test_flydsl_pa_compat.py: 291 passed, including partials past 2**31 elements and non-positive scales.
luocheng25
added a commit
to luocheng25/aiter
that referenced
this pull request
Nov 11, 2026
MiMo block-8 verify (BF16 Q/KV, Q/K 192, V 128, page 64, 16 query heads per KV head, query_length 8, one KV head, no window or sinks, query_splits 1, masked unowned KV, positive softmax scale) runs a dedicated kernel on gfx942 by default; AITER_PA_MIMO_REGP=0 selects the tile kernel. The kernel masks unscaled scores and divides by the scale, so other scales keep the tile kernel, which scales before masking. Four waves are two token groups x two row groups of 64 query rows. QK computes S^T = K Q^T, whose accumulators are PV's B operand, so the probabilities stay in registers: Q is held in registers and the tile loop has no LDS traffic and no barrier. Each wave keeps its own online softmax with a lazily moved reference max; the token groups merge once per task through LDS and write the shared reducer's partials. - Software pipeline: step c runs the softmax of c with the QK of c + 1, then PV(c); K(c + 2) and V(c + 1) are prefetched about a step ahead. - The softmax is emitted slot by slot with the QK MFMAs (one exponential or up to three scalar VALU per 16x16x16 MFMA), and packed FP32 is disabled: v_pk_* never co-issue with an MFMA on gfx942. - K/V use per-page buffer resources (page base in SGPRs, one lane VGPR, constants in the instruction offset); page ids come from one s_buffer_load per iteration, issued an iteration ahead; the loop counter is i32 and V lives in AGPRs. 488 VGPR, no scratch. - Packed partials are addressed from a 64-bit slot base: they can exceed 2**31 elements (e.g. 2049 sequences x 64 partitions). When this kernel will run (AITER_PA_MIMO_REGP not 0 and no query split above 1 requested), the calibrated default of this geometry (prepare_pa_decode_plan without a tuning-cache entry) keeps one query split and sizes the workgroup budget so that batch x P CTAs fill whole waves of CUs: P = floor(k x CUs / batch) for the fewest waves k <= 5 keeping >= 95% of them busy, 2 <= P <= 64. Its plan caps each sequence at 64 tasks instead of P and uses the planner's new balanced split (plan_pa_decode(balanced=True); proportional stays the default): each sequence gets ceil(tiles / X) tasks for the smallest X that fits the budget and is no less than the capped longest sequence's tiles per task (24-step bisection over block reductions in the plan kernel); leftover slots go to the sequences that would split further. Equal lengths keep the same plan (P partitions each); mixed lengths share one bound on the tiles per task. One layer, P cap -> this plan: 255 x 4K + 1 x 128K 1.95 -> 0.36 ms, 148 x 16K + 4 x 256K 3.78 -> 0.91 ms, 63 x 8K + 1 x 1M 2.10 -> 0.56 ms; 152 sequences of 4K-128K tokens 3.18 -> 2.61 ms against the proportional split at cap 64; equal lengths within 1% (graph batch 88 with 82 live -3.6%); plan refresh +8-13 us (+23-34 us at plan capacity above 1024). Otherwise the tile kernel keeps the per-batch table (304 CUs), whose two-split entries (24, 40, 208, 240, 256) would bypass this kernel and whose other batches take 16 partitions. PA cache keys now cover pa_decode_mimo.py. MI300X, one layer (kernel + reduce) vs PR ROCm#24's tile kernel with the same partitions and query_splits 1: 1.23-1.47x (152x64K 2.974 -> 2.198 ms, 10x1M 3.402 -> 2.308 ms). MiMo-V2.6-Flash DP2/TP8 decode matrix (DFlash block 8): +1.0% (4K), +8.4% (64K), +17.2% (1M) output tok/s; GSM8K 1319 0.908. op_tests/test_flydsl_pa_decode.py + test_flydsl_pa_compat.py: 291 passed, including partials past 2**31 elements and non-positive scales.
luocheng25
added a commit
to luocheng25/aiter
that referenced
this pull request
Nov 12, 2026
MiMo block-8 verify (BF16 Q/KV, Q/K 192, V 128, page 64, 16 query heads per KV head, query_length 8, one KV head, no window or sinks, query_splits 1, masked unowned KV, positive softmax scale) runs a dedicated kernel on gfx942 by default; AITER_PA_MIMO_REGP=0 selects the tile kernel. The kernel masks unscaled scores and divides by the scale, so other scales keep the tile kernel, which scales before masking. Four waves are two token groups x two row groups of 64 query rows. QK computes S^T = K Q^T, whose accumulators are PV's B operand, so the probabilities stay in registers: Q is held in registers and the tile loop has no LDS traffic and no barrier. Each wave keeps its own online softmax with a lazily moved reference max; the token groups merge once per task through LDS and write the shared reducer's partials. - Software pipeline: step c runs the softmax of c with the QK of c + 1, then PV(c); K(c + 2) and V(c + 1) are prefetched about a step ahead. - The softmax is emitted slot by slot with the QK MFMAs (one exponential or up to three scalar VALU per 16x16x16 MFMA), and packed FP32 is disabled: v_pk_* never co-issue with an MFMA on gfx942. - K/V use per-page buffer resources (page base in SGPRs, one lane VGPR, constants in the instruction offset); page ids come from one s_buffer_load per iteration, issued an iteration ahead; the loop counter is i32 and V lives in AGPRs. 488 VGPR, no scratch. - Packed partials are addressed from a 64-bit slot base: they can exceed 2**31 elements (e.g. 2049 sequences x 64 partitions). When this kernel will run (AITER_PA_MIMO_REGP not 0 and no query split above 1 requested), the calibrated default of this geometry (prepare_pa_decode_plan without a tuning-cache entry) keeps one query split and sizes the workgroup budget so that batch x P CTAs fill whole waves of CUs: P = floor(k x CUs / batch) for the fewest waves k <= 5 keeping >= 95% of them busy, 2 <= P <= 64. Its plan caps each sequence at 64 tasks instead of P and uses the planner's new balanced split (plan_pa_decode(balanced=True); proportional stays the default): each sequence gets ceil(tiles / X) tasks for the smallest X that fits the budget and is no less than the capped longest sequence's tiles per task (24-step bisection over block reductions in the plan kernel); leftover slots go to the sequences that would split further. Equal lengths keep the same plan (P partitions each); mixed lengths share one bound on the tiles per task. One layer, P cap -> this plan: 255 x 4K + 1 x 128K 1.95 -> 0.36 ms, 148 x 16K + 4 x 256K 3.78 -> 0.91 ms, 63 x 8K + 1 x 1M 2.10 -> 0.56 ms; 152 sequences of 4K-128K tokens 3.18 -> 2.61 ms against the proportional split at cap 64; equal lengths within 1% (graph batch 88 with 82 live -3.6%); plan refresh +8-13 us (+23-34 us at plan capacity above 1024). Otherwise the tile kernel keeps the per-batch table (304 CUs), whose two-split entries (24, 40, 208, 240, 256) would bypass this kernel and whose other batches take 16 partitions. PA cache keys now cover pa_decode_mimo.py. MI300X, one layer (kernel + reduce) vs PR ROCm#24's tile kernel with the same partitions and query_splits 1: 1.23-1.47x (152x64K 2.974 -> 2.198 ms, 10x1M 3.402 -> 2.308 ms). MiMo-V2.6-Flash DP2/TP8 decode matrix (DFlash block 8): +1.0% (4K), +8.4% (64K), +17.2% (1M) output tok/s; GSM8K 1319 0.908. op_tests/test_flydsl_pa_decode.py + test_flydsl_pa_compat.py: 291 passed, including partials past 2**31 elements and non-positive scales. Signed-off-by: Luo Cheng <[email protected]>
yanxuer-999
added a commit
to yanxuer-999/aiter
that referenced
this pull request
Nov 13, 2026
…on->mla_gluon rename aiter commit b50066a (2026-07-05, PR ROCm#3833 "Add DSv4 sparse MLA prefill Triton and unified MLA Gluon kernel") merged aiter/ops/triton/gluon/mla_decode_gluon.py into a new unified aiter/ops/triton/gluon/mla_gluon.py and renamed the entry point mla_decode_gluon -> mla_gluon. This benchmark script kept importing the old module/function, so it has crashed with ModuleNotFoundError on every daily CI run since build ROCm#24 (2026-07-07) and produced zero data for ~6 weeks (confirmed via central benchmark.db: last successful row was build ROCm#22, 2026-07-05). mla_gluon's decode-path signature is unchanged from mla_decode_gluon (q_nope, q_pe, kv_c, o, page_table, seq_info, sm_scale, use_2d_view, min_kv_seq_len, ...), so this is a drop-in rename with no other logic changes needed. Co-authored-by: Cursor <[email protected]> (cherry picked from commit 7ad610b)
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.
No description provided.