Skip to content

[FlyDSL] FlyDSL QSA indexer scorer + sparse GQA - #5996

Open
SamiAario-AMD wants to merge 178 commits into
samaario/flydsl-topk-decode-finite-onlyfrom
samaario/flydsl-qsa-indexer-sparse-gqa
Open

SamiAario-AMD wants to merge 178 commits into
samaario/flydsl-topk-decode-finite-onlyfrom
samaario/flydsl-qsa-indexer-sparse-gqa

Conversation

@SamiAario-AMD

@SamiAario-AMD SamiAario-AMD commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Add a FlyDSL QSA layer so the measured Flash-Next / qwen4_exp shapes can run the indexer and sparse GQA on FlyDSL. A rank-3 pair outside that measured table logs once and still runs FlyDSL. A query that is not rank 3 does not log; the indexer or sparse GQA reports it.
Family A is the production shape: indexer query [M, 4, 128] or [M, 8, 128] BF16 over paged compressed K, and sparse GQA query [M, 24, 256] BF16 over paged K/V with 2 KV heads. Family B is the #4882 Gluon-parity shape (Hq=10, D=128, indexer heads 4 or 8). The family A goal is an end-to-end layer that beats the live AMD kernels pinned from vLLM.

Jira ID : SILOTIGER-1047

Technical Details

Public entry points are on aiter.ops.flydsl. qsa_k1_block_ids and qsa_k2 remain as one-release aliases of qsa_indexer_block_ids and flydsl_qsa_paged_gqa.

  • qsa_indexer_block_ids writes indexer block_ids [M, 512]. Rows of at most 512 blocks use the fused emit kernel and skip scoring. Longer rows score with BF16 MFMA into an fp32 score buffer. The one-row scorer tiles BLOCK_N=32. Batches averaging two or more rows per request use the row scorer: 64 columns per workgroup and 16 query rows. gfx942 with 8 indexer heads stays on the one-row scorer; the row scorer has not been measured there. With 4 indexer heads and fewer than 16 rows per request, that scorer folds 4 rows by 4 heads onto the MFMA M axis, so a tile holds 4 rows. Head counts 4 and 8 are separate compiles. Selection depends on the row count as well as the width. Padded decode, more than 20000 columns and at most 64 rows, selects with the one-workgroup radix on the full width and stops at each row's visible length. Prefill, more than 64 rows, keeps the allocation width and uses the stable decode radix. A packed table at or under 20000 columns uses that radix as well. The scorer's streaming radix is for a prefix at or above 32768 columns on a batch of at most 64 rows that is not the padded-decode path. qsa_indexer_block_ids sends that wider table down the padded-decode path instead. The score workspace is at most 128 MiB. Rows past that are scored in chunks, and the scorer and selector stay the ones chosen for the whole batch.
  • flydsl_qsa_paged_gqa writes sparse GQA o [M, Hq, D] at the selected token ids. Decode uses a BLOCK_N=16 two-wave tile (128 threads) with split-K and an FP32 LSE merge. Prefill uses BLOCK_N=32 over two waves and writes the output directly once the grid fills the machine. Softmax is online in log2. Split bands are fitted on head_dim (D<=128 versus wider). gfx942 overlays K and V in one LDS tile. gfx950 decode overlays one tile. gfx950 prefill keeps separate K and V regions. A tile whose shared memory exceeds that arch's LDS capacity is rejected.
  • qsa_layer is the opt-in. It runs the indexer, in-tree qsa_expand_block_indices (selected blocks plus the incomplete tail), and sparse GQA. The measured table is (Hq, D) at indexer heads 4 and 8: (24, 256) (Flash-Next TP1, 2 KV heads), (12, 256) (TP2, 1 KV head), (6, 256) (TP4, 1 KV head), (3, 256) (TP8, 1 KV head), and (10, 128) (Gluon-parity). A rank-3 pair outside that table logs once and still runs. A query that is not rank 3 does not log. The sigmoid gate and partial RoPE stay outside the layer.
  • qsa_oracle is the fp32 reference. It and the family A and B fixtures live in op_tests/test_flydsl_qsa.py. op_tests/qsa_ref.py is removed.
  • Launches are limited to gfx942 and gfx950. The indexer and paged GQA keep the whole-cache descriptor under 4 GiB and rebase pages only for larger caches. An empty paged-GQA cache or page table returns zeros before launch. A caller may pass a paged-GQA split workspace; the wrapper allocates one when it is omitted.
  • Runtime coverage is JIT. aiter/aot/flydsl/qsa_paged.py only warms Flash-Next TP1 (Family A: Hq=24, Hkv=2, D=256, indexer heads 4, page size 16) on gfx942 and gfx950. The six jobs are the indexer emit kernel, the 4-head one-row scorer (decode M=1 and M=8 share it), the 4-head 16-row prefill scorer, and three sparse GQA launches: M=1 (BLOCK_N=16, 128 splits), M=8 (BLOCK_N=16, 32 splits), and M=512 (BLOCK_N=32, one split). tiles_per_wg is a runtime argument of the 16-row scorer. The prefill job is M=512, L=8192, and that launch uses four column tiles per workgroup. The long-row indexer jobs also compile the stable decode radix. Every other compile is built on first use. That includes TP2/4/8 ((12, 256), (6, 256), (3, 256)), (10, 128), the 8-head scorers, the other split counts (M=2 is 64 splits, M=16 is BLOCK_N=32 with 32 splits), every wide-cache stride, the compact one-workgroup and streaming indexer selectors, and the valid-page pack that follows the streaming and split selectors. Wide-cache strides are compile constants, so enumerating the current keys cannot prebuild them. Collapsing those keys into runtime arguments is not part of this change.

Test Plan

  • Unit gate: pytest -q op_tests/test_flydsl_qsa.py
    • Oracle hand checks for visible blocks, tie-break, incomplete blocks, and dense GQA.
    • Indexer set equality on short decode, two tiles, the wide streaming path, and prefill, including padded page tables and invalid page ids.
    • Paged GQA against the fp32 oracle on family A decode and prefill, plus empty-cache, empty-first-tile, stride, 4 GiB descriptor, and caller-workspace cases.
    • qsa_layer against the oracle for Flash-Next and Gluon-parity, a one-time warning for an unswept rank-3 pair, and a HIP-graph replay of decode.
    • The measured table is (24, 256), (12, 256), (6, 256), (3, 256), and (10, 128), each at indexer heads 4 and 8. The arch allowlist accepts gfx942 and gfx950.
  • Perf sweep, cold weights: HIP_VISIBLE_DEVICES=<gpu> python3 op_tests/test_flydsl_qsa.py --rotate 0
    • Family A indexer and sparse GQA, decode (M<=8) and prefill, for --gqa 24,2 / 12,1 / 6,1 / 3,1; family B indexer (8 heads) and end-to-end qsa_layer at indexer heads 4 and 8; Flash-Next end-to-end at indexer heads 4; decode HIP-graph replay for M<=8. The reference is the fp32 oracle. The sweep fails on an indexer set mismatch or a sparse-GQA or end-to-end error above rtol=1e-2, atol=1e-2. Defaults time M in {1, 8, 512} and a packed cache. The recorded result passes the full M list and --cache-layout packed wide.

