Uploaded using `kernel-builder`.
Browse files- benchmarks/benchmark.py +6 -0
- build/torch211-cxx11-cu128-x86_64-linux/__init__.py +16 -2
- build/torch211-cxx11-cu128-x86_64-linux/_ops.py +3 -3
- build/torch211-cxx11-cu128-x86_64-linux/{_sageattention3_blackwell_cuda_77467d6_dirty.abi3.so → _sageattention3_blackwell_cuda_2dc0021.abi3.so} +2 -2
- build/torch211-cxx11-cu128-x86_64-linux/metadata.json +6 -6
benchmarks/benchmark.py
CHANGED
|
@@ -63,9 +63,15 @@ def main() -> None:
|
|
| 63 |
trust_remote_code=True,
|
| 64 |
)
|
| 65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
cases = [(6144, 128), (2688, 64)]
|
| 67 |
if args.mode == "full":
|
| 68 |
cases = [(6144, 128), (24576, 128), (2688, 64)]
|
|
|
|
| 69 |
print("| S | D | SDPA us | Sage2 static us | Sage3 core+quant us | Sage3 fused eager us | Sage3 fused graph us | graph vs SDPA | fused/legacy cosine |")
|
| 70 |
print("|---:|---:|---:|---:|---:|---:|---:|---:|---:|")
|
| 71 |
for s, d in cases:
|
|
|
|
| 63 |
trust_remote_code=True,
|
| 64 |
)
|
| 65 |
|
| 66 |
+
supported_head_dims = (
|
| 67 |
+
tuple(ops.module.capabilities()["head_dims"])
|
| 68 |
+
if args.backend == "installed" else (64, 128)
|
| 69 |
+
)
|
| 70 |
+
|
| 71 |
cases = [(6144, 128), (2688, 64)]
|
| 72 |
if args.mode == "full":
|
| 73 |
cases = [(6144, 128), (24576, 128), (2688, 64)]
|
| 74 |
+
cases = [(s, d) for s, d in cases if d in supported_head_dims]
|
| 75 |
print("| S | D | SDPA us | Sage2 static us | Sage3 core+quant us | Sage3 fused eager us | Sage3 fused graph us | graph vs SDPA | fused/legacy cosine |")
|
| 76 |
print("|---:|---:|---:|---:|---:|---:|---:|---:|---:|")
|
| 77 |
for s, d in cases:
|
build/torch211-cxx11-cu128-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/torch211-cxx11-cu128-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_2dc0021
|
| 3 |
+
ops = torch.ops._sageattention3_blackwell_cuda_2dc0021
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
+
return f"_sageattention3_blackwell_cuda_2dc0021::{op_name}"
|
build/torch211-cxx11-cu128-x86_64-linux/{_sageattention3_blackwell_cuda_77467d6_dirty.abi3.so → _sageattention3_blackwell_cuda_2dc0021.abi3.so}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b63380dfb4f0692a87dfc2edb38951b0606fd28c17842314ac24ec9c7b9f7c14
|
| 3 |
+
size 2304832
|
build/torch211-cxx11-cu128-x86_64-linux/metadata.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "sageattention3-blackwell",
|
| 3 |
-
"id": "
|
| 4 |
"version": 1,
|
| 5 |
"license": "Apache-2.0",
|
| 6 |
"python-depends": [],
|
|
@@ -13,9 +13,9 @@
|
|
| 13 |
"digest": {
|
| 14 |
"algorithm": "sha256",
|
| 15 |
"files": {
|
| 16 |
-
"__init__.py": "
|
| 17 |
-
"_ops.py": "
|
| 18 |
-
"
|
| 19 |
"sageattention3_blackwell/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY="
|
| 20 |
}
|
| 21 |
},
|
|
@@ -26,8 +26,8 @@
|
|
| 26 |
"dirty": false
|
| 27 |
},
|
| 28 |
"kernel": {
|
| 29 |
-
"sha": "
|
| 30 |
-
"dirty":
|
| 31 |
}
|
| 32 |
}
|
| 33 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"name": "sageattention3-blackwell",
|
| 3 |
+
"id": "_sageattention3_blackwell_cuda_2dc0021",
|
| 4 |
"version": 1,
|
| 5 |
"license": "Apache-2.0",
|
| 6 |
"python-depends": [],
|
|
|
|
| 13 |
"digest": {
|
| 14 |
"algorithm": "sha256",
|
| 15 |
"files": {
|
| 16 |
+
"__init__.py": "fFNOV1L7fwXJ/GAKEPWGjndpGeObnj+C6saq6qdBkC8=",
|
| 17 |
+
"_ops.py": "/0FdyIGUwzozcipWgUccGqq+FM6yEsqSB3H1hewc4fI=",
|
| 18 |
+
"_sageattention3_blackwell_cuda_2dc0021.abi3.so": "tjOA37TwaSqH38Lts4lRsGBv0owXhCMUrCTsnHuffBQ=",
|
| 19 |
"sageattention3_blackwell/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY="
|
| 20 |
}
|
| 21 |
},
|
|
|
|
| 26 |
"dirty": false
|
| 27 |
},
|
| 28 |
"kernel": {
|
| 29 |
+
"sha": "2dc0021cd0c6cb1e4c5258662a17051385215bd6",
|
| 30 |
+
"dirty": false
|
| 31 |
}
|
| 32 |
}
|
| 33 |
}
|