Skip to content
Open
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
fcb15fb
feat(flydsl): port native gfx950 paged FP8 prefill
sammysun0711 Sep 14, 2026
053a7dd
feat(flydsl): route AITER paged prefill through native CSR
sammysun0711 Sep 14, 2026
04dd4ae
test(flydsl): qualify paged FP8 contracts and CI coverage
sammysun0711 Sep 14, 2026
4fb0525
refactor(flydsl): reuse shared helper for dense and paged pipeline
sammysun0711 Sep 14, 2026
d864866
refactor(flydsl): simplify paged attention helpers and tests
sammysun0711 Sep 15, 2026
ba8a22a
refactor(flydsl): split paged attention ops and simplify test
sammysun0711 Sep 15, 2026
368bb3a
fix(flydsl): avoid dispatch during paged attention preload
sammysun0711 Sep 15, 2026
0233162
Fix review coments
sammysun0711 Sep 16, 2026
64f4f51
fix(flydsl): preserve paged attention copy-source lifetimes
sammysun0711 Sep 16, 2026
f8d4be9
fix(flydsl): prevent paged attention causal-bound overflow
sammysun0711 Sep 16, 2026
f1bd0c4
fix(flydsl): harden paged output bounds and clean dead code
sammysun0711 Sep 16, 2026
78c407f
bench(flydsl): add paged FP8 attention comparisons
sammysun0711 Sep 17, 2026
4ffac91
refactor(flydsl): expose direct paged prefill API
sammysun0711 Sep 20, 2026
3be4299
feat(flydsl): add FP32 LSE support for paged prefill
sammysun0711 Sep 20, 2026
4de2ca6
Merge ROCm/aiter main into FlyDSL paged attention
sammysun0711 Sep 20, 2026
f6c4761
refactor(flydsl): use generic paged attention memory ops
sammysun0711 Sep 20, 2026
9fbd8ca
Merge ROCm/aiter main into FlyDSL paged attention
sammysun0711 Sep 21, 2026
361249d
docs(flydsl): clarify paged attention launch bounds
sammysun0711 Sep 21, 2026
9047e28
Merge ROCm/aiter main into FlyDSL paged attention
sammysun0711 Sep 21, 2026
af0d9a3
Merge branch 'main' into upstream/flydsl-fp8-paged-attention
sammysun0711 Sep 22, 2026
2c21188
Merge branch 'main' into upstream/flydsl-fp8-paged-attention
sammysun0711 Sep 22, 2026
c052cd6
fix(flydsl): retain implicit side-stream inputs
sammysun0711 Sep 23, 2026
347907a
Merge branch 'main' into upstream/flydsl-fp8-paged-attention
sammysun0711 Oct 10, 2026
20dd6e8
Merge branch 'main' into upstream/flydsl-fp8-paged-attention
sammysun0711 Oct 12, 2026
fe1de6b
refactor(flydsl): consolidate paged FP8 attention helpers
sammysun0711 Oct 12, 2026
a73830a
Merge branch 'main' into upstream/flydsl-fp8-paged-attention
sammysun0711 Oct 15, 2026
1e28785
Merge branch 'main' into upstream/flydsl-fp8-paged-attention
sammysun0711 Oct 16, 2026
cfbea7a
fix aiter_test.sh format
sammysun0711 Oct 16, 2026
678aa38
address review feedback
sammysun0711 Oct 16, 2026
8cf7d1f
Merge upstream main into upstream/flydsl-fp8-paged-attention
sammysun0711 Oct 21, 2026
a7dbdb4
refactor(flydsl): address paged prefill review feedback
sammysun0711 Oct 21, 2026
736d924
fix: align get_gfx_runtime() check
sammysun0711 Oct 23, 2026
262ffb7
Merge branch 'main' into upstream/flydsl-fp8-paged-attention
sammysun0711 Oct 23, 2026
2d34f63
Merge upstream main into upstream/flydsl-fp8-paged-attention
sammysun0711 Oct 28, 2026
33d9301
test: remove bench_paged_fmha.py
sammysun0711 Oct 28, 2026
1ed1c32
Merge branch 'main' into upstream/flydsl-fp8-paged-attention
sammysun0711 Oct 28, 2026
58c8984
Merge upstream main into upstream/flydsl-fp8-paged-attention
sammysun0711 Oct 30, 2026
fdd594f
Fix review comment and simpify test
sammysun0711 Oct 30, 2026
7c04975
Merge branch 'main' into upstream/flydsl-fp8-paged-attention
sammysun0711 Oct 31, 2026
8b0cede
test: simplify test case
sammysun0711 Nov 1, 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
2 changes: 1 addition & 1 deletion .github/scripts/aiter_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ for file in "${sharded_files[@]}"; do
# no tests are collected, so an empty run cannot report success.
test_cmd=(timeout 60m python3 -m pytest -q "$file")
;;
op_tests/test_fhmoe.py|op_tests/tuning_tests/test_fhmoe_tuner.py|op_tests/test_hipb_grouped_gemm.py)
op_tests/test_flydsl_paged_fmha.py|op_tests/test_fhmoe.py|op_tests/tuning_tests/test_fhmoe_tuner.py|op_tests/test_hipb_grouped_gemm.py)
# These files contain pytest-style test functions and intentionally
# have no script entry point; direct execution would only import them.
test_cmd=(timeout 60m python3 -m pytest -q "$file")
Expand Down
1 change: 1 addition & 0 deletions .github/split-test-times/aiter.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ op_tests/test_flydsl_moe_gfx942.py 110
op_tests/test_flydsl_pa_decode.py 148
op_tests/test_flydsl_pa_mqa_logits_fp4.py 7
op_tests/test_flydsl_pa_mqa_logits_fp4_prefill.py 6
op_tests/test_flydsl_paged_fmha.py 240
op_tests/test_flydsl_qk_norm_rope_quant.py 97
op_tests/test_flydsl_qsa_sparse_decode.py 5
op_tests/test_flydsl_topk_per_row_small_k.py 49
Expand Down
5 changes: 5 additions & 0 deletions aiter/ops/flydsl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
"flydsl_flash_attn_fp8_supported",
),
"flydsl_flash_attn_func": (".fmha_kernels", "flydsl_flash_attn_func"),
"flydsl_flash_attn_paged_prefill_func": (
".fmha_kernels",
"flydsl_flash_attn_paged_prefill_func",
),
"flydsl_fp8_mqa_logits": (
".fp8_mqa_logits_kernels",
"flydsl_fp8_mqa_logits",
Expand Down Expand Up @@ -190,6 +194,7 @@
"flydsl_flash_attn_fp8_func",
"flydsl_flash_attn_fp8_supported",
"flydsl_flash_attn_func",
"flydsl_flash_attn_paged_prefill_func",
"flydsl_fp8_mqa_logits",
"flydsl_fp8_paged_mqa_logits",
"flydsl_fp8_paged_mqa_logits_gfx950",
Expand Down
84 changes: 84 additions & 0 deletions aiter/ops/flydsl/fmha_kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
m32x8 prefill kernel, anything else ``None`` so the caller falls through to
CK/Triton.

``flydsl_flash_attn_paged_prefill_func`` is an explicit gfx950 FP8 paged
prefill API with optional LSE; unsupported requests raise without fallback.

``flydsl_flash_attn_func`` (gfx1201 / RDNA4) wraps the
`flash_attn_func_gfx1201` kernel with:
- Build cache keyed by (num_heads, head_dim, causal, dtype, waves_per_eu, daz).
Expand Down Expand Up @@ -60,6 +63,7 @@
__all__ = [
"flydsl_flash_attn_batch_fwd",
"flydsl_flash_attn_func",
"flydsl_flash_attn_paged_prefill_func",
"flydsl_flash_attn_varlen_bwd",
"flydsl_flash_attn_varlen_fwd",
]
Expand Down Expand Up @@ -237,6 +241,86 @@ def flydsl_flash_attn_func(
return o_p


def flydsl_flash_attn_paged_prefill_func(
Comment thread
sammysun0711 marked this conversation as resolved.
Resolved
q: torch.Tensor,
k: torch.Tensor,
v: torch.Tensor,
cu_seqlens_q: torch.Tensor,
max_seqlen_q: int,
max_seqlen_k: int,
*,
block_table: torch.Tensor | None = None,
seqlen_k: torch.Tensor | None = None,
kv_indptr: torch.Tensor | None = None,
kv_page_indices: torch.Tensor | None = None,
kv_last_page_lens: torch.Tensor | None = None,
q_descale: torch.Tensor,
k_descale: torch.Tensor,
v_descale: torch.Tensor,
softmax_scale: float | None = None,
causal: bool = True,
out: torch.Tensor | None = None,
return_lse: bool = False,
lse: torch.Tensor | None = None,
stream: torch.cuda.Stream | None = None,
):
"""Compute causal paged prefill with the gfx950 FlyDSL FP8 kernel.

Q is packed ``[total_q, Hq, Dqk]``; Q/K/V must be OCP E4M3FN with
single-element FP32 descales on the same GPU. Supported ``(Dqk, Dv)``
pairs are ``(128, 128)``, ``(192, 128)`` and ``(192, 192)``. Page-1 KV
caches use rank-3/4 linear layouts; pages 16/64/1024 use vectorized
rank-5 layouts. Hq must be divisible by Hkv.

Supply either a rectangular ``block_table`` and KV token ``seqlen_k``,
or CSR ``kv_indptr``/``kv_page_indices`` with ``kv_last_page_lens`` for
pages larger than one. A supplied block table takes precedence. All
metadata is int32 on Q's device. The maxima are trusted host launch bounds
and must cover every request's actual Q/K length; undersized values violate
the API contract and are not recomputed from device metadata on this hot path.
The causal mask is bottom-right aligned, including when Q is longer
than KV. ``softmax_scale`` defaults to ``Dqk**-0.5`` and must be a
positive finite Python scalar, independent of the quantization descales.

Returns BF16 ``out[total_q, Hq, Dv]``, or ``(out, lse)`` when
``return_lse=True``. LSE is FP32 ``[Hq, total_q]`` in natural-log units;
fully masked rows have zero output and LSE ``-inf``. Both buffers may
be preallocated and must be contiguous on Q's device. ``lse`` requires
``return_lse=True``. Launches use the current stream unless supplied.

This is an explicit inference-only API: unsupported hardware, dtypes,
layouts or noncausal requests raise rather than falling back. Local
windows, sinks, ALiBi, soft capping, dropout and per-page scales are not
supported. Backend scheduling controls stay in the kernel launcher.
"""
from .kernels.flash_attn_paged_fp8_func_gfx950 import (
flydsl_flash_attn_paged_fp8_func,
)

return flydsl_flash_attn_paged_fp8_func(
q,
k,
v,
cu_seqlens_q,
max_seqlen_q,
max_seqlen_k,
block_table=block_table,
seqlen_k=seqlen_k,
kv_indptr=kv_indptr,
kv_page_indices=kv_page_indices,
kv_last_page_lens=kv_last_page_lens,
q_descale=q_descale,
k_descale=k_descale,
v_descale=v_descale,
softmax_scale=softmax_scale,
causal=causal,
out=out,
return_lse=return_lse,
lse=lse,
stream=stream,
)


def _check_out(out, q, v_hdim, out_dtype=None):
"""Validate a caller-provided ``out`` tensor. ``out_dtype`` defaults to q's -- the
8-bit gfx1250 kernel writes bf16 output, so it passes its own."""
Expand Down
Loading
Loading