Test Result

The gfx950 grid below was recorded 2026-11-10 at 30f111b40f on GPU 5 (MI355X, 256 CUs, BDF 0000:85:00.0), flydsl_venv, torch 2.12.0+rocm7.14.0, FlyDSL 0.4.2. Cold --rotate 0, packed and wide caches, --pad-pages 0. Page size is 16, except the Gluon-parity published indexer point, which is page size 8. Packed rows use the harness auto-rotate. Wide rows rotate the live pages inside the stride gaps, and each timed view still spans past 4 GiB. The HIP-graph table is a one-buffer replay and does not follow --rotate. Performance is measured through 32768 context tokens. The device was idle before the unit gate (0% use, about 0.28 GiB resident). get_cu_num() on this GPU is 256. The sweep followed on that device and exited 0 (2026-11-10T08:28:19Z to 2026-11-10T08:35:41Z).

HIP_VISIBLE_DEVICES=5 python3 op_tests/test_flydsl_qsa.py \
  -b 1 2 3 4 6 8 12 16 32 64 128 256 512 \
  -s 512 2048 8192 32768 \
  --rotate 0 --cache-layout packed wide \
  --gqa 24,2 12,1 6,1 3,1

Every err column in that grid is 0. The timed candidate is FlyDSL against the fp32 oracle. Packed and wide are separate rows.

  • Flash-Next indexer, 4 heads: 104 rows (48 decode M<=8, 56 prefill).
  • Flash-Next sparse GQA: 416 rows (192 decode, 224 prefill). Ranks are TP1 (24, 2), TP2 (12, 1), TP4 (6, 1), and TP8 (3, 1), head dim 256.
  • Flash-Next end-to-end, same four ranks, indexer heads 4: 416 rows (192 decode, 224 prefill).
  • Flash-Next decode HIP graph, M<=8, same four ranks: 192 rows.
  • Gluon-parity indexer, 8 heads, (10, 128): 104 rows (52 at L=512 and L=2048, 52 at L=8192 and L=32768).
  • Gluon-parity published indexer point, 4 heads, M=32, L=2048, page size 8: 2 rows.
  • Gluon-parity end-to-end, indexer heads 4 and 8: 208 rows.

No requested M exceeds its L, so none of those rows were skipped. The six ahead-of-time jobs warm Flash-Next tensor-parallel 1 only. TP2/4/8, (10, 128), the 8-head scorers, and every wide-cache stride in this grid compiled on first use during the sweep. The unit cases in op_tests/test_flydsl_qsa.py cover the oracle, indexer set equality, sparse GQA numerical match, the measured-table warning, and the ahead-of-time job list. On this same idle GPU, HIP_VISIBLE_DEVICES=5 python3 -m pytest -q op_tests/test_flydsl_qsa.py passed 61 tests in 23.15s (2026-11-10T08:27:47Z to 2026-11-10T08:28:13Z). None were skipped. aiter/aot/flydsl/common.py lists aiter.aot.flydsl.pa_decode_plan in AOT_MODULES immediately before qsa_paged. Importing aiter.ops.qsa loads qsa_sparse_prefill. The run includes test_qsa_aot_targets_follow_gpu_archs_without_a_device, the large-negative single-token score, the empty-indexer causal tail, the four-tile request span, and the graph replay that rewrites captured lengths. test_flydsl_decode_finite_only_drops_nonfinite was called directly, because op_tests/test_topk_per_row.py parses argv at import and then runs its sweep. It printed [finite-only] PASS (2026-11-10T08:28:13Z to 2026-11-10T08:28:19Z).

On this head, gfx942, GPU 7 (MI300X, 304 CUs, BDF 0000:CF:00.0), flydsl_venv, torch 2.12.0+rocm7.14.0, FlyDSL 0.4.2, 2026-11-10. The device was idle before the unit gate (0% use, about 0.28 GiB resident). get_cu_num() is 304 and multi_processor_count is 304. ROCM_PATH points at the ROCm SDK wheel root. Every gfx942 run below used an empty FLYDSL_RUNTIME_CACHE_DIR, so each kernel was compiled and serialized in that run. HIP_VISIBLE_DEVICES=7 python3 -m pytest -q op_tests/test_flydsl_qsa.py passed 61 tests in 45.71s (2026-11-10T09:16:42Z to 2026-11-10T09:17:30Z). None were skipped. That run includes test_qsa_aot_targets_follow_gpu_archs_without_a_device, the large-negative single-token score, the empty-indexer causal tail, the four-tile request span, the graph replay that rewrites captured lengths, and the compact selector, including the captured decode replay. test_flydsl_decode_finite_only_drops_nonfinite was called directly and printed [finite-only] PASS (2026-11-10T09:17:54Z to 2026-11-10T09:18:02Z).

The compact selector was measured on topk_per_row_decode_1wg_k512_wave64_wv0_compact1_finite1, which qsa_indexer_block_ids launches, and on topk_per_row_decode_1wg_k512_wave64_wv0_compact0_finite1 (2026-11-10T09:04:33Z to 2026-11-10T09:04:39Z). llvm-readobj reports a group segment of 41120 bytes with compact storage and 8352 bytes without. HIP occupancy is 1 workgroup per CU and 2. The compact object has 41 VGPRs and 76 SGPRs; the other has 36 and 74. Both are wave 64 and 1024 threads, one workgroup per row. Width is 32768 and k is 512. A row with 2000 tied winning columns takes the compact buffer. A row of equal scores is past the 4096-candidate limit, so that buffer stays unused while the compact build still reserves its LDS. Both builds matched a stable argsort before timing. Each time is the median of 5 trials of 20 HIP-graph replays, from CUDA events, after 5 warmup replays. Rows that use the compact buffer: M=1 is 49.99 µs against 57.88 µs with compact storage off, M=8 is 50.15 µs against 58.01 µs, and M=64 is 50.45 µs against 58.28 µs. Those grids fit in one wave on 304 CUs. Exact-tie rows: M=1 is 114.46 µs against 114.43 µs, M=8 is 114.58 µs against 114.51 µs, M=64 is 114.87 µs against 114.86 µs, and M=304 is 118.65 µs against 118.58 µs. M=608 is outside this dispatch: 234.16 µs with compact storage and 219.94 µs without it.

