Uploaded using `kernel-builder`.
Browse files- build/torch212-cxx11-cu132-x86_64-linux/__init__.py +16 -2
- build/torch212-cxx11-cu132-x86_64-linux/_ops.py +3 -3
- build/torch212-cxx11-cu132-x86_64-linux/{_sageattention3_blackwell_cuda_464a940.abi3.so → _sageattention3_blackwell_cuda_f7be481.abi3.so} +1 -1
- build/torch212-cxx11-cu132-x86_64-linux/metadata.json +7 -7
- build/torch212-cxx11-cu132-x86_64-linux/sageattention3_blackwell/__init__.py +0 -26
build/torch212-cxx11-cu132-x86_64-linux/__init__.py
CHANGED
|
@@ -10,7 +10,16 @@ import torch
|
|
| 10 |
from ._ops import add_op_namespace_prefix, ops
|
| 11 |
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
SUPPORTED_LAYOUTS = ("NHD",)
|
| 15 |
TOKEN_ALIGNMENT = 128
|
| 16 |
ACCURACY_PROFILE = "speed-first"
|
|
@@ -29,6 +38,7 @@ def capabilities() -> dict[str, object]:
|
|
| 29 |
"cuda_graph_safe": True,
|
| 30 |
"fused_prep": True,
|
| 31 |
"delta_dtypes": ("float32", "bfloat16"),
|
|
|
|
| 32 |
}
|
| 33 |
|
| 34 |
|
|
@@ -62,7 +72,11 @@ class Sage3FusedWorkspace:
|
|
| 62 |
|
| 63 |
def _check_nhd(x: torch.Tensor, name: str) -> None:
|
| 64 |
if x.dim() != 4 or x.shape[-1] not in SUPPORTED_HEAD_DIMS:
|
| 65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
if not x.is_cuda or not x.is_contiguous():
|
| 67 |
raise RuntimeError(f"{name} must be contiguous CUDA")
|
| 68 |
if x.dtype not in (torch.float16, torch.bfloat16):
|
|
|
|
| 10 |
from ._ops import add_op_namespace_prefix, ops
|
| 11 |
|
| 12 |
|
| 13 |
+
def _cuda_version_tuple() -> tuple[int, int]:
|
| 14 |
+
version = torch.version.cuda
|
| 15 |
+
if not version:
|
| 16 |
+
return (0, 0)
|
| 17 |
+
major, minor, *_ = version.split(".")
|
| 18 |
+
return (int(major), int(minor))
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
CUDA_VERSION = _cuda_version_tuple()
|
| 22 |
+
SUPPORTED_HEAD_DIMS = (64, 128) if CUDA_VERSION >= (13, 0) else (64,)
|
| 23 |
SUPPORTED_LAYOUTS = ("NHD",)
|
| 24 |
TOKEN_ALIGNMENT = 128
|
| 25 |
ACCURACY_PROFILE = "speed-first"
|
|
|
|
| 38 |
"cuda_graph_safe": True,
|
| 39 |
"fused_prep": True,
|
| 40 |
"delta_dtypes": ("float32", "bfloat16"),
|
| 41 |
+
"d128_min_cuda": "13.0",
|
| 42 |
}
|
| 43 |
|
| 44 |
|
|
|
|
| 72 |
|
| 73 |
def _check_nhd(x: torch.Tensor, name: str) -> None:
|
| 74 |
if x.dim() != 4 or x.shape[-1] not in SUPPORTED_HEAD_DIMS:
|
| 75 |
+
supported = "|".join(str(dim) for dim in SUPPORTED_HEAD_DIMS)
|
| 76 |
+
raise RuntimeError(
|
| 77 |
+
f"{name} must have contiguous NHD shape [B,L,H,{supported}] "
|
| 78 |
+
f"for this CUDA {torch.version.cuda} artifact"
|
| 79 |
+
)
|
| 80 |
if not x.is_cuda or not x.is_contiguous():
|
| 81 |
raise RuntimeError(f"{name} must be contiguous CUDA")
|
| 82 |
if x.dtype not in (torch.float16, torch.bfloat16):
|
build/torch212-cxx11-cu132-x86_64-linux/_ops.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
import torch
|
| 2 |
-
from . import
|
| 3 |
-
ops = torch.ops.
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
-
return f"
|
|
|
|
| 1 |
import torch
|
| 2 |
+
from . import _sageattention3_blackwell_cuda_f7be481
|
| 3 |
+
ops = torch.ops._sageattention3_blackwell_cuda_f7be481
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
+
return f"_sageattention3_blackwell_cuda_f7be481::{op_name}"
|
build/torch212-cxx11-cu132-x86_64-linux/{_sageattention3_blackwell_cuda_464a940.abi3.so → _sageattention3_blackwell_cuda_f7be481.abi3.so}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 4576288
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:65b634001e530983df71b273e081a3b95fb1967257cc1b2efc242d672740a4ff
|
| 3 |
size 4576288
|
build/torch212-cxx11-cu132-x86_64-linux/metadata.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
| 1 |
{
|
| 2 |
"name": "sageattention3-blackwell",
|
| 3 |
-
"id": "
|
| 4 |
"version": 1,
|
| 5 |
"license": "Apache-2.0",
|
| 6 |
"python-depends": [],
|
|
|
|
| 7 |
"backend": {
|
| 8 |
"type": "cuda",
|
| 9 |
"archs": [
|
|
@@ -13,20 +14,19 @@
|
|
| 13 |
"digest": {
|
| 14 |
"algorithm": "sha256",
|
| 15 |
"files": {
|
| 16 |
-
"__init__.py": "
|
| 17 |
-
"_ops.py": "
|
| 18 |
-
"
|
| 19 |
-
"sageattention3_blackwell/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY="
|
| 20 |
}
|
| 21 |
},
|
| 22 |
"provenance": {
|
| 23 |
"kernel-builder": {
|
| 24 |
"version": "0.17.0-dev0",
|
| 25 |
-
"sha": "
|
| 26 |
"dirty": false
|
| 27 |
},
|
| 28 |
"kernel": {
|
| 29 |
-
"sha": "
|
| 30 |
"dirty": false
|
| 31 |
}
|
| 32 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"name": "sageattention3-blackwell",
|
| 3 |
+
"id": "_sageattention3_blackwell_cuda_f7be481",
|
| 4 |
"version": 1,
|
| 5 |
"license": "Apache-2.0",
|
| 6 |
"python-depends": [],
|
| 7 |
+
"kernel-depends": [],
|
| 8 |
"backend": {
|
| 9 |
"type": "cuda",
|
| 10 |
"archs": [
|
|
|
|
| 14 |
"digest": {
|
| 15 |
"algorithm": "sha256",
|
| 16 |
"files": {
|
| 17 |
+
"__init__.py": "fFNOV1L7fwXJ/GAKEPWGjndpGeObnj+C6saq6qdBkC8=",
|
| 18 |
+
"_ops.py": "H7CUYyZh3jmz/iSVRJddN7iHH0e/iHt+fYV4vmCBqDw=",
|
| 19 |
+
"_sageattention3_blackwell_cuda_f7be481.abi3.so": "ZbY0AB5TCYPfcbJz4IGjuV+xlnJXzBsu/CQtZydApP8="
|
|
|
|
| 20 |
}
|
| 21 |
},
|
| 22 |
"provenance": {
|
| 23 |
"kernel-builder": {
|
| 24 |
"version": "0.17.0-dev0",
|
| 25 |
+
"sha": "3a5c09d941a19f582fe551d038dc2b3bc6b0a03d",
|
| 26 |
"dirty": false
|
| 27 |
},
|
| 28 |
"kernel": {
|
| 29 |
+
"sha": "f7be4812381108c475322303ae4638273bc566fd",
|
| 30 |
"dirty": false
|
| 31 |
}
|
| 32 |
}
|
build/torch212-cxx11-cu132-x86_64-linux/sageattention3_blackwell/__init__.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
import ctypes
|
| 2 |
-
import importlib.util
|
| 3 |
-
import sys
|
| 4 |
-
from pathlib import Path
|
| 5 |
-
from types import ModuleType
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
def _import_from_path(file_path: Path) -> ModuleType:
|
| 9 |
-
# We cannot use the module name as-is, after adding it to `sys.modules`,
|
| 10 |
-
# it would also be used for other imports. So, we make a module name that
|
| 11 |
-
# depends on the path for it to be unique using the hex-encoded hash of
|
| 12 |
-
# the path.
|
| 13 |
-
path_hash = "{:x}".format(ctypes.c_size_t(hash(file_path.absolute())).value)
|
| 14 |
-
module_name = path_hash
|
| 15 |
-
spec = importlib.util.spec_from_file_location(module_name, file_path)
|
| 16 |
-
if spec is None:
|
| 17 |
-
raise ImportError(f"Cannot load spec for {module_name} from {file_path}")
|
| 18 |
-
module = importlib.util.module_from_spec(spec)
|
| 19 |
-
if module is None:
|
| 20 |
-
raise ImportError(f"Cannot load module {module_name} from spec")
|
| 21 |
-
sys.modules[module_name] = module
|
| 22 |
-
spec.loader.exec_module(module) # type: ignore
|
| 23 |
-
return module
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
globals().update(vars(_import_from_path(Path(__file__).parent.parent / "__init__.py")))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|