Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4dfa9c1
Port _fused and _qattn_sm80 to ABI3
woct0rdho Jul 2, 2025
4060bf0
Port _qattn_sm89 and _qattn_sm90 to ABI3
woct0rdho Jul 2, 2025
86a9daf
Update Python API
woct0rdho Jul 2, 2025
ae5c905
Port SageAttention3 to ABI3
woct0rdho Sep 29, 2025
3ca6269
Add missing fields in Python modules
woct0rdho Sep 29, 2025
f6cf8bc
Update fake impl
woct0rdho Oct 14, 2025
799a8fe
Port to PyMODINIT_FUNC
woct0rdho Mar 24, 2026
1937209
Port fused to libtorch stable ABI
woct0rdho Oct 6, 2025
3316230
Port _qattn_sm80 to libtorch stable ABI
woct0rdho Oct 7, 2025
771214d
Port _qattn_sm90 to libtorch stable ABI
woct0rdho Oct 7, 2025
f1ef44e
Port _qattn_sm89 to libtorch stable ABI
woct0rdho Oct 7, 2025
47bd326
Fix shape and device of lse in fake impl
woct0rdho Oct 10, 2025
e05e6dc
Fixes to allow building against pytorch 2.10
scottmudge Jan 12, 2026
ca2516a
Add torch_version.h for compatibility with torch 2.9 stable headers
woct0rdho Jan 18, 2026
c3ef4e8
Port to TORCH_BOX
woct0rdho Mar 24, 2026
a16468e
Fix typo in wrapper
woct0rdho Mar 25, 2026
97c3522
Port gfx12 native attention to ABI3 fork
jammm May 14, 2026
155ef96
Port latest gfx12 parity fixes to ABI3 fork
jammm May 15, 2026
83ff386
Port gfx12 cleanup to ABI3 branch
jammm May 17, 2026
4312b79
Improve gfx12 fp16 stream routes
jammm May 18, 2026
5cb040d
gfx12: optimize short fp16 native paths
jammm May 19, 2026
df17c2f
Port latest gfx12 native paths to ABI3
jammm May 19, 2026
a6f959c
gfx12: specialize D64 long causal NHD mean
jammm May 19, 2026
324aece
gfx12: restore D256 native attention support
jammm Jun 16, 2026
30cc019
gfx12: optimize D256 causal native paths
jammm Jun 16, 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
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ __pycache__/

# C extensions
*.so
*.pyd

# Distribution / packaging
.Python
Expand Down Expand Up @@ -174,3 +175,16 @@ cython_debug/
.pypirc

/wheelhouse
csrc/cp_async_hip.cuh
csrc/fused/fused.hip
csrc/fused/pybind_hip.cpp
csrc/numeric_conversion_hip.cuh
csrc/qattn/qk_int_sv_gfx12_native.hip
csrc/qattn/qk_int_sv_gfx12_native_*.hip
csrc/reduction_utils_hip.cuh
evaluate/
*.pkl
*.vscode/
bench_qk_int8_pv_fp8_cuda_head96.py
*test.py
*unmask.py
3 changes: 2 additions & 1 deletion bench/bench_qk_int8_pv_fp16_cuda.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import torch
from flash_attn.utils.benchmark import benchmark_forward

import sageattention._qattn_sm80 as qattn
import sageattention._qattn_sm80
qattn = torch.ops.sageattention_qattn_sm80

import argparse

Expand Down
3 changes: 2 additions & 1 deletion bench/bench_qk_int8_pv_fp8_cuda.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import torch
from flash_attn.utils.benchmark import benchmark_forward

import sageattention._qattn_sm89 as qattn
import sageattention._qattn_sm89
qattn = torch.ops.sageattention_qattn_sm89

import argparse

Expand Down
5 changes: 4 additions & 1 deletion bench/bench_qk_int8_pv_fp8_cuda_sm90.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import torch
from flash_attn.utils.benchmark import benchmark_forward
import sageattention._qattn_sm90 as qattn

import sageattention._qattn_sm90
qattn = torch.ops.sageattention_qattn_sm90

import argparse

parser = argparse.ArgumentParser(description='Benchmark QK Int8 PV FP8 SM90')
Expand Down
4 changes: 2 additions & 2 deletions csrc/cp_async.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ enum class PrefetchMode {
kPrefetch // Fetch additional data from global memory to L2
};

#if (__CUDACC_VER_MAJOR__ >= 11)
#if !defined(__HIP_PLATFORM_AMD__) && (__CUDACC_VER_MAJOR__ >= 11)
#if (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 800))
#define CP_ASYNC_ENABLED
#endif
Expand Down Expand Up @@ -138,4 +138,4 @@ __device__ __forceinline__ void pred_load_128b(T* smem_ptr, const T* gmem_ptr, b
#endif
}

} // namespace cp_async
} // namespace cp_async
11 changes: 6 additions & 5 deletions csrc/dispatch_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
*/

#pragma once
#include <torch/extension.h>
#include <cstdint>
#include <sstream>
#include <stdexcept>
#include <torch/headeronly/core/ScalarType.h>
#include <torch/headeronly/util/Exception.h>

#define DISPATCH_HEAD_DIM(head_dim, HEAD_DIM, ...) \
if (head_dim == 64) { \
Expand Down Expand Up @@ -73,16 +74,16 @@
}

#define DISPATCH_PYTORCH_DTYPE_TO_CTYPE_FP16(pytorch_dtype, c_type, ...) \
if (pytorch_dtype == at::ScalarType::Half) { \
if (pytorch_dtype == torch::headeronly::ScalarType::Half) { \
using c_type = half; \
__VA_ARGS__ \
} else if (pytorch_dtype == at::ScalarType::BFloat16) { \
} else if (pytorch_dtype == torch::headeronly::ScalarType::BFloat16) { \
using c_type = nv_bfloat16; \
__VA_ARGS__ \
} else { \
std::ostringstream oss; \
oss << __PRETTY_FUNCTION__ << " failed to dispatch data type " << pytorch_dtype; \
TORCH_CHECK(false, oss.str()); \
oss << __PRETTY_FUNCTION__ << " failed to dispatch data type " << #pytorch_dtype; \
STD_TORCH_CHECK(false, oss.str()); \
}

#define DISPATCH_BLOCK_SIZE(block_size, BLOCK_SIZE, ...) \
Expand Down
Loading