The perf command from the gfx950 record was run here and exited 0 (2026-11-10T09:18:11Z to 2026-11-10T09:25:53Z). The device was idle before it (0% use). Every err column is 0, and the row counts match gfx950. Flash-Next indexer: 104 rows (48 decode, 56 prefill). Sparse GQA: 416 (192 decode, 224 prefill). End-to-end: 416. Decode HIP graph: 192. Gluon-parity indexer, 8 heads: 104. Published indexer point: 2. Gluon-parity end-to-end: 208. Each table is split evenly between packed and wide caches. The 2026-10-30 gfx942 perf record and the 2026-11-05 gfx942 unit gate do not describe this head. indexer_select.py, sparse_gqa.py, aiter/ops/flydsl/qsa_paged.py, aiter/aot/flydsl/qsa_paged.py, aiter/ops/flydsl/kernels/topk/topk_per_row_decode_persistent.py, and op_tests/test_flydsl_qsa.py differ from 0a90af8e54bb and from 48cdcb28588a. op_tests/qsa_ref.py is removed. sparse_decode_attn.py and sparse_decode_reduce.py are the same blobs as those commits.

Submission Checklist

PR Self-Review

Reviewed revision

30f111b

Behavior and intent

AITER has no FlyDSL indexer or sparse paged-GQA path for the Flash-Next and Gluon-parity QSA shapes, so those calls stay on the live AMD kernels. This revision adds qsa_indexer_block_ids, flydsl_qsa_paged_gqa, and qsa_layer on gfx942 and gfx950, and keeps qsa_k1_block_ids and qsa_k2 as one-release aliases. Measured rank-3 pairs are (24, 256), (12, 256), (6, 256), (3, 256), and (10, 128) at indexer heads 4 and 8. An unswept rank-3 pair logs once and still runs FlyDSL. The CI edit makes op_tests/test_flydsl_qsa.py run its pytest cases and then the perf script. The default python3 invocation only sweeps and would leave the unit cases uncollected.

Validation and unverified scope

Unit gate on this head, gfx950, GPU 5 (MI355X, 256 CUs, BDF 0000:85:00.0), flydsl_venv, torch 2.12.0+rocm7.14.0, FlyDSL 0.4.2, 2026-11-10. The device was idle (0% use, about 0.28 GiB resident). get_cu_num() is 256. aiter/aot/flydsl/qsa_paged.py imports compile_only_env from aiter/aot/flydsl/common.py. That module lists aiter.aot.flydsl.pa_decode_plan in AOT_MODULES immediately before qsa_paged. Loading aiter.ops.qsa imports qsa_expand_block_indices from aiter.ops.triton.attention.qsa and flydsl_qsa_sparse_prefill from aiter.ops.flydsl.qsa_sparse_prefill. The gate was run on this head:

HIP_VISIBLE_DEVICES=5 python3 -m pytest -q op_tests/test_flydsl_qsa.py

61 passed in 23.15s (2026-11-10T08:27:47Z to 2026-11-10T08:28:13Z). None were skipped. That run includes test_qsa_aot_targets_follow_gpu_archs_without_a_device, the large-negative single-token score (one split and a merged width, plus a fully masked row), the empty-indexer causal tail, the four-tile request span, and the graph replay that rewrites captured lengths.

test_flydsl_decode_finite_only_drops_nonfinite printed [finite-only] PASS on this GPU (2026-11-10T08:28:13Z to 2026-11-10T08:28:19Z). op_tests/test_topk_per_row.py parses argv at import and then runs its sweep, so that check was the function rather than pytest -k. The unit gate does run the compact selector, including the captured decode replay.

Cold --rotate 0, packed and wide caches, --pad-pages 0. The process exited 0 (2026-11-10T08:28:19Z to 2026-11-10T08:35:41Z):

HIP_VISIBLE_DEVICES=5 python3 op_tests/test_flydsl_qsa.py -b 1 2 3 4 6 8 12 16 32 64 128 256 512 -s 512 2048 8192 32768 --rotate 0 --cache-layout packed wide --gqa 24,2 12,1 6,1 3,1

Every err column is 0. Flash-Next indexer: 104 rows (48 decode, 56 prefill). Sparse GQA: 416 (192 decode, 224 prefill). End-to-end: 416. Decode HIP graph: 192. Gluon-parity indexer, 8 heads: 104 (52 at L=512 and L=2048, 52 at L=8192 and L=32768). Published indexer point, 4 heads: 2. Gluon-parity end-to-end: 208. The indexer, sparse GQA, Gluon-parity indexer, published-point, end-to-end, HIP-graph, and Gluon-parity end-to-end tables were counted from the logged summaries. No requested M exceeds its L, so none of those rows were skipped. The sweep does not call qsa_sparse_prefill.

Unit gate on this head, gfx942, GPU 7 (MI300X, 304 CUs, BDF 0000:CF:00.0), flydsl_venv, torch 2.12.0+rocm7.14.0, FlyDSL 0.4.2, 2026-11-10. The device was idle (0% use, about 0.28 GiB resident). get_cu_num() is 304 and multi_processor_count is 304. ROCM_PATH is the ROCm SDK wheel root, and FLYDSL_RUNTIME_CACHE_DIR started empty, so every kernel below was compiled and serialized in its run. The gate was run on this head:

HIP_VISIBLE_DEVICES=7 python3 -m pytest -q op_tests/test_flydsl_qsa.py

61 passed in 45.71s (2026-11-10T09:16:42Z to 2026-11-10T09:17:30Z). None were skipped. That run includes test_qsa_aot_targets_follow_gpu_archs_without_a_device, the large-negative single-token score, the empty-indexer causal tail, the four-tile request span, the graph replay that rewrites captured lengths, and the compact selector, including the captured decode replay.

test_flydsl_decode_finite_only_drops_nonfinite printed [finite-only] PASS on this GPU (2026-11-10T09:17:54Z to 2026-11-10T09:18:02Z).

