Uploaded using `kernel-builder`.
Browse files- build/torch211-cxx11-cu128-x86_64-linux/__init__.py +44 -0
- build/torch211-cxx11-cu128-x86_64-linux/{_fp8_gemm_cuda_1798e7f.abi3.so → _fp8_gemm_cuda_7781728.abi3.so} +2 -2
- build/torch211-cxx11-cu128-x86_64-linux/_ops.py +3 -3
- build/torch211-cxx11-cu128-x86_64-linux/metadata.json +4 -4
- build/torch211-cxx11-cu130-x86_64-linux/__init__.py +44 -0
- build/torch211-cxx11-cu130-x86_64-linux/{_fp8_gemm_cuda_1798e7f.abi3.so → _fp8_gemm_cuda_7781728.abi3.so} +2 -2
- build/torch211-cxx11-cu130-x86_64-linux/_ops.py +3 -3
- build/torch211-cxx11-cu130-x86_64-linux/metadata.json +4 -4
- build/torch212-cxx11-cu130-x86_64-linux/__init__.py +44 -0
- build/torch212-cxx11-cu130-x86_64-linux/{_fp8_gemm_cuda_1798e7f.abi3.so → _fp8_gemm_cuda_7781728.abi3.so} +2 -2
- build/torch212-cxx11-cu130-x86_64-linux/_ops.py +3 -3
- build/torch212-cxx11-cu130-x86_64-linux/metadata.json +4 -4
- build/torch212-cxx11-cu132-x86_64-linux/__init__.py +44 -0
- build/torch212-cxx11-cu132-x86_64-linux/{_fp8_gemm_cuda_1798e7f.abi3.so → _fp8_gemm_cuda_7781728.abi3.so} +2 -2
- build/torch212-cxx11-cu132-x86_64-linux/_ops.py +3 -3
- build/torch212-cxx11-cu132-x86_64-linux/metadata.json +4 -4
build/torch211-cxx11-cu128-x86_64-linux/__init__.py
CHANGED
|
@@ -37,6 +37,29 @@ def _fp8_linear_residual_bf16_fake(
|
|
| 37 |
return None
|
| 38 |
|
| 39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
def select_fp8_linear_tile(m: int, n: int, k: int, variant: int = 0) -> str:
|
| 41 |
"""Return the FlashRT tile selected by the public dispatcher."""
|
| 42 |
|
|
@@ -126,3 +149,24 @@ def fp8_linear_residual_bf16(
|
|
| 126 |
|
| 127 |
ops.fp8_linear_residual_bf16(input, weight, float(alpha), int(variant), residual)
|
| 128 |
return residual
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
return None
|
| 38 |
|
| 39 |
|
| 40 |
+
@torch.library.register_fake(add_op_namespace_prefix("fp8_blockwise_linear_bf16"))
|
| 41 |
+
def _fp8_blockwise_linear_bf16_fake(
|
| 42 |
+
input: torch.Tensor,
|
| 43 |
+
weight: torch.Tensor,
|
| 44 |
+
input_scale: torch.Tensor,
|
| 45 |
+
weight_scale: torch.Tensor,
|
| 46 |
+
out: torch.Tensor,
|
| 47 |
+
) -> None:
|
| 48 |
+
if input.dim() != 2 or weight.dim() != 2:
|
| 49 |
+
raise RuntimeError("input and weight must be rank-2 tensors")
|
| 50 |
+
m, k = input.shape
|
| 51 |
+
n = weight.shape[0]
|
| 52 |
+
if weight.shape[1] != k or n % 128 or k % 128:
|
| 53 |
+
raise RuntimeError("weight shape is invalid or N/K are not divisible by 128")
|
| 54 |
+
if input_scale.shape != (m, k // 128):
|
| 55 |
+
raise RuntimeError("input_scale must have shape (M, K / 128)")
|
| 56 |
+
if weight_scale.shape != (n // 128, k // 128):
|
| 57 |
+
raise RuntimeError("weight_scale must have shape (N / 128, K / 128)")
|
| 58 |
+
if out.shape != (m, n):
|
| 59 |
+
raise RuntimeError("out must have shape (M, N)")
|
| 60 |
+
return None
|
| 61 |
+
|
| 62 |
+
|
| 63 |
def select_fp8_linear_tile(m: int, n: int, k: int, variant: int = 0) -> str:
|
| 64 |
"""Return the FlashRT tile selected by the public dispatcher."""
|
| 65 |
|
|
|
|
| 149 |
|
| 150 |
ops.fp8_linear_residual_bf16(input, weight, float(alpha), int(variant), residual)
|
| 151 |
return residual
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
def fp8_blockwise_linear_bf16(
|
| 155 |
+
input: torch.Tensor,
|
| 156 |
+
weight: torch.Tensor,
|
| 157 |
+
input_scale: torch.Tensor,
|
| 158 |
+
weight_scale: torch.Tensor,
|
| 159 |
+
out: torch.Tensor | None = None,
|
| 160 |
+
) -> torch.Tensor:
|
| 161 |
+
"""Block-128 scaled FP8 linear with BF16 output on SM120."""
|
| 162 |
+
|
| 163 |
+
if out is None:
|
| 164 |
+
out = torch.empty(
|
| 165 |
+
(input.shape[0], weight.shape[0]),
|
| 166 |
+
device=input.device,
|
| 167 |
+
dtype=torch.bfloat16,
|
| 168 |
+
)
|
| 169 |
+
ops.fp8_blockwise_linear_bf16(
|
| 170 |
+
input, weight, input_scale, weight_scale, out
|
| 171 |
+
)
|
| 172 |
+
return out
|
build/torch211-cxx11-cu128-x86_64-linux/{_fp8_gemm_cuda_1798e7f.abi3.so → _fp8_gemm_cuda_7781728.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:6be82a00443a7e3319bdd1e95245c5018deb2b4d8e83cc804f5129f7ee7b2a8f
|
| 3 |
+
size 2746568
|
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 _fp8_gemm_cuda_7781728
|
| 3 |
+
ops = torch.ops._fp8_gemm_cuda_7781728
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
+
return f"_fp8_gemm_cuda_7781728::{op_name}"
|
build/torch211-cxx11-cu128-x86_64-linux/metadata.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "fp8-gemm",
|
| 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 |
-
"
|
| 18 |
-
"_ops.py": "
|
| 19 |
"fp8_gemm/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY="
|
| 20 |
}
|
| 21 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"name": "fp8-gemm",
|
| 3 |
+
"id": "_fp8_gemm_cuda_7781728",
|
| 4 |
"version": 1,
|
| 5 |
"license": "Apache-2.0",
|
| 6 |
"python-depends": [],
|
|
|
|
| 13 |
"digest": {
|
| 14 |
"algorithm": "sha256",
|
| 15 |
"files": {
|
| 16 |
+
"__init__.py": "uWjRC3s2poDCcXR5pj50SnVDkAHxIigNqoZf4ZiZqtk=",
|
| 17 |
+
"_fp8_gemm_cuda_7781728.abi3.so": "a+gqAEQ6fjMZvdHpUkXFAY3rK02Og8yAT1Ep9+57Ko8=",
|
| 18 |
+
"_ops.py": "6TPtFt+clLa8bHDB6098n/YmhCJdVj+tBsr8b4tKPWM=",
|
| 19 |
"fp8_gemm/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY="
|
| 20 |
}
|
| 21 |
}
|
build/torch211-cxx11-cu130-x86_64-linux/__init__.py
CHANGED
|
@@ -37,6 +37,29 @@ def _fp8_linear_residual_bf16_fake(
|
|
| 37 |
return None
|
| 38 |
|
| 39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
def select_fp8_linear_tile(m: int, n: int, k: int, variant: int = 0) -> str:
|
| 41 |
"""Return the FlashRT tile selected by the public dispatcher."""
|
| 42 |
|
|
@@ -126,3 +149,24 @@ def fp8_linear_residual_bf16(
|
|
| 126 |
|
| 127 |
ops.fp8_linear_residual_bf16(input, weight, float(alpha), int(variant), residual)
|
| 128 |
return residual
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
return None
|
| 38 |
|
| 39 |
|
| 40 |
+
@torch.library.register_fake(add_op_namespace_prefix("fp8_blockwise_linear_bf16"))
|
| 41 |
+
def _fp8_blockwise_linear_bf16_fake(
|
| 42 |
+
input: torch.Tensor,
|
| 43 |
+
weight: torch.Tensor,
|
| 44 |
+
input_scale: torch.Tensor,
|
| 45 |
+
weight_scale: torch.Tensor,
|
| 46 |
+
out: torch.Tensor,
|
| 47 |
+
) -> None:
|
| 48 |
+
if input.dim() != 2 or weight.dim() != 2:
|
| 49 |
+
raise RuntimeError("input and weight must be rank-2 tensors")
|
| 50 |
+
m, k = input.shape
|
| 51 |
+
n = weight.shape[0]
|
| 52 |
+
if weight.shape[1] != k or n % 128 or k % 128:
|
| 53 |
+
raise RuntimeError("weight shape is invalid or N/K are not divisible by 128")
|
| 54 |
+
if input_scale.shape != (m, k // 128):
|
| 55 |
+
raise RuntimeError("input_scale must have shape (M, K / 128)")
|
| 56 |
+
if weight_scale.shape != (n // 128, k // 128):
|
| 57 |
+
raise RuntimeError("weight_scale must have shape (N / 128, K / 128)")
|
| 58 |
+
if out.shape != (m, n):
|
| 59 |
+
raise RuntimeError("out must have shape (M, N)")
|
| 60 |
+
return None
|
| 61 |
+
|
| 62 |
+
|
| 63 |
def select_fp8_linear_tile(m: int, n: int, k: int, variant: int = 0) -> str:
|
| 64 |
"""Return the FlashRT tile selected by the public dispatcher."""
|
| 65 |
|
|
|
|
| 149 |
|
| 150 |
ops.fp8_linear_residual_bf16(input, weight, float(alpha), int(variant), residual)
|
| 151 |
return residual
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
def fp8_blockwise_linear_bf16(
|
| 155 |
+
input: torch.Tensor,
|
| 156 |
+
weight: torch.Tensor,
|
| 157 |
+
input_scale: torch.Tensor,
|
| 158 |
+
weight_scale: torch.Tensor,
|
| 159 |
+
out: torch.Tensor | None = None,
|
| 160 |
+
) -> torch.Tensor:
|
| 161 |
+
"""Block-128 scaled FP8 linear with BF16 output on SM120."""
|
| 162 |
+
|
| 163 |
+
if out is None:
|
| 164 |
+
out = torch.empty(
|
| 165 |
+
(input.shape[0], weight.shape[0]),
|
| 166 |
+
device=input.device,
|
| 167 |
+
dtype=torch.bfloat16,
|
| 168 |
+
)
|
| 169 |
+
ops.fp8_blockwise_linear_bf16(
|
| 170 |
+
input, weight, input_scale, weight_scale, out
|
| 171 |
+
)
|
| 172 |
+
return out
|
build/torch211-cxx11-cu130-x86_64-linux/{_fp8_gemm_cuda_1798e7f.abi3.so → _fp8_gemm_cuda_7781728.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:978c573627c98f53136f99346f94940e2a39bbfc2ac6ddb07161bc92d0aec17e
|
| 3 |
+
size 2903520
|
build/torch211-cxx11-cu130-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 _fp8_gemm_cuda_7781728
|
| 3 |
+
ops = torch.ops._fp8_gemm_cuda_7781728
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
+
return f"_fp8_gemm_cuda_7781728::{op_name}"
|
build/torch211-cxx11-cu130-x86_64-linux/metadata.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "fp8-gemm",
|
| 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 |
-
"
|
| 18 |
-
"_ops.py": "
|
| 19 |
"fp8_gemm/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY="
|
| 20 |
}
|
| 21 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"name": "fp8-gemm",
|
| 3 |
+
"id": "_fp8_gemm_cuda_7781728",
|
| 4 |
"version": 1,
|
| 5 |
"license": "Apache-2.0",
|
| 6 |
"python-depends": [],
|
|
|
|
| 13 |
"digest": {
|
| 14 |
"algorithm": "sha256",
|
| 15 |
"files": {
|
| 16 |
+
"__init__.py": "uWjRC3s2poDCcXR5pj50SnVDkAHxIigNqoZf4ZiZqtk=",
|
| 17 |
+
"_fp8_gemm_cuda_7781728.abi3.so": "l4xXNifJj1MTb5k0b5SUDio5u/wqxt2wcWG8ktCuwX4=",
|
| 18 |
+
"_ops.py": "6TPtFt+clLa8bHDB6098n/YmhCJdVj+tBsr8b4tKPWM=",
|
| 19 |
"fp8_gemm/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY="
|
| 20 |
}
|
| 21 |
}
|
build/torch212-cxx11-cu130-x86_64-linux/__init__.py
CHANGED
|
@@ -37,6 +37,29 @@ def _fp8_linear_residual_bf16_fake(
|
|
| 37 |
return None
|
| 38 |
|
| 39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
def select_fp8_linear_tile(m: int, n: int, k: int, variant: int = 0) -> str:
|
| 41 |
"""Return the FlashRT tile selected by the public dispatcher."""
|
| 42 |
|
|
@@ -126,3 +149,24 @@ def fp8_linear_residual_bf16(
|
|
| 126 |
|
| 127 |
ops.fp8_linear_residual_bf16(input, weight, float(alpha), int(variant), residual)
|
| 128 |
return residual
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
return None
|
| 38 |
|
| 39 |
|
| 40 |
+
@torch.library.register_fake(add_op_namespace_prefix("fp8_blockwise_linear_bf16"))
|
| 41 |
+
def _fp8_blockwise_linear_bf16_fake(
|
| 42 |
+
input: torch.Tensor,
|
| 43 |
+
weight: torch.Tensor,
|
| 44 |
+
input_scale: torch.Tensor,
|
| 45 |
+
weight_scale: torch.Tensor,
|
| 46 |
+
out: torch.Tensor,
|
| 47 |
+
) -> None:
|
| 48 |
+
if input.dim() != 2 or weight.dim() != 2:
|
| 49 |
+
raise RuntimeError("input and weight must be rank-2 tensors")
|
| 50 |
+
m, k = input.shape
|
| 51 |
+
n = weight.shape[0]
|
| 52 |
+
if weight.shape[1] != k or n % 128 or k % 128:
|
| 53 |
+
raise RuntimeError("weight shape is invalid or N/K are not divisible by 128")
|
| 54 |
+
if input_scale.shape != (m, k // 128):
|
| 55 |
+
raise RuntimeError("input_scale must have shape (M, K / 128)")
|
| 56 |
+
if weight_scale.shape != (n // 128, k // 128):
|
| 57 |
+
raise RuntimeError("weight_scale must have shape (N / 128, K / 128)")
|
| 58 |
+
if out.shape != (m, n):
|
| 59 |
+
raise RuntimeError("out must have shape (M, N)")
|
| 60 |
+
return None
|
| 61 |
+
|
| 62 |
+
|
| 63 |
def select_fp8_linear_tile(m: int, n: int, k: int, variant: int = 0) -> str:
|
| 64 |
"""Return the FlashRT tile selected by the public dispatcher."""
|
| 65 |
|
|
|
|
| 149 |
|
| 150 |
ops.fp8_linear_residual_bf16(input, weight, float(alpha), int(variant), residual)
|
| 151 |
return residual
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
def fp8_blockwise_linear_bf16(
|
| 155 |
+
input: torch.Tensor,
|
| 156 |
+
weight: torch.Tensor,
|
| 157 |
+
input_scale: torch.Tensor,
|
| 158 |
+
weight_scale: torch.Tensor,
|
| 159 |
+
out: torch.Tensor | None = None,
|
| 160 |
+
) -> torch.Tensor:
|
| 161 |
+
"""Block-128 scaled FP8 linear with BF16 output on SM120."""
|
| 162 |
+
|
| 163 |
+
if out is None:
|
| 164 |
+
out = torch.empty(
|
| 165 |
+
(input.shape[0], weight.shape[0]),
|
| 166 |
+
device=input.device,
|
| 167 |
+
dtype=torch.bfloat16,
|
| 168 |
+
)
|
| 169 |
+
ops.fp8_blockwise_linear_bf16(
|
| 170 |
+
input, weight, input_scale, weight_scale, out
|
| 171 |
+
)
|
| 172 |
+
return out
|
build/torch212-cxx11-cu130-x86_64-linux/{_fp8_gemm_cuda_1798e7f.abi3.so → _fp8_gemm_cuda_7781728.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:7b6492b889256ae7e3f8ca008663e591ebc6e3d8adedc1a3abd54ea6ddd69c57
|
| 3 |
+
size 2913984
|
build/torch212-cxx11-cu130-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 _fp8_gemm_cuda_7781728
|
| 3 |
+
ops = torch.ops._fp8_gemm_cuda_7781728
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
+
return f"_fp8_gemm_cuda_7781728::{op_name}"
|
build/torch212-cxx11-cu130-x86_64-linux/metadata.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "fp8-gemm",
|
| 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 |
-
"
|
| 18 |
-
"_ops.py": "
|
| 19 |
"fp8_gemm/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY="
|
| 20 |
}
|
| 21 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"name": "fp8-gemm",
|
| 3 |
+
"id": "_fp8_gemm_cuda_7781728",
|
| 4 |
"version": 1,
|
| 5 |
"license": "Apache-2.0",
|
| 6 |
"python-depends": [],
|
|
|
|
| 13 |
"digest": {
|
| 14 |
"algorithm": "sha256",
|
| 15 |
"files": {
|
| 16 |
+
"__init__.py": "uWjRC3s2poDCcXR5pj50SnVDkAHxIigNqoZf4ZiZqtk=",
|
| 17 |
+
"_fp8_gemm_cuda_7781728.abi3.so": "e2SSuIklaufj+MoAhmPlkevG49it7cGjq9VOpt3WnFc=",
|
| 18 |
+
"_ops.py": "6TPtFt+clLa8bHDB6098n/YmhCJdVj+tBsr8b4tKPWM=",
|
| 19 |
"fp8_gemm/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY="
|
| 20 |
}
|
| 21 |
}
|
build/torch212-cxx11-cu132-x86_64-linux/__init__.py
CHANGED
|
@@ -37,6 +37,29 @@ def _fp8_linear_residual_bf16_fake(
|
|
| 37 |
return None
|
| 38 |
|
| 39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
def select_fp8_linear_tile(m: int, n: int, k: int, variant: int = 0) -> str:
|
| 41 |
"""Return the FlashRT tile selected by the public dispatcher."""
|
| 42 |
|
|
@@ -126,3 +149,24 @@ def fp8_linear_residual_bf16(
|
|
| 126 |
|
| 127 |
ops.fp8_linear_residual_bf16(input, weight, float(alpha), int(variant), residual)
|
| 128 |
return residual
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
return None
|
| 38 |
|
| 39 |
|
| 40 |
+
@torch.library.register_fake(add_op_namespace_prefix("fp8_blockwise_linear_bf16"))
|
| 41 |
+
def _fp8_blockwise_linear_bf16_fake(
|
| 42 |
+
input: torch.Tensor,
|
| 43 |
+
weight: torch.Tensor,
|
| 44 |
+
input_scale: torch.Tensor,
|
| 45 |
+
weight_scale: torch.Tensor,
|
| 46 |
+
out: torch.Tensor,
|
| 47 |
+
) -> None:
|
| 48 |
+
if input.dim() != 2 or weight.dim() != 2:
|
| 49 |
+
raise RuntimeError("input and weight must be rank-2 tensors")
|
| 50 |
+
m, k = input.shape
|
| 51 |
+
n = weight.shape[0]
|
| 52 |
+
if weight.shape[1] != k or n % 128 or k % 128:
|
| 53 |
+
raise RuntimeError("weight shape is invalid or N/K are not divisible by 128")
|
| 54 |
+
if input_scale.shape != (m, k // 128):
|
| 55 |
+
raise RuntimeError("input_scale must have shape (M, K / 128)")
|
| 56 |
+
if weight_scale.shape != (n // 128, k // 128):
|
| 57 |
+
raise RuntimeError("weight_scale must have shape (N / 128, K / 128)")
|
| 58 |
+
if out.shape != (m, n):
|
| 59 |
+
raise RuntimeError("out must have shape (M, N)")
|
| 60 |
+
return None
|
| 61 |
+
|
| 62 |
+
|
| 63 |
def select_fp8_linear_tile(m: int, n: int, k: int, variant: int = 0) -> str:
|
| 64 |
"""Return the FlashRT tile selected by the public dispatcher."""
|
| 65 |
|
|
|
|
| 149 |
|
| 150 |
ops.fp8_linear_residual_bf16(input, weight, float(alpha), int(variant), residual)
|
| 151 |
return residual
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
def fp8_blockwise_linear_bf16(
|
| 155 |
+
input: torch.Tensor,
|
| 156 |
+
weight: torch.Tensor,
|
| 157 |
+
input_scale: torch.Tensor,
|
| 158 |
+
weight_scale: torch.Tensor,
|
| 159 |
+
out: torch.Tensor | None = None,
|
| 160 |
+
) -> torch.Tensor:
|
| 161 |
+
"""Block-128 scaled FP8 linear with BF16 output on SM120."""
|
| 162 |
+
|
| 163 |
+
if out is None:
|
| 164 |
+
out = torch.empty(
|
| 165 |
+
(input.shape[0], weight.shape[0]),
|
| 166 |
+
device=input.device,
|
| 167 |
+
dtype=torch.bfloat16,
|
| 168 |
+
)
|
| 169 |
+
ops.fp8_blockwise_linear_bf16(
|
| 170 |
+
input, weight, input_scale, weight_scale, out
|
| 171 |
+
)
|
| 172 |
+
return out
|
build/torch212-cxx11-cu132-x86_64-linux/{_fp8_gemm_cuda_1798e7f.abi3.so → _fp8_gemm_cuda_7781728.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:3bd082c05250581709740a586316b540d2493833235aff419b6bc67abfcac0ab
|
| 3 |
+
size 2922232
|
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 _fp8_gemm_cuda_7781728
|
| 3 |
+
ops = torch.ops._fp8_gemm_cuda_7781728
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
+
return f"_fp8_gemm_cuda_7781728::{op_name}"
|
build/torch212-cxx11-cu132-x86_64-linux/metadata.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "fp8-gemm",
|
| 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 |
-
"
|
| 18 |
-
"_ops.py": "
|
| 19 |
"fp8_gemm/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY="
|
| 20 |
}
|
| 21 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"name": "fp8-gemm",
|
| 3 |
+
"id": "_fp8_gemm_cuda_7781728",
|
| 4 |
"version": 1,
|
| 5 |
"license": "Apache-2.0",
|
| 6 |
"python-depends": [],
|
|
|
|
| 13 |
"digest": {
|
| 14 |
"algorithm": "sha256",
|
| 15 |
"files": {
|
| 16 |
+
"__init__.py": "uWjRC3s2poDCcXR5pj50SnVDkAHxIigNqoZf4ZiZqtk=",
|
| 17 |
+
"_fp8_gemm_cuda_7781728.abi3.so": "O9CCwFJQWBcJdApYYxa1QNJJODMjWv9Bm2vGer/KwKs=",
|
| 18 |
+
"_ops.py": "6TPtFt+clLa8bHDB6098n/YmhCJdVj+tBsr8b4tKPWM=",
|
| 19 |
"fp8_gemm/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY="
|
| 20 |
}
|
| 21 |
}
|