refactor: rename gqa_* to attn_*, split-KV for all decode paths

- Rename all csrc/kernels/gqa_*.cuh/cu to attn_*, with _split_q / _split_kv
  strategy suffix and optional _mma compute suffix
- Remove non-split MMA decode kernel, keep only split-KV path
- Convert scalar decode fallback to split-KV (o_part/ml_part + combine)
- Move combine kernel to attn_decode_split_kv.cuh (shared by both paths)
- Rename GQAParams to AttentionParams
- Update all C++ #include, PYBIND11, and Python extension references
This commit is contained in:
2026-07-10 23:35:14 +08:00
parent 29b0423c4e
commit d923ebe38d
16 changed files with 346 additions and 459 deletions
+6 -6
View File
@@ -1,19 +1,19 @@
"""CUDA attention kernel wrappers with torch fallback.
Public API:
- ``gqa_decode_attn`` — single-query decode attention
- ``gqa_prefill_attn`` — multi-query prefill attention
- ``attn_decode`` — single-query decode attention
- ``attn_prefill`` — multi-query prefill attention
Each wrapper dispatches to its compiled CUDA kernel (``astrai.extension.gqa_*``)
Each wrapper dispatches to its compiled CUDA kernel (``astrai.extension.attn_*``)
when available, otherwise falls back to ``torch.nn.functional.scaled_dot_product_attention``.
"""
from astrai.extension.loader import KERNEL_NAMES, is_available
from astrai.extension.ops import gqa_decode_attn, gqa_prefill_attn
from astrai.extension.ops import attn_decode, attn_prefill
__all__ = [
"gqa_decode_attn",
"gqa_prefill_attn",
"attn_decode",
"attn_prefill",
"is_available",
"KERNEL_NAMES",
]