topk_per_row_decode_1wg_k512_wave64_wv0_compact1_finite1 (launched by qsa_indexer_block_ids) and topk_per_row_decode_1wg_k512_wave64_wv0_compact0_finite1 were measured on this GPU (2026-11-10T09:04:33Z to 2026-11-10T09:04:39Z). Group segment is 41120 bytes and 8352 bytes. HIP occupancy is 1 workgroup per CU and 2. VGPRs/SGPRs are 41/76 and 36/74. Both are wave 64 and 1024 threads, one workgroup per row, width 32768, k=512. A row with 2000 tied winning columns uses the compact buffer. An equal-score row is past 4096 candidates, so the buffer stays unused. Both builds matched a stable argsort. Each time is the median of 5 trials of 20 HIP-graph replays, CUDA events, after 5 warmup replays. Compact-buffer rows: M=1 49.99 µs against 57.88 µs, M=8 50.15 µs against 58.01 µs, M=64 50.45 µs against 58.28 µs. Exact-tie rows: M=1 114.46 µs against 114.43 µs, M=8 114.58 µs against 114.51 µs, M=64 114.87 µs against 114.86 µs, M=304 118.65 µs against 118.58 µs. M=608 is outside this dispatch: 234.16 µs with compact storage and 219.94 µs without it.

The gfx950 perf command was run on this GPU and exited 0 (2026-11-10T09:18:11Z to 2026-11-10T09:25:53Z). The device was idle (0% use).

HIP_VISIBLE_DEVICES=7 python3 op_tests/test_flydsl_qsa.py -b 1 2 3 4 6 8 12 16 32 64 128 256 512 -s 512 2048 8192 32768 --rotate 0 --cache-layout packed wide --gqa 24,2 12,1 6,1 3,1

Every err column is 0, and each table has the gfx950 row count, split evenly between packed and wide caches. Flash-Next indexer: 104 rows (48 decode, 56 prefill). Sparse GQA: 416 (192 decode, 224 prefill). End-to-end: 416. Decode HIP graph: 192. Gluon-parity indexer, 8 heads: 104. Published indexer point, 4 heads: 2. Gluon-parity end-to-end: 208. indexer_select.py, sparse_gqa.py, aiter/ops/flydsl/qsa_paged.py, aiter/aot/flydsl/qsa_paged.py, aiter/ops/flydsl/kernels/topk/topk_per_row_decode_persistent.py, and op_tests/test_flydsl_qsa.py differ from 0a90af8e54bb and from 48cdcb28588a. op_tests/qsa_ref.py is removed. The 2026-10-30 gfx942 perf record and the 2026-11-05 gfx942 unit gate do not describe this head. sparse_decode_attn.py and sparse_decode_reduce.py are the same blobs as those commits.

PR-specific question

The only CI edit is a case in .github/scripts/aiter_test.sh for op_tests/test_flydsl_qsa.py. It runs python3 -m pytest -q on that file, then python3 on the same path, under the existing 60-minute timeout. The path is the shard-list entry passed as $1. The bash body does not interpolate the PR title, body, or comments. aiter-test.yaml is unchanged and still triggers on pull_request. The standard job already checks out the PR head and executes that checkout. Fork pull requests still do not receive registry secrets: Docker login stays gated on a non-fork head. This case adds no pull_request_target trigger, token permission, id-token, or S3 upload. Fork code can already run as the GPU test process. It cannot reach the main-only AWS upload role or the fork-withheld Docker credentials through this change.

Changed op tests

qsa_oracle and the Flash-Next and Gluon-parity fixtures (visible blocks, tie-break, incomplete tail, paged gather) live in op_tests/test_flydsl_qsa.py. op_tests/qsa_ref.py is removed, so the reference is not a second suite and is not copied into the kernel package.

op_tests/test_flydsl_qsa.py is new. Pytest covers indexer set equality, invalid pages, wide caches past 4 GiB, D=128 group-16 and single-split GQA, LDS rejection, graph capture with a second replay of rewritten lengths, a four-tile request span, the empty-indexer causal tail, qsa_layer against the oracle, and test_paged_gqa_large_negative_score_keeps_weight (one live token whose scaled score is below -1e20, at one split and at a merged width, plus a fully masked row). __main__ is the perf sweep. test_flydsl_qsa_sparse_decode.py covers the pool sparse decoder, and the Triton QSA tests do not call these FlyDSL entry points. The new CI case is what runs the pytest layer. python3 alone does not.

op_tests/test_topk_per_row.py adds test_flydsl_decode_finite_only_drops_nonfinite. The indexer selector now passes finite_only and must drop NaN and +inf. The existing sampled-NaN checks rank NaN above +inf when finite_only is false, so they stay green if finite_only still returns a nonfinite column.

@SamiAario-AMD
SamiAario-AMD requested a review from a team September 30, 2026 10:12
@SamiAario-AMD
SamiAario-AMD marked this pull request as draft September 30, 2026 10:12
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

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

Extended tests (opt-in via labels):

Label Tests
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
multigpu 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: GPT-OSS-120B, DeepSeek-R1-0528, Kimi-K2.5
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 5996 --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-actions github-actions Bot changed the title FlyDSL QSA indexer scorer + sparse GQA [Triton/Gluon] [FlyDSL] FlyDSL QSA indexer scorer + sparse GQA Sep 30, 2026
@SamiAario-AMD
SamiAario-AMD force-pushed the samaario/flydsl-qsa-indexer-sparse-gqa branch from 05c08d3 to 5f182c1 Compare September 30, 2026 10:19
@SamiAario-AMD

SamiAario-AMD commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor Author

I'm not sure if we need other public entry points than qsa_layer.

Also qsa_layer can serve both the FlyDSL and Triton backends, the latter being the vLLM-vendored one. The default is auto, which picks FlyDSL when FlyDSL is known to beat Triton. Since FlyDSL has beat Triton on every tested shape on gfx950, this may be overcomplicating things and we could just drop the Triton backend from qsa_layer altogether.

@SamiAario-AMD
SamiAario-AMD force-pushed the samaario/flydsl-qsa-indexer-sparse-gqa branch from 5f182c1 to 1bdae6e Compare September 30, 2026 10:37

