Add torch213-cxx11-cu130-aarch64-linux artifact
Browse files- build/torch213-cxx11-cu130-aarch64-linux/__init__.py +71 -0
- build/torch213-cxx11-cu130-aarch64-linux/_ops.py +6 -0
- build/torch213-cxx11-cu130-aarch64-linux/bf16_linear_gemv/__init__.py +14 -0
- build/torch213-cxx11-cu130-aarch64-linux/bf16_linear_gemv_source_test.abi3.so +3 -0
- build/torch213-cxx11-cu130-aarch64-linux/metadata.json +32 -0
build/torch213-cxx11-cu130-aarch64-linux/__init__.py
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""FlashRT BF16 decode GEMV kernels."""
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
from typing import Optional
|
| 6 |
+
|
| 7 |
+
import torch
|
| 8 |
+
|
| 9 |
+
from ._ops import add_op_namespace_prefix, ops
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
@torch.library.register_fake(add_op_namespace_prefix("bf16_decode_gemv_bf16"))
|
| 13 |
+
def _bf16_decode_gemv_fake(
|
| 14 |
+
x: torch.Tensor,
|
| 15 |
+
weight: torch.Tensor,
|
| 16 |
+
alpha: float,
|
| 17 |
+
variant: int,
|
| 18 |
+
out: torch.Tensor,
|
| 19 |
+
) -> None:
|
| 20 |
+
k = x.shape[0] if x.dim() == 1 else x.shape[1]
|
| 21 |
+
if weight.dim() != 2 or weight.shape[1] != k or out.shape != (weight.shape[0],):
|
| 22 |
+
raise RuntimeError("expected x (K,) or (1,K), weight (N,K), out (N,)")
|
| 23 |
+
return None
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
@torch.library.register_fake(add_op_namespace_prefix("bf16_decode_gemv_unrolled_bf16"))
|
| 27 |
+
def _bf16_decode_gemv_unrolled_fake(
|
| 28 |
+
x: torch.Tensor,
|
| 29 |
+
weight: torch.Tensor,
|
| 30 |
+
out: torch.Tensor,
|
| 31 |
+
) -> None:
|
| 32 |
+
k = x.shape[0] if x.dim() == 1 else x.shape[1]
|
| 33 |
+
if weight.dim() != 2 or weight.shape[1] != k or out.shape != (weight.shape[0],):
|
| 34 |
+
raise RuntimeError("expected x (K,) or (1,K), weight (N,K), out (N,)")
|
| 35 |
+
return None
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
def bf16_decode_gemv_bf16(
|
| 39 |
+
x: torch.Tensor,
|
| 40 |
+
weight: torch.Tensor,
|
| 41 |
+
*,
|
| 42 |
+
alpha: float = 1.0,
|
| 43 |
+
variant: int = 0,
|
| 44 |
+
out: Optional[torch.Tensor] = None,
|
| 45 |
+
) -> torch.Tensor:
|
| 46 |
+
"""Compute BF16 M=1 decode GEMV: ``out = x @ weight.T * alpha``."""
|
| 47 |
+
|
| 48 |
+
if out is None:
|
| 49 |
+
out = torch.empty((weight.shape[0],), device=x.device, dtype=torch.bfloat16)
|
| 50 |
+
ops.bf16_decode_gemv_bf16(x, weight, float(alpha), int(variant), out)
|
| 51 |
+
return out
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
def bf16_decode_gemv_unrolled_bf16(
|
| 55 |
+
x: torch.Tensor,
|
| 56 |
+
weight: torch.Tensor,
|
| 57 |
+
*,
|
| 58 |
+
out: Optional[torch.Tensor] = None,
|
| 59 |
+
) -> torch.Tensor:
|
| 60 |
+
"""Compute BF16 M=1 GEMV with the unrolled memory-level-parallel kernel."""
|
| 61 |
+
|
| 62 |
+
if out is None:
|
| 63 |
+
out = torch.empty((weight.shape[0],), device=x.device, dtype=torch.bfloat16)
|
| 64 |
+
ops.bf16_decode_gemv_unrolled_bf16(x, weight, out)
|
| 65 |
+
return out
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
__all__ = [
|
| 69 |
+
"bf16_decode_gemv_bf16",
|
| 70 |
+
"bf16_decode_gemv_unrolled_bf16",
|
| 71 |
+
]
|
build/torch213-cxx11-cu130-aarch64-linux/_ops.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from . import bf16_linear_gemv_source_test
|
| 3 |
+
ops = torch.ops.bf16_linear_gemv_source_test
|
| 4 |
+
|
| 5 |
+
def add_op_namespace_prefix(op_name: str):
|
| 6 |
+
return f"bf16_linear_gemv_source_test::{op_name}"
|
build/torch213-cxx11-cu130-aarch64-linux/bf16_linear_gemv/__init__.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import ctypes
|
| 2 |
+
import importlib.util
|
| 3 |
+
import sys
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
|
| 6 |
+
def _import_from_path(file_path: Path):
|
| 7 |
+
path_hash = '{:x}'.format(ctypes.c_size_t(hash(file_path.absolute())).value)
|
| 8 |
+
spec = importlib.util.spec_from_file_location(path_hash, file_path)
|
| 9 |
+
module = importlib.util.module_from_spec(spec)
|
| 10 |
+
sys.modules[path_hash] = module
|
| 11 |
+
spec.loader.exec_module(module)
|
| 12 |
+
return module
|
| 13 |
+
|
| 14 |
+
globals().update(vars(_import_from_path(Path(__file__).parent.parent / '__init__.py')))
|
build/torch213-cxx11-cu130-aarch64-linux/bf16_linear_gemv_source_test.abi3.so
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b63706bfe0a497b5c27a6a11b46bcbbe7e7fbfd1d3b608e4c987e45347f48132
|
| 3 |
+
size 242304
|
build/torch213-cxx11-cu130-aarch64-linux/metadata.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "bf16-linear-gemv",
|
| 3 |
+
"id": "bf16_linear_gemv_source_test",
|
| 4 |
+
"version": 1,
|
| 5 |
+
"license": "Apache-2.0",
|
| 6 |
+
"python-depends": [],
|
| 7 |
+
"backend": {
|
| 8 |
+
"type": "cuda",
|
| 9 |
+
"archs": [
|
| 10 |
+
"11.0"
|
| 11 |
+
]
|
| 12 |
+
},
|
| 13 |
+
"digest": {
|
| 14 |
+
"algorithm": "sha256",
|
| 15 |
+
"files": {
|
| 16 |
+
"__init__.py": "suVWR4yT6KI3SozcL9Y+/yCd8QFTfoqGQmblO9GCPdc=",
|
| 17 |
+
"bf16_linear_gemv_source_test.abi3.so": "tjcGv+Ckl7XCemoRtGvLvn5/v9HTtgjkyYfkU0f0gTI=",
|
| 18 |
+
"_ops.py": "rSHQl/ZTZ94dlDV8sg+HA3shaqmvJGixo+6Rbfj7jvw=",
|
| 19 |
+
"bf16_linear_gemv/__init__.py": "v6p5XMfQzddhi1fLSAw4HX9CyS0rQsidvu9VsT01xi4="
|
| 20 |
+
}
|
| 21 |
+
},
|
| 22 |
+
"provenance": {
|
| 23 |
+
"kernel": {
|
| 24 |
+
"sha": "456d297",
|
| 25 |
+
"dirty": false
|
| 26 |
+
},
|
| 27 |
+
"validation": {
|
| 28 |
+
"torch": "2.13.0+cu130",
|
| 29 |
+
"cuda": "13.0"
|
| 30 |
+
}
|
| 31 |
+
}
|
| 32 |
+
}
|