Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
830d0bb
[Triton/Gluon] [QSA] FP8 KV and FP8 / FP4 index caches, stacked-head …
ZLkanyo009 Oct 27, 2026
381f018
[Triton/Gluon] [QSA] Address review: page-table bound, CPU import, wr…
ZLkanyo009 Oct 28, 2026
9be3a42
[Triton/Gluon] [QSA] Quantize FP4 index rows with _mxfp4_quant_op
ZLkanyo009 Oct 29, 2026
d265185
[Triton/Gluon] [QSA] Reject partial second planes and mismatched scal…
ZLkanyo009 Oct 30, 2026
4811ba3
[Triton/Gluon] [QSA] Move QSA tiles to JSON, reuse _mxfp4_e8m0_to_fp32
ZLkanyo009 Oct 30, 2026
4feba25
[Triton/Gluon] [QSA] Accept FP16 / FP32 caches again, check writer an…
ZLkanyo009 Oct 30, 2026
1a417c7
Merge branch 'main' into lingzha/qsa-fp8-kv-index-stacked
ZLkanyo009 Oct 31, 2026
330d7a8
Read the QSA tile table optionally; test more head_dims
ZLkanyo009 Nov 2, 2026
a6881c0
Reuse _fp8_quant_op in the FP8 writer; fp4_utils in the test
ZLkanyo009 Nov 2, 2026
e3ae331
Clean up the QSA diff: one test case builder and reference, shared FP…
ZLkanyo009 Nov 2, 2026
9db2881
Fold the stacked QSA scorer into the MFMA kernel and share the scale-…
ZLkanyo009 Nov 2, 2026
069663c
Leave existing QSA code as on main where the change does not need it
ZLkanyo009 Nov 2, 2026
b2c4b78
Say why _tuned_tile is cached and what "bf16" covers in the QSA docst…
ZLkanyo009 Nov 2, 2026
c3ce6d1
Keep main's QSA exports and quant comments, and note the stacked page…
ZLkanyo009 Nov 2, 2026
06a7aa8
Merge origin/main into lingzha/qsa-fp8-kv-index-stacked
ZLkanyo009 Nov 5, 2026
b2fb752
Scope the exactness note of _load_fp4_keys to BF16 / FP32
ZLkanyo009 Nov 5, 2026
a567922
Share one scoring path across key formats in the QSA kernels
ZLkanyo009 Nov 6, 2026
dab71f0
Read QSARowLayout fields by name in bench_qsa
ZLkanyo009 Nov 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions aiter/ops/qsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@

from aiter.ops.topk import top_k_per_row_prefill
from aiter.ops.triton.attention.qsa import (
FP4_GROUP,
FP8_DTYPE,
FP8_MAX,
qsa_cache_row_layout,
qsa_expand_block_indices,
qsa_sparse_paged_gqa,
qsa_store_quantized_rows,
)
from aiter.ops.triton.attention.qsa import (
qsa_paged_mqa_logits as _triton_qsa_paged_mqa_logits,
Expand Down Expand Up @@ -55,16 +60,22 @@ def qsa_paged_mqa_logits(
max_columns: int | None = None,
row_starts: torch.Tensor | None = None,
allow_flydsl: bool = False,
compressed_k_scale: torch.Tensor | None = None,
stacked_decode: bool = False,
) -> tuple[torch.Tensor, torch.Tensor]:
"""Score compressed key groups.

Dispatches to the FlyDSL MFMA scorer for large prefill batches when
``allow_flydsl`` is set and FlyDSL is available, otherwise falls through
to the triton wrapper.

FP8 / MXFP4 keys (with ``compressed_k_scale``) and ``stacked_decode`` are
triton only.
"""
if (
allow_flydsl
and _HAS_FLYDSL
and compressed_k_scale is None
and q.shape[0] > 256
and q.stride(2) == 1
and compressed_k_cache.stride(3) == 1
Expand Down Expand Up @@ -105,6 +116,8 @@ def qsa_paged_mqa_logits(
score_divisor,
max_columns,
row_starts,
compressed_k_scale=compressed_k_scale,
stacked_decode=stacked_decode,
)


Expand All @@ -121,6 +134,8 @@ def qsa_select_paged_tokens(
logits_workspace_bytes: int = DEFAULT_LOGITS_WORKSPACE_BYTES,
max_seq_len: int | None = None,
allow_flydsl: bool = False,
compressed_k_scale: torch.Tensor | None = None,
stacked_decode: bool = False,
) -> torch.Tensor:
"""Score, select and expand in one call."""
if compress_ratio <= 0 or token_topk <= 0 or token_topk % compress_ratio:
Expand Down Expand Up @@ -165,6 +180,8 @@ def qsa_select_paged_tokens(
max_columns=columns,
row_starts=row_starts,
allow_flydsl=allow_flydsl,
compressed_k_scale=compressed_k_scale,
stacked_decode=stacked_decode,
)
selected_groups = torch.empty(
(row_end - row_start, block_topk), dtype=torch.int32, device=q.device
Expand Down Expand Up @@ -228,9 +245,14 @@ def qsa_sparse_prefill(

__all__ = [
"DEFAULT_LOGITS_WORKSPACE_BYTES",
"FP4_GROUP",
"FP8_DTYPE",
"FP8_MAX",
"qsa_cache_row_layout",
"qsa_expand_block_indices",
"qsa_paged_mqa_logits",
"qsa_select_paged_tokens",
"qsa_sparse_paged_gqa",
"qsa_sparse_prefill",
"qsa_store_quantized_rows",
]
Loading
Loading