@mjkvaak-amd mjkvaak-amd left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Sami. I'm wiring this into vLLM's Qwen4Exp (Flash-Next) QSA path at TP2, and hit three things. Details are inline.

  1. K2 copies vLLM's paged KV cache on every call. vLLM keeps a QSA layer's K and V in one [pages, page_size, H, 2*D] buffer and hands attention two strided views of it (kv_cache.transpose(1, 2).split(D, dim=-1) in vllm/models/qwen4_exp/amd/qsa.py). qsa_k2 makes both contiguous, which copies the whole layer's K/V cache rather than the selected rows, and does it inside every captured decode graph. qsa_k2_serves accepts those views, so nothing flags it.
  2. auto never picks FlyDSL beyond TP1. _MEASURED_QUERIES is keyed on the per-rank GQA shape. Flash-Next has 24 query heads over 2 KV heads, so at TP2 a rank sees (12, 256) over 1 KV head, and qsa_layer(backend="auto") stays on Triton without logging anything.
  3. Please keep qsa_k1_block_ids and qsa_k2 public. This is about your comment on narrowing the public entry points to qsa_layer. In vLLM, selection runs inside the indexer, and sparse attention runs later in the attention owner after the KV-cache update. MTP also reuses one step's selection across later draft steps (skip_topk), so the two halves don't run back to back. vLLM's integration therefore calls K1 (and then the same expand kernel) and K2 separately rather than qsa_layer. Dropping the Triton backend from qsa_layer is fine from our side.

Proposed fix for 1: one commit on top of this branch, mjkvaak-amd@4a932f0. The inline suggestions below are the call-site parts of it.

  • Normal path: only the .contiguous() calls go. FlyDSL passes a torch tensor's non-leading strides at runtime by default (layout-dynamic TorchTensorJitArg), and the normal-path descriptor already indexes through that layout.
  • Over-4 GiB path: it takes the page, token and head strides as build parameters of build_qsa_k2_module / _plan. A non-dense set is added to the kernel name, so dense caches keep today's symbols and AOT names.
  • 4 GiB decision: it uses the view's byte span. numel undercounts a K|V-interleaved view by about 2×.
  • qsa_k2_serves: it now rejects views the kernel can't read in place.
  • Tests: two new K2 cases in op_tests/test_flydsl_qsa.py.
    • test_k2_interleaved_kv_view_matches_contiguous requires bit-equal output against contiguous copies, at family A and its TP2 shard, M = 2 and 512.
    • test_k2_interleaved_kv_page_past_4gib uses an interleaved view whose far page starts at byte 2^32. Its numel alone would pick the narrow descriptor.

Comment thread aiter/ops/flydsl/kernels/qsa/k2.py Resolved
Comment thread aiter/ops/flydsl/kernels/qsa/k2.py Resolved
Comment thread aiter/ops/flydsl/kernels/qsa/k2.py Resolved
Comment thread aiter/ops/flydsl/qsa.py Resolved
Comment thread aiter/ops/flydsl/kernels/qsa/k1.py Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Dispatch gaps, unsafe Triton output handling, dropped scale parameters, and backend-scope violations must be resolved.

Review effort: Balanced
Findings: 2 High severity · 9 Medium severity · 11 Low severity

Open (22)

And 2 more that still need to be addressed.

What changed in this PR

Adds a FlyDSL QSA indexer and sparse GQA path, with automatic dispatch and a pinned Triton fallback.

Changes:

  • Implements FlyDSL K1/K2 kernels, paging utilities, oracle, and shape contracts.
  • Adds public dispatch, architecture gating, and AOT jobs.
  • Vendors the live AMD Triton QSA fallback.
File Description
op_tests/​qsa_shapes.py Defines validated QSA fixtures.
aiter/​ops/​triton/​attention/​qsa_vllm_amd.py Exposes Triton fallback APIs.
aiter/​ops/​triton/​_triton_kernels/​attention/​qsa_vllm_amd.py Implements pinned Triton QSA kernels.
aiter/​ops/​flydsl/​qsa.py Provides public QSA dispatch and composition.
aiter/​ops/​flydsl/​kernels/​qsa/​shapes.py Defines QSA shape descriptors.
aiter/​ops/​flydsl/​kernels/​qsa/​paged.py Adds paged-cache helpers.
aiter/​ops/​flydsl/​kernels/​qsa/​oracle.py Implements the FP32 reference.
aiter/​ops/​flydsl/​kernels/​qsa/​k2.py Implements sparse GQA.
aiter/​ops/​flydsl/​kernels/​qsa/​k1.py Implements scoring and block selection.
aiter/​ops/​flydsl/​kernels/​qsa/​arch.py Defines the architecture allowlist.
aiter/​ops/​flydsl/​kernels/​qsa/​__init__.py Exports QSA helpers.
aiter/​ops/​flydsl/​__init__.py Exposes public QSA symbols lazily.
aiter/​aot/​flydsl/​qsa.py Registers QSA AOT jobs.
aiter/​aot/​flydsl/​common.py Adds QSA to AOT dispatch.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread aiter/ops/flydsl/kernels/qsa/k2.py Resolved
Comment thread aiter/ops/flydsl/qsa.py Resolved
Comment thread aiter/ops/flydsl/qsa.py Resolved

@mjkvaak-amd mjkvaak-amd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking d10d02a and the per-TP rows so quickly. Two follow-ups from running this in vLLM, inline:

  1. K1 (k1.py:920): correction to my earlier comment. I said vLLM's compressed indexer cache is contiguous, so K1's .contiguous() was harmless. That was wrong: in a real server the cache arrives as a strided view, so K1 has the same whole-cache copy problem K2 had.
  2. TP2 row (qsa.py:54). That shape was swept on gfx942. On gfx950 end-to-end at TP2, the FlyDSL arm lost to the existing AMD path in all three probe cells. It's not yet separated from my vLLM glue, so I'm treating it as a flag rather than a verdict.

Comment thread aiter/ops/flydsl/kernels/qsa/k1.py Resolved
Comment thread aiter/ops/flydsl/qsa_paged.py Resolved
mjkvaak-amd added a commit to mjkvaak-amd/vllm-project that referenced this pull request Oct 2, 2026
…r and sparse GQA

With VLLM_ROCM_QSA_FLYDSL=1, QSA selection scores and ranks compressed
blocks with FlyDSL K1 from ROCm/aiter#5996 and keeps the Triton expand,
and sparse GQA runs FlyDSL K2 directly on the paged K|V cache views.
Shapes either kernel cannot serve stay on the Triton path. The kernels
are called directly rather than through qsa_layer, whose auto mode only
admits the TP1 query shape, and so that MTP's top-k reuse is unchanged.

Signed-off-by: Mikko Tukiainen <[email protected]>
@SamiAario-AMD
SamiAario-AMD force-pushed the samaario/flydsl-qsa-indexer-sparse-gqa branch 2 times, most recently from 8ad96f4 to d4cac25 Compare October 2, 2026 06:29
@SamiAario-AMD SamiAario-AMD self-assigned this Oct 2, 2026
@SamiAario-AMD
SamiAario-AMD added this pull request to stack #6084 October 2, 2026 08:25
@mjkvaak-amd

Copy link
Copy Markdown
Contributor

In vLLM (#59437), K1 is slower than the existing Triton path because the block table is padded to max_model_len: 168 pages of 392 rows gives 65,856 columns on every call. Tiles past each row's row_len still run the full K gather and MFMA, and both selectors then discard them.

Fix, cherry-pickable on aab0dd6: mjkvaak-amd@c453761

Both scorers skip tiles past the row's visible blocks; the 16-row scorer uses the block's largest. test_k1_table_padded_to_max_model_len covers a padded table with decode, mixed and tile-edge prefill rows. It fails if either bound is off by a tile.

K1 µs per call, vLLM TP2 shapes, MI355X, CUDA graph replay:

batch Triton #5996 + fix
decode 4 x 8.7k 28.8 47.9 32.6
decode 64 x 8.7k 190.5 300.0 60.9
decode 64 x 60k 201.8 301.6 96.8
2048-row prefill + 16 x 8.7k 5173 8577 962
2048-row prefill + 16 x 60k 5184 8562 979

Selections equal Triton's in every row. At 4 decode requests K1 is still 5-13% behind: dead tiles now exit early but are still launched. A tile loop bounded by visible would close that.

K2 needs nothing: it matches or beats Triton everywhere (35 vs 45 µs at 64 x 60k).

@SamiAario-AMD

Copy link
Copy Markdown
Contributor Author

Fix, cherry-pickable on aab0dd6: mjkvaak-amd@c453761

The fix is in as df71ed9. I am looking into closing the rest of the gap this revealed, as you suggested.

@SamiAario-AMD

Copy link
Copy Markdown
Contributor Author

The K1 gap was in TopK. 48510f1 adds a padded K1 benchmark regime, aee5e8d closes the TopK gap, and e1315a9 adjusts testing due to a BF16 accuracy issue that surfaced. The last commit may be something worth revisiting.

@mjkvaak-amd

mjkvaak-amd commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

K1 width readback breaks decode graph capture

aee5e8d9e added _k1_max_visible_columns(), which ends in scratch.item(). It runs whenever n_columns > _ONE_WORKGROUP_MAX_ROW_WIDTH and m <= _DECODE_MAX_ROWS, which is every padded decode batch. Under vLLM's full-graph decode capture this raises:

torch.AcceleratorError: CUDA error: operation not permitted when stream is capturing
  aiter/ops/flydsl/kernels/qsa/k1.py:912  return int(scratch.item())

Even without the error, a captured readback would freeze the width of the capture batch into the graph.

Proposed fix: keep the allocation width while the stream is capturing, as prefill already does.

-    if n_columns > _ONE_WORKGROUP_MAX_ROW_WIDTH and m <= _DECODE_MAX_ROWS:
+    if (
+        n_columns > _ONE_WORKGROUP_MAX_ROW_WIDTH
+        and m <= _DECODE_MAX_ROWS
+        and not torch.cuda.is_current_stream_capturing()
+    ):
         live_columns = _k1_max_visible_columns(

Cherry pick 60b57f049 on top of e1315a9e2. It also adds test_k1_padded_decode_graph_capture, which captures qsa_k1_block_ids on a table padded to 4096 pages with decode lengths [3000, 9000, 30000, 65536], then checks two replays (the second one with new q) against the oracle.

git fetch https://github.com/mjkvaak-amd/aiter rocm/qsa-k1-no-readback-in-capture
git cherry-pick 60b57f049

pytest op_tests/test_flydsl_qsa.py -k 'test_k1_padded_decode_graph_capture or test_k1_table_padded_to_max_model_len', 1x MI355X:

k1.py Result
e1315a9e2 (PR head) 1 failed (capture test, error above), 1 passed
60b57f049 2 passed

@mjkvaak-amd

Copy link
Copy Markdown
Contributor

In vLLM serving, every K1/K2 call takes the wide (>4 GiB) path, and that path is what makes FlyDSL QSA lose to Triton end to end

On Qwen3.8-Flash-Next TP2 (MI355X), turning VLLM_ROCM_QSA_FLYDSL=1 on costs 9–39% output throughput, nearly all of it in prefill (TTFT +49% to +82%, TPOT +3% to +11%). The kernel benchmarks, including op_tests and the numbers in this thread, all use packed caches under 4 GiB, where FlyDSL wins. vLLM's caches look different.

1. The serving cache is always wide

I logged _span_bytes(k_cache) at the wide_cache check in qsa_k1 and qsa_k2 in a running server (PR head e1315a9, plus the capture guard from my earlier comment):

kernel=k1 shape=(10175, 392, 1, 128)  stride=(10235904, 128, 128, 1) numel=0.95 GiB  span=193.98 GiB  wide=True
kernel=k2 shape=(10175, 1568, 1, 256) stride=(10235904, 512, 256, 1) numel=7.61 GiB  span=193.98 GiB  wide=True

vLLM allocates one KV pool and hands each layer a strided view into it, so the page stride covers every layer's page. Each view spans the whole pool, here 194 GiB, whatever its numel. The narrow body never runs in serving, at any batch size.

2. The wide body serializes the row gathers in waterfall loops

kv_row (k2.py:366 onward) and k_page_row (k1.py:251 and 535) compute a 64-bit address per gathered row and wrap it in make_buffer_tensor. A V# has to live in SGPRs, but the address is per lane, and with sparse indices every row is on a different page. So the compiler wraps each buffer_load in a v_readfirstlane waterfall loop that runs once per distinct row in the wave. From the final ISA (FLYDSL_DUMP_IR=1):

Kernel v_readfirstlane narrow → wide waterfall loops narrow → wide instructions narrow → wide
qsa_k2_split (hq12 hk1 d256 ps1568) 0 → 64 0 → 16 935 → 1130
qsa_k1_scores 0 → 16 0 → 4 350 → 394
qsa_k1_prefill_scores 0 → 16 0 → 4 917 → 993
.LBB0_3:
	v_readfirstlane_b32 s8, v66
	v_readfirstlane_b32 s9, v67
	v_readfirstlane_b32 s10, v68
	v_readfirstlane_b32 s11, v69
	v_cmp_eq_u64_e64 s[4:5], s[8:9], v[66:67]
	v_cmp_eq_u64_e64 s[6:7], s[10:11], v[68:69]
	s_and_b64 s[4:5], s[4:5], s[6:7]
	s_and_saveexec_b64 s[4:5], s[4:5]
	buffer_load_dwordx4 v[70:73], v110, s[8:11], 0 offen
	s_xor_b64 exec, exec, s[4:5]
	s_cbranch_execnz .LBB0_3

3. Kernel timings at vLLM's shapes, narrow vs wide

One MI355X on an otherwise idle node. Decode is timed under HIP-graph replay, prefill eagerly as vLLM runs it. The block table is padded to max_model_len (168 pages), and the wide case is the same data in a view spanning 5 GiB. Times in µs, Triton → FlyDSL; K2 outputs match Triton exactly in both cases.

Batch K2, cache < 4 GiB K2, cache > 4 GiB Selection (K1 + expand), < 4 GiB Selection, > 4 GiB
Decode, 64 × 8k 40 → 36 44 → 136 181 → 61 189 → 74
Prefill, one 8192 prompt 2390 → 1798 2874 → 13330 846 → 278 866 → 303
Prefill, two 8192 prompts (16384 rows) 4717 → 3519 4864 → 26088 1748 → 1487 1844 → 4084
Prefill, 16384 chunk at 60k 5212 → 3788 6237 → 29939 11002 → 3502 11524 → 4058
Prefill, 16381 chunk at 60k + 3 decodes 5015 → 3794 5181 → 29918 11041 → 14362 11629 → 47108

4. K1 drops to the one-row scorer for any batch with more than one request

_k1_uses_prefill_scorer (k1.py:809) returns False when n_requests != 1. Under load, nearly every prefill step also carries other requests' decode rows, or two prompts (vLLM's default max_num_batched_tokens is 16384). So the 16-row scorer rarely runs. In the table, a 16384-row chunk selects in 3502 µs alone and 14362 µs with three decode rows attached, slower than Triton's 11041, even on a narrow cache. On the wide cache the two effects compound: 4058 → 47108 µs.

Changes needed

  1. Wide path: no per-lane V#. Read gathered rows with 64-bit global loads (global_load_dwordx4 with a per-lane VGPR address, no descriptor), or keep one wave-uniform descriptor and rebase by a wave-uniform amount. One layer's page is under 1 MB (K2: 1568 × 256 × bf16; K1: 392 × 128 × bf16), so a 32-bit offset within it is enough wherever the page is uniform across the wave. Then check the wide ISA has no v_readfirstlane / s_cbranch_execnz around the gathers.

  2. K1: the 16-row scorer for mixed batches. Gate it on whether a 16-row tile stays inside one request, from token_to_req per tile, not on n_requests == 1. vLLM lays out each request's rows contiguously, so nearly all prefill tiles would qualify, and tiles that straddle requests or carry decode rows can take the one-row path.

  3. Tests and benchmark. Add to op_tests/test_flydsl_qsa.py and the benchmark:

    • a strided cache view spanning more than 4 GiB, with page stride ≫ page size, as vLLM's views are;
    • a multi-request prefill (two prompts, and a prompt plus decode rows).

    A cheap way to build the view: allocate pages * page_stride elements for a few pages and as_strided with a large page stride, so the span passes 4 GiB without allocating it.

  4. Until then, auto should prefer Triton whenever wide_cache is true.

I can share the benchmark script (decode under graph replay, prefill eager, both layouts) if that helps.

@SamiAario-AMD
SamiAario-AMD force-pushed the samaario/flydsl-qsa-indexer-sparse-gqa branch from 039ed37 to cf5d41f Compare October 5, 2026 07:07
@SamiAario-AMD

Copy link
Copy Markdown
Contributor Author

In vLLM serving, every K1/K2 call takes the wide (>4 GiB) path, and that path is what makes FlyDSL QSA lose to Triton end to end

Commit 5e4a7fd addresses the main cause of the slowdown.
Commit f5a768a adds benchmarking support for the affected wide layout.

SamiAario-AMD and others added 29 commits December 1, 2026 14:17
- Launch the vendored QSA expand kernel from the public wrapper so the kernel module does not import PyTorch.
- Document the packed block-id selection contract on qsa_layer.
- Document the QSA AOT jobs as a family-A TP1 warm set that still requires runtime JIT.
- Accept a caller-owned K1 score buffer so long-row scoring does not allocate it inside the call.
- Move QSA K1 host dispatch into qsa.py so the kernel module only builds the indexer-select kernels.
- Move QSA K2 host dispatch into qsa.py so the kernel module only builds the sparse-GQA kernel.
- Dispatch QSA from get_gfx_runtime so the tile follows the live GPU rather than GPU_ARCHS.
- Move the QSA oracle and paging fixtures out of the kernel package so the library keeps only span_bytes.
- Rename the vendored QSA expand modules to qsa_expand so the filename belongs to AITER.
- Rename QSA K1 and K2 to indexer and sparse GQA so the API, builders, and AOT jobs share one vocabulary.
- Rename the remaining QSA labels to supported, decode scores, Flash-Next, and Gluon-parity so the names match the operations.
- Reword the leftover QSA family and kernel labels so comments use the same names as the API.
- Name the QSA expand specialization from its constexprs so the compiled kernel matches the other Triton kernels.
- Gather the QSA indexer through a shared-pool page stride so the wide compile is tested past a doubled page.
- Cover two-prompt QSA prefill for the indexer and sparse GQA so each request is checked against the oracle.
- Drop the QSA experiment diary and stage labels so the comments keep the dispatch rules.
- Document that qsa_layer runs only on gfx942 and gfx950.
- Document expand_qsa_block_indices so the launcher states dtypes, width, and padding.
- Score a visible indexer prefill block on an invalid page as -inf so it cannot tie into the top 512.
- Move the QSA shape fixtures into qsa_ref so the test no longer imports a shapes module.
… wave per D slice instead of one workgroup per head.
Adopt the tiling of vLLM #62589's Triton indexer scorer in the FlyDSL
16-row scorer:

- 16 rows x 64 columns per workgroup, one wave per 16 columns over the
  whole head dim, so the heads accumulate in registers and each wave writes
  its scores directly; the cross-wave LDS C reduction is gone.
- A row tile may span requests. Each request in the tile gathers its own
  K and writes only its own rows, so mixed prefill + decode, multi-prompt
  prefill and MTP batches take the 16-row scorer (from two rows per
  request on average) instead of the one-row scorer.
- Row tiles vary fastest in the grid, so resident workgroups share K.

Signed-off-by: Mikko Tukiainen <[email protected]>
Co-authored-by: Cursor <[email protected]>
…fill

- A prefill workgroup (16+ rows per request) walks four consecutive column
  tiles with one Q staging and one row setup; MTP keeps one tile per
  workgroup so the grid still fills the machine.
- Q is staged per request next to the K gather, so its loads overlap the
  page-table lookup, and K validity uses the request's visible bound
  instead of reloading context_lens.
- More than 64 rows select with the stable decode radix at any width. It
  stops at each row's length, and on the padded 65856-column table it ran
  1.3x to 1.8x faster per 509-row chunk than the streaming selector.

Signed-off-by: Mikko Tukiainen <[email protected]>
Co-authored-by: Cursor <[email protected]>
With 4 indexer heads, 4 rows x 4 heads fill the 16-row MFMA M axis. In the
C layout each lane then holds one row's four heads, so the ReLU head sum
stays in the lane and a tile is 4 rows: an MTP batch with 4 rows per
request has one request per tile, with no per-request loop and no MFMA
work on other requests' rows. Batches under 16 rows per request use it;
prefill keeps the 16-row tile, which reuses each K tile over 16 rows.

The spanning-requests test adds uneven MTP rows (folded tiles straddle
requests) and a 20-rows-per-request batch (multi-tile blocks that span
requests).

Signed-off-by: Mikko Tukiainen <[email protected]>
Co-authored-by: Cursor <[email protected]>
- QSA K1: pad LDS rows so the MFMA reload misses bank conflicts.
- Keep short QSA K1 row-scorer launches parallel
- Use the in-tree QSA expand and drop the vendored Triton kernel.
- Rename the paged FlyDSL QSA host so it is distinct from the pool sparse decoder.
- Replace leftover K1 and K2 names with indexer and paged GQA.
- Reuse shared QSA helpers and drop a redundant exp2 wrap.
- Stop exporting QSA helpers that are not defined.
- Time Flash-Next sparse GQA at the TP2, TP4, and TP8 head counts.
- Drop unpinned QSA speed notes from the dispatch comments.
- Reject overlapping QSA score rows before launch.
- Validate QSA expand indices before any launch.
- Drop the unused QSA prefill LDS estimator.
- Note the dynamic score stride on the folded-head store.
- Keep qsa_k1_block_ids and qsa_k2 as one-release aliases.
- Qualify the indexer LDS bank comment per architecture.
- Update the indexer comment for rows above 64.
- Fix D=128 decode sparse GQA for group 16 and one split.
- Carry the compact selector cursor in registers.
- Pack indexer block ids off a missing page.
- Drop missing pages inside emit and the one-workgroup radix.
- Address the prefill V store from the kv LDS symbol.
- Derive folded-head lane indexes from the QK atom.
- Reject sparse GQA tiles that do not fit in LDS.
- Use the stable FlyDSL surface in the QSA kernels.
- Rotate wide-cache timing across the pages the gather reads.
- Name why the folded Q fill stays a thread-linear copy.
- Record that wide cold rotation shares one pool and distinct page addresses.
- Document the gfx950 D=128 decode PV MFMA miscompile.
- Make finite_only top-k reject NaN and +inf.
- Broadcast the indexer wave total with gpu.shuffle_idx.
- Keep the sparse GQA running max and masked scores at the finite -1e20 floor.
- Scale the online softmax with fx.math.exp2.
- Synchronize the LDS tile with gpu.barrier.
- Skip the empty indexer block-id fill while keeping the causal tail.
- Fail QSA end-to-end benches when a candidate is outside its tolerance.
- Replace private QSA mechanism checks with the public split-merge contract.
- Import the QSA oracle as a package or sibling so the sweep script needs no sys.path edit.
- Cover a four-tile request span and replay dynamic indexer row bounds.
- Time QSA end-to-end benches on preallocated indexer and output buffers.
- Rewrite three captured indexer lengths so the second replay checks dynamic row bounds.
- Keep the QSA row-scorer grid row-fast after the XCD remap measured slower.
- Use the shared unsigned divide and typed integer min/max in the QSA kernels.
- Move QSA fp32 reference into test_flydsl_qsa.py and drop op_tests/qsa_ref.py
- Drop ticket and external-doc references from QSA code and tests
- Stage the 16-row indexer Q tile once per row tile
- Fix the compact top-k race on the threshold-bucket count
- Return a reason from the QSA support gates on an unsupported arch
- Report skipped QSA GPU tests as skips
- Keep qsa_indexer_block_ids returning a tensor
- Key QSA compiles by tensor layout so a width-1 axis cannot stick
- Describe QSA layouts by their strides instead of another caller
- Drop the QSA LDS pad probe and its prefill V-store test
- Drop the unused QSA AOT compile path and its torch patches
- Use the row-bounded indexer selector for eager padded decode
- Dispatch supported QSA shapes to the FlyDSL indexer and sparse GQA
- Drop the D=128 decode PV MFMA workaround, no longer needed on gfx950 or gfx942
- Cap the FlyDSL indexer score workspace at 128 MiB and score long batches in row chunks
- Scale the QSA prefill split target by the device CU count
- Slim test_flydsl_qsa to a sweep with shared edge checks
- Remove the unused QSA gather_paged_cache helper
- Add untimed wide interleaved KV coverage to QSA paged GQA test
- Replace the QSA wide-cache timing harness with a rotating wide-view wrapper
- Time packed and wide QSA caches in the default sweep and drop --cache-layout
- Trim QSA test docstrings to one-line purposes
- Drop qsa_k1_block_ids and qsa_k2
- Delete check_qsa_warns_once
- Factor the QSA sweep table footers into one _summarize helper
- Remove the QSA test's header prose block
- Collapse the QSA sweep loops in main() into shared decode/prefill and Gluon loops
- Share the QSA test fixture builders across the indexer and GQA cases
- Delete dead QSA oracle arguments, unread spec fields, and redundant fixture guards
- Drop qsa_layer and warn once for an unswept sparse GQA query
- Make FlyDSL QSA dispatch opt-in with allow_flydsl, default off
- Publish qsa_indexer_row_bounded so the sweep stops reading private cutoffs
@SamiAario-AMD
SamiAario-AMD force-pushed the samaario/flydsl-qsa-indexer-sparse-gqa branch from e8c14eb to 3483742 Compare December 1, 2026 14:40

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants