Uploaded using `kernel-builder`.
Browse files- build/torch211-cxx11-cu126-x86_64-linux/__init__.py +9 -0
- build/torch211-cxx11-cu126-x86_64-linux/{_fp8linear_cuda_91cad61.abi3.so → _fp8linear_cuda_999b53f.abi3.so} +2 -2
- build/torch211-cxx11-cu126-x86_64-linux/_ops.py +3 -3
- build/torch211-cxx11-cu126-x86_64-linux/layers.py +36 -0
- build/torch211-cxx11-cu126-x86_64-linux/metadata.json +5 -5
- build/torch211-cxx11-cu128-x86_64-linux/__init__.py +9 -0
- build/torch211-cxx11-cu128-x86_64-linux/{_fp8linear_cuda_91cad61.abi3.so → _fp8linear_cuda_999b53f.abi3.so} +2 -2
- build/torch211-cxx11-cu128-x86_64-linux/_ops.py +3 -3
- build/torch211-cxx11-cu128-x86_64-linux/layers.py +36 -0
- build/torch211-cxx11-cu128-x86_64-linux/metadata.json +5 -5
- build/torch211-cxx11-cu130-x86_64-linux/__init__.py +9 -0
- build/torch211-cxx11-cu130-x86_64-linux/{_fp8linear_cuda_91cad61.abi3.so → _fp8linear_cuda_999b53f.abi3.so} +2 -2
- build/torch211-cxx11-cu130-x86_64-linux/_ops.py +3 -3
- build/torch211-cxx11-cu130-x86_64-linux/layers.py +36 -0
- build/torch211-cxx11-cu130-x86_64-linux/metadata.json +5 -5
- build/torch212-cxx11-cu126-x86_64-linux/__init__.py +9 -0
- build/torch212-cxx11-cu126-x86_64-linux/{_fp8linear_cuda_91cad61.abi3.so → _fp8linear_cuda_999b53f.abi3.so} +2 -2
- build/torch212-cxx11-cu126-x86_64-linux/_ops.py +3 -3
- build/torch212-cxx11-cu126-x86_64-linux/layers.py +36 -0
- build/torch212-cxx11-cu126-x86_64-linux/metadata.json +5 -5
- build/torch212-cxx11-cu130-x86_64-linux/__init__.py +9 -0
- build/torch212-cxx11-cu130-x86_64-linux/_fp8linear_cuda_91cad61.abi3.so +0 -3
- build/torch212-cxx11-cu130-x86_64-linux/_fp8linear_cuda_999b53f.abi3.so +3 -0
- build/torch212-cxx11-cu130-x86_64-linux/_ops.py +3 -3
- build/torch212-cxx11-cu130-x86_64-linux/layers.py +36 -0
- build/torch212-cxx11-cu130-x86_64-linux/metadata.json +5 -5
- build/torch212-cxx11-cu132-x86_64-linux/__init__.py +9 -0
- build/torch212-cxx11-cu132-x86_64-linux/_fp8linear_cuda_91cad61.abi3.so +0 -3
- build/torch212-cxx11-cu132-x86_64-linux/_fp8linear_cuda_999b53f.abi3.so +3 -0
- build/torch212-cxx11-cu132-x86_64-linux/_ops.py +3 -3
- build/torch212-cxx11-cu132-x86_64-linux/layers.py +36 -0
- build/torch212-cxx11-cu132-x86_64-linux/metadata.json +5 -5
build/torch211-cxx11-cu126-x86_64-linux/__init__.py
CHANGED
|
@@ -4,15 +4,19 @@ from .layers import (
|
|
| 4 |
Fp8Linear,
|
| 5 |
fp8_linear,
|
| 6 |
mxfp8_linear,
|
|
|
|
| 7 |
quantize_,
|
| 8 |
quantize_weight,
|
| 9 |
quantize_weight_mxfp8,
|
|
|
|
| 10 |
)
|
| 11 |
|
| 12 |
quantize_fp8 = ops.quantize_fp8
|
| 13 |
fp8_gemm = ops.fp8_gemm
|
| 14 |
quantize_mxfp8 = ops.quantize_mxfp8
|
| 15 |
mxfp8_gemm = ops.mxfp8_gemm
|
|
|
|
|
|
|
| 16 |
|
| 17 |
__all__ = [
|
| 18 |
"ops",
|
|
@@ -28,4 +32,9 @@ __all__ = [
|
|
| 28 |
"quantize_weight_mxfp8",
|
| 29 |
"quantize_mxfp8",
|
| 30 |
"mxfp8_gemm",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
]
|
|
|
|
| 4 |
Fp8Linear,
|
| 5 |
fp8_linear,
|
| 6 |
mxfp8_linear,
|
| 7 |
+
nvfp4_linear,
|
| 8 |
quantize_,
|
| 9 |
quantize_weight,
|
| 10 |
quantize_weight_mxfp8,
|
| 11 |
+
quantize_weight_nvfp4,
|
| 12 |
)
|
| 13 |
|
| 14 |
quantize_fp8 = ops.quantize_fp8
|
| 15 |
fp8_gemm = ops.fp8_gemm
|
| 16 |
quantize_mxfp8 = ops.quantize_mxfp8
|
| 17 |
mxfp8_gemm = ops.mxfp8_gemm
|
| 18 |
+
quantize_nvfp4 = ops.quantize_nvfp4
|
| 19 |
+
nvfp4_gemm = ops.nvfp4_gemm
|
| 20 |
|
| 21 |
__all__ = [
|
| 22 |
"ops",
|
|
|
|
| 32 |
"quantize_weight_mxfp8",
|
| 33 |
"quantize_mxfp8",
|
| 34 |
"mxfp8_gemm",
|
| 35 |
+
# Blackwell NVFP4 path
|
| 36 |
+
"nvfp4_linear",
|
| 37 |
+
"quantize_weight_nvfp4",
|
| 38 |
+
"quantize_nvfp4",
|
| 39 |
+
"nvfp4_gemm",
|
| 40 |
]
|
build/torch211-cxx11-cu126-x86_64-linux/{_fp8linear_cuda_91cad61.abi3.so → _fp8linear_cuda_999b53f.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:bfbef942a42a1b843800e210491cf50b4d5e055765f8737ec7b333772753fe4d
|
| 3 |
+
size 296120
|
build/torch211-cxx11-cu126-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 _fp8linear_cuda_999b53f
|
| 3 |
+
ops = torch.ops._fp8linear_cuda_999b53f
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
+
return f"_fp8linear_cuda_999b53f::{op_name}"
|
build/torch211-cxx11-cu126-x86_64-linux/layers.py
CHANGED
|
@@ -47,6 +47,25 @@ def _mxfp8_linear_fake(x, wq, w_scales, bias=None):
|
|
| 47 |
return x.new_empty((*x.shape[:-1], wq.shape[0]), dtype=torch.float16)
|
| 48 |
|
| 49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
MX_BLOCK = 32
|
| 51 |
|
| 52 |
|
|
@@ -67,6 +86,23 @@ def mxfp8_linear(x, wq, w_scales, bias=None):
|
|
| 67 |
return ops.mxfp8_linear(x, wq, w_scales, bias)
|
| 68 |
|
| 69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
def quantize_weight(weight: torch.Tensor):
|
| 71 |
"""Arch-aware weight quantization (the choice lives in C++ `ops.quantize_weight`).
|
| 72 |
|
|
|
|
| 47 |
return x.new_empty((*x.shape[:-1], wq.shape[0]), dtype=torch.float16)
|
| 48 |
|
| 49 |
|
| 50 |
+
@torch.library.register_fake(add_op_namespace_prefix("quantize_nvfp4"))
|
| 51 |
+
def _quantize_nvfp4_fake(x):
|
| 52 |
+
xq = x.new_empty((x.shape[0], x.shape[1] // 2), dtype=torch.uint8)
|
| 53 |
+
nrb = (x.shape[0] + 127) // 128
|
| 54 |
+
ncb = (x.shape[1] // 16 + 3) // 4
|
| 55 |
+
scales = x.new_empty((nrb * ncb * 512,), dtype=torch.uint8)
|
| 56 |
+
return xq, scales
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
@torch.library.register_fake(add_op_namespace_prefix("nvfp4_gemm"))
|
| 60 |
+
def _nvfp4_gemm_fake(xq, x_scales, wq, w_scales, bias=None):
|
| 61 |
+
return xq.new_empty((xq.shape[0], wq.shape[0]), dtype=torch.float16)
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
@torch.library.register_fake(add_op_namespace_prefix("nvfp4_linear"))
|
| 65 |
+
def _nvfp4_linear_fake(x, wq, w_scales, bias=None):
|
| 66 |
+
return x.new_empty((*x.shape[:-1], wq.shape[0]), dtype=torch.float16)
|
| 67 |
+
|
| 68 |
+
|
| 69 |
MX_BLOCK = 32
|
| 70 |
|
| 71 |
|
|
|
|
| 86 |
return ops.mxfp8_linear(x, wq, w_scales, bias)
|
| 87 |
|
| 88 |
|
| 89 |
+
def quantize_weight_nvfp4(weight: torch.Tensor):
|
| 90 |
+
"""NVFP4 block-quantize a [N, K] weight (offline) via the CUDA kernel.
|
| 91 |
+
|
| 92 |
+
Returns (wq[N, K/2] packed e2m1 uint8, scales uint8/e4m3 in the tiled cuBLASLt
|
| 93 |
+
layout) for `nvfp4_gemm`/`nvfp4_linear`.
|
| 94 |
+
"""
|
| 95 |
+
w = weight.detach()
|
| 96 |
+
if w.dtype not in (torch.float16, torch.bfloat16):
|
| 97 |
+
w = w.to(torch.bfloat16)
|
| 98 |
+
return ops.quantize_nvfp4(w.contiguous())
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
def nvfp4_linear(x, wq, w_scales, bias=None):
|
| 102 |
+
"""NVFP4 linear (Blackwell sm_100+). `wq`/`w_scales` from quantize_weight_nvfp4."""
|
| 103 |
+
return ops.nvfp4_linear(x, wq, w_scales, bias)
|
| 104 |
+
|
| 105 |
+
|
| 106 |
def quantize_weight(weight: torch.Tensor):
|
| 107 |
"""Arch-aware weight quantization (the choice lives in C++ `ops.quantize_weight`).
|
| 108 |
|
build/torch211-cxx11-cu126-x86_64-linux/metadata.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "fp8linear",
|
| 3 |
-
"id": "
|
| 4 |
"version": 1,
|
| 5 |
"license": "MIT",
|
| 6 |
"python-depends": [],
|
|
@@ -14,11 +14,11 @@
|
|
| 14 |
"digest": {
|
| 15 |
"algorithm": "sha256",
|
| 16 |
"files": {
|
| 17 |
-
"__init__.py": "
|
| 18 |
-
"
|
| 19 |
-
"_ops.py": "
|
| 20 |
"fp8linear/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY=",
|
| 21 |
-
"layers.py": "
|
| 22 |
}
|
| 23 |
}
|
| 24 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"name": "fp8linear",
|
| 3 |
+
"id": "_fp8linear_cuda_999b53f",
|
| 4 |
"version": 1,
|
| 5 |
"license": "MIT",
|
| 6 |
"python-depends": [],
|
|
|
|
| 14 |
"digest": {
|
| 15 |
"algorithm": "sha256",
|
| 16 |
"files": {
|
| 17 |
+
"__init__.py": "kuYXA/yMzeG8mUeRuFseTWi5nnWR13ZFrBVvAZqJPeY=",
|
| 18 |
+
"_fp8linear_cuda_999b53f.abi3.so": "v775QqQqG4Q4AOIQSRz1C01eBVdl+HN+x7MzdydT/k0=",
|
| 19 |
+
"_ops.py": "DKOF2voEdv6S/MArdkqK14wb9yDH06Fmy9QNdlQ4Kgo=",
|
| 20 |
"fp8linear/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY=",
|
| 21 |
+
"layers.py": "6JzuLWloloQ29zkTO9Dv9jJX4aV/yrFU5MbkJqiNr5w="
|
| 22 |
}
|
| 23 |
}
|
| 24 |
}
|
build/torch211-cxx11-cu128-x86_64-linux/__init__.py
CHANGED
|
@@ -4,15 +4,19 @@ from .layers import (
|
|
| 4 |
Fp8Linear,
|
| 5 |
fp8_linear,
|
| 6 |
mxfp8_linear,
|
|
|
|
| 7 |
quantize_,
|
| 8 |
quantize_weight,
|
| 9 |
quantize_weight_mxfp8,
|
|
|
|
| 10 |
)
|
| 11 |
|
| 12 |
quantize_fp8 = ops.quantize_fp8
|
| 13 |
fp8_gemm = ops.fp8_gemm
|
| 14 |
quantize_mxfp8 = ops.quantize_mxfp8
|
| 15 |
mxfp8_gemm = ops.mxfp8_gemm
|
|
|
|
|
|
|
| 16 |
|
| 17 |
__all__ = [
|
| 18 |
"ops",
|
|
@@ -28,4 +32,9 @@ __all__ = [
|
|
| 28 |
"quantize_weight_mxfp8",
|
| 29 |
"quantize_mxfp8",
|
| 30 |
"mxfp8_gemm",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
]
|
|
|
|
| 4 |
Fp8Linear,
|
| 5 |
fp8_linear,
|
| 6 |
mxfp8_linear,
|
| 7 |
+
nvfp4_linear,
|
| 8 |
quantize_,
|
| 9 |
quantize_weight,
|
| 10 |
quantize_weight_mxfp8,
|
| 11 |
+
quantize_weight_nvfp4,
|
| 12 |
)
|
| 13 |
|
| 14 |
quantize_fp8 = ops.quantize_fp8
|
| 15 |
fp8_gemm = ops.fp8_gemm
|
| 16 |
quantize_mxfp8 = ops.quantize_mxfp8
|
| 17 |
mxfp8_gemm = ops.mxfp8_gemm
|
| 18 |
+
quantize_nvfp4 = ops.quantize_nvfp4
|
| 19 |
+
nvfp4_gemm = ops.nvfp4_gemm
|
| 20 |
|
| 21 |
__all__ = [
|
| 22 |
"ops",
|
|
|
|
| 32 |
"quantize_weight_mxfp8",
|
| 33 |
"quantize_mxfp8",
|
| 34 |
"mxfp8_gemm",
|
| 35 |
+
# Blackwell NVFP4 path
|
| 36 |
+
"nvfp4_linear",
|
| 37 |
+
"quantize_weight_nvfp4",
|
| 38 |
+
"quantize_nvfp4",
|
| 39 |
+
"nvfp4_gemm",
|
| 40 |
]
|
build/torch211-cxx11-cu128-x86_64-linux/{_fp8linear_cuda_91cad61.abi3.so → _fp8linear_cuda_999b53f.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:60f6f8c7db62207a53928f0cdd0dee6053a5df728d1796e960def6731ff46bba
|
| 3 |
+
size 508760
|
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 _fp8linear_cuda_999b53f
|
| 3 |
+
ops = torch.ops._fp8linear_cuda_999b53f
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
+
return f"_fp8linear_cuda_999b53f::{op_name}"
|
build/torch211-cxx11-cu128-x86_64-linux/layers.py
CHANGED
|
@@ -47,6 +47,25 @@ def _mxfp8_linear_fake(x, wq, w_scales, bias=None):
|
|
| 47 |
return x.new_empty((*x.shape[:-1], wq.shape[0]), dtype=torch.float16)
|
| 48 |
|
| 49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
MX_BLOCK = 32
|
| 51 |
|
| 52 |
|
|
@@ -67,6 +86,23 @@ def mxfp8_linear(x, wq, w_scales, bias=None):
|
|
| 67 |
return ops.mxfp8_linear(x, wq, w_scales, bias)
|
| 68 |
|
| 69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
def quantize_weight(weight: torch.Tensor):
|
| 71 |
"""Arch-aware weight quantization (the choice lives in C++ `ops.quantize_weight`).
|
| 72 |
|
|
|
|
| 47 |
return x.new_empty((*x.shape[:-1], wq.shape[0]), dtype=torch.float16)
|
| 48 |
|
| 49 |
|
| 50 |
+
@torch.library.register_fake(add_op_namespace_prefix("quantize_nvfp4"))
|
| 51 |
+
def _quantize_nvfp4_fake(x):
|
| 52 |
+
xq = x.new_empty((x.shape[0], x.shape[1] // 2), dtype=torch.uint8)
|
| 53 |
+
nrb = (x.shape[0] + 127) // 128
|
| 54 |
+
ncb = (x.shape[1] // 16 + 3) // 4
|
| 55 |
+
scales = x.new_empty((nrb * ncb * 512,), dtype=torch.uint8)
|
| 56 |
+
return xq, scales
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
@torch.library.register_fake(add_op_namespace_prefix("nvfp4_gemm"))
|
| 60 |
+
def _nvfp4_gemm_fake(xq, x_scales, wq, w_scales, bias=None):
|
| 61 |
+
return xq.new_empty((xq.shape[0], wq.shape[0]), dtype=torch.float16)
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
@torch.library.register_fake(add_op_namespace_prefix("nvfp4_linear"))
|
| 65 |
+
def _nvfp4_linear_fake(x, wq, w_scales, bias=None):
|
| 66 |
+
return x.new_empty((*x.shape[:-1], wq.shape[0]), dtype=torch.float16)
|
| 67 |
+
|
| 68 |
+
|
| 69 |
MX_BLOCK = 32
|
| 70 |
|
| 71 |
|
|
|
|
| 86 |
return ops.mxfp8_linear(x, wq, w_scales, bias)
|
| 87 |
|
| 88 |
|
| 89 |
+
def quantize_weight_nvfp4(weight: torch.Tensor):
|
| 90 |
+
"""NVFP4 block-quantize a [N, K] weight (offline) via the CUDA kernel.
|
| 91 |
+
|
| 92 |
+
Returns (wq[N, K/2] packed e2m1 uint8, scales uint8/e4m3 in the tiled cuBLASLt
|
| 93 |
+
layout) for `nvfp4_gemm`/`nvfp4_linear`.
|
| 94 |
+
"""
|
| 95 |
+
w = weight.detach()
|
| 96 |
+
if w.dtype not in (torch.float16, torch.bfloat16):
|
| 97 |
+
w = w.to(torch.bfloat16)
|
| 98 |
+
return ops.quantize_nvfp4(w.contiguous())
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
def nvfp4_linear(x, wq, w_scales, bias=None):
|
| 102 |
+
"""NVFP4 linear (Blackwell sm_100+). `wq`/`w_scales` from quantize_weight_nvfp4."""
|
| 103 |
+
return ops.nvfp4_linear(x, wq, w_scales, bias)
|
| 104 |
+
|
| 105 |
+
|
| 106 |
def quantize_weight(weight: torch.Tensor):
|
| 107 |
"""Arch-aware weight quantization (the choice lives in C++ `ops.quantize_weight`).
|
| 108 |
|
build/torch211-cxx11-cu128-x86_64-linux/metadata.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "fp8linear",
|
| 3 |
-
"id": "
|
| 4 |
"version": 1,
|
| 5 |
"license": "MIT",
|
| 6 |
"python-depends": [],
|
|
@@ -16,11 +16,11 @@
|
|
| 16 |
"digest": {
|
| 17 |
"algorithm": "sha256",
|
| 18 |
"files": {
|
| 19 |
-
"__init__.py": "
|
| 20 |
-
"
|
| 21 |
-
"_ops.py": "
|
| 22 |
"fp8linear/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY=",
|
| 23 |
-
"layers.py": "
|
| 24 |
}
|
| 25 |
}
|
| 26 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"name": "fp8linear",
|
| 3 |
+
"id": "_fp8linear_cuda_999b53f",
|
| 4 |
"version": 1,
|
| 5 |
"license": "MIT",
|
| 6 |
"python-depends": [],
|
|
|
|
| 16 |
"digest": {
|
| 17 |
"algorithm": "sha256",
|
| 18 |
"files": {
|
| 19 |
+
"__init__.py": "kuYXA/yMzeG8mUeRuFseTWi5nnWR13ZFrBVvAZqJPeY=",
|
| 20 |
+
"_fp8linear_cuda_999b53f.abi3.so": "YPb4x9tiIHpTko8M3Q3uYFOl33KNF5bpYN72cx/0a7o=",
|
| 21 |
+
"_ops.py": "DKOF2voEdv6S/MArdkqK14wb9yDH06Fmy9QNdlQ4Kgo=",
|
| 22 |
"fp8linear/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY=",
|
| 23 |
+
"layers.py": "6JzuLWloloQ29zkTO9Dv9jJX4aV/yrFU5MbkJqiNr5w="
|
| 24 |
}
|
| 25 |
}
|
| 26 |
}
|
build/torch211-cxx11-cu130-x86_64-linux/__init__.py
CHANGED
|
@@ -4,15 +4,19 @@ from .layers import (
|
|
| 4 |
Fp8Linear,
|
| 5 |
fp8_linear,
|
| 6 |
mxfp8_linear,
|
|
|
|
| 7 |
quantize_,
|
| 8 |
quantize_weight,
|
| 9 |
quantize_weight_mxfp8,
|
|
|
|
| 10 |
)
|
| 11 |
|
| 12 |
quantize_fp8 = ops.quantize_fp8
|
| 13 |
fp8_gemm = ops.fp8_gemm
|
| 14 |
quantize_mxfp8 = ops.quantize_mxfp8
|
| 15 |
mxfp8_gemm = ops.mxfp8_gemm
|
|
|
|
|
|
|
| 16 |
|
| 17 |
__all__ = [
|
| 18 |
"ops",
|
|
@@ -28,4 +32,9 @@ __all__ = [
|
|
| 28 |
"quantize_weight_mxfp8",
|
| 29 |
"quantize_mxfp8",
|
| 30 |
"mxfp8_gemm",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
]
|
|
|
|
| 4 |
Fp8Linear,
|
| 5 |
fp8_linear,
|
| 6 |
mxfp8_linear,
|
| 7 |
+
nvfp4_linear,
|
| 8 |
quantize_,
|
| 9 |
quantize_weight,
|
| 10 |
quantize_weight_mxfp8,
|
| 11 |
+
quantize_weight_nvfp4,
|
| 12 |
)
|
| 13 |
|
| 14 |
quantize_fp8 = ops.quantize_fp8
|
| 15 |
fp8_gemm = ops.fp8_gemm
|
| 16 |
quantize_mxfp8 = ops.quantize_mxfp8
|
| 17 |
mxfp8_gemm = ops.mxfp8_gemm
|
| 18 |
+
quantize_nvfp4 = ops.quantize_nvfp4
|
| 19 |
+
nvfp4_gemm = ops.nvfp4_gemm
|
| 20 |
|
| 21 |
__all__ = [
|
| 22 |
"ops",
|
|
|
|
| 32 |
"quantize_weight_mxfp8",
|
| 33 |
"quantize_mxfp8",
|
| 34 |
"mxfp8_gemm",
|
| 35 |
+
# Blackwell NVFP4 path
|
| 36 |
+
"nvfp4_linear",
|
| 37 |
+
"quantize_weight_nvfp4",
|
| 38 |
+
"quantize_nvfp4",
|
| 39 |
+
"nvfp4_gemm",
|
| 40 |
]
|
build/torch211-cxx11-cu130-x86_64-linux/{_fp8linear_cuda_91cad61.abi3.so → _fp8linear_cuda_999b53f.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:53262026dcbfbc64f053acfe84f5d778b2627c8f7168ca1049854ac043b36881
|
| 3 |
+
size 653816
|
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 _fp8linear_cuda_999b53f
|
| 3 |
+
ops = torch.ops._fp8linear_cuda_999b53f
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
+
return f"_fp8linear_cuda_999b53f::{op_name}"
|
build/torch211-cxx11-cu130-x86_64-linux/layers.py
CHANGED
|
@@ -47,6 +47,25 @@ def _mxfp8_linear_fake(x, wq, w_scales, bias=None):
|
|
| 47 |
return x.new_empty((*x.shape[:-1], wq.shape[0]), dtype=torch.float16)
|
| 48 |
|
| 49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
MX_BLOCK = 32
|
| 51 |
|
| 52 |
|
|
@@ -67,6 +86,23 @@ def mxfp8_linear(x, wq, w_scales, bias=None):
|
|
| 67 |
return ops.mxfp8_linear(x, wq, w_scales, bias)
|
| 68 |
|
| 69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
def quantize_weight(weight: torch.Tensor):
|
| 71 |
"""Arch-aware weight quantization (the choice lives in C++ `ops.quantize_weight`).
|
| 72 |
|
|
|
|
| 47 |
return x.new_empty((*x.shape[:-1], wq.shape[0]), dtype=torch.float16)
|
| 48 |
|
| 49 |
|
| 50 |
+
@torch.library.register_fake(add_op_namespace_prefix("quantize_nvfp4"))
|
| 51 |
+
def _quantize_nvfp4_fake(x):
|
| 52 |
+
xq = x.new_empty((x.shape[0], x.shape[1] // 2), dtype=torch.uint8)
|
| 53 |
+
nrb = (x.shape[0] + 127) // 128
|
| 54 |
+
ncb = (x.shape[1] // 16 + 3) // 4
|
| 55 |
+
scales = x.new_empty((nrb * ncb * 512,), dtype=torch.uint8)
|
| 56 |
+
return xq, scales
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
@torch.library.register_fake(add_op_namespace_prefix("nvfp4_gemm"))
|
| 60 |
+
def _nvfp4_gemm_fake(xq, x_scales, wq, w_scales, bias=None):
|
| 61 |
+
return xq.new_empty((xq.shape[0], wq.shape[0]), dtype=torch.float16)
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
@torch.library.register_fake(add_op_namespace_prefix("nvfp4_linear"))
|
| 65 |
+
def _nvfp4_linear_fake(x, wq, w_scales, bias=None):
|
| 66 |
+
return x.new_empty((*x.shape[:-1], wq.shape[0]), dtype=torch.float16)
|
| 67 |
+
|
| 68 |
+
|
| 69 |
MX_BLOCK = 32
|
| 70 |
|
| 71 |
|
|
|
|
| 86 |
return ops.mxfp8_linear(x, wq, w_scales, bias)
|
| 87 |
|
| 88 |
|
| 89 |
+
def quantize_weight_nvfp4(weight: torch.Tensor):
|
| 90 |
+
"""NVFP4 block-quantize a [N, K] weight (offline) via the CUDA kernel.
|
| 91 |
+
|
| 92 |
+
Returns (wq[N, K/2] packed e2m1 uint8, scales uint8/e4m3 in the tiled cuBLASLt
|
| 93 |
+
layout) for `nvfp4_gemm`/`nvfp4_linear`.
|
| 94 |
+
"""
|
| 95 |
+
w = weight.detach()
|
| 96 |
+
if w.dtype not in (torch.float16, torch.bfloat16):
|
| 97 |
+
w = w.to(torch.bfloat16)
|
| 98 |
+
return ops.quantize_nvfp4(w.contiguous())
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
def nvfp4_linear(x, wq, w_scales, bias=None):
|
| 102 |
+
"""NVFP4 linear (Blackwell sm_100+). `wq`/`w_scales` from quantize_weight_nvfp4."""
|
| 103 |
+
return ops.nvfp4_linear(x, wq, w_scales, bias)
|
| 104 |
+
|
| 105 |
+
|
| 106 |
def quantize_weight(weight: torch.Tensor):
|
| 107 |
"""Arch-aware weight quantization (the choice lives in C++ `ops.quantize_weight`).
|
| 108 |
|
build/torch211-cxx11-cu130-x86_64-linux/metadata.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "fp8linear",
|
| 3 |
-
"id": "
|
| 4 |
"version": 1,
|
| 5 |
"license": "MIT",
|
| 6 |
"python-depends": [],
|
|
@@ -17,11 +17,11 @@
|
|
| 17 |
"digest": {
|
| 18 |
"algorithm": "sha256",
|
| 19 |
"files": {
|
| 20 |
-
"__init__.py": "
|
| 21 |
-
"
|
| 22 |
-
"_ops.py": "
|
| 23 |
"fp8linear/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY=",
|
| 24 |
-
"layers.py": "
|
| 25 |
}
|
| 26 |
}
|
| 27 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"name": "fp8linear",
|
| 3 |
+
"id": "_fp8linear_cuda_999b53f",
|
| 4 |
"version": 1,
|
| 5 |
"license": "MIT",
|
| 6 |
"python-depends": [],
|
|
|
|
| 17 |
"digest": {
|
| 18 |
"algorithm": "sha256",
|
| 19 |
"files": {
|
| 20 |
+
"__init__.py": "kuYXA/yMzeG8mUeRuFseTWi5nnWR13ZFrBVvAZqJPeY=",
|
| 21 |
+
"_fp8linear_cuda_999b53f.abi3.so": "UyYgJty/vGTwU6z+hPXXeLJifI9xaMoQSYVKwEOzaIE=",
|
| 22 |
+
"_ops.py": "DKOF2voEdv6S/MArdkqK14wb9yDH06Fmy9QNdlQ4Kgo=",
|
| 23 |
"fp8linear/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY=",
|
| 24 |
+
"layers.py": "6JzuLWloloQ29zkTO9Dv9jJX4aV/yrFU5MbkJqiNr5w="
|
| 25 |
}
|
| 26 |
}
|
| 27 |
}
|
build/torch212-cxx11-cu126-x86_64-linux/__init__.py
CHANGED
|
@@ -4,15 +4,19 @@ from .layers import (
|
|
| 4 |
Fp8Linear,
|
| 5 |
fp8_linear,
|
| 6 |
mxfp8_linear,
|
|
|
|
| 7 |
quantize_,
|
| 8 |
quantize_weight,
|
| 9 |
quantize_weight_mxfp8,
|
|
|
|
| 10 |
)
|
| 11 |
|
| 12 |
quantize_fp8 = ops.quantize_fp8
|
| 13 |
fp8_gemm = ops.fp8_gemm
|
| 14 |
quantize_mxfp8 = ops.quantize_mxfp8
|
| 15 |
mxfp8_gemm = ops.mxfp8_gemm
|
|
|
|
|
|
|
| 16 |
|
| 17 |
__all__ = [
|
| 18 |
"ops",
|
|
@@ -28,4 +32,9 @@ __all__ = [
|
|
| 28 |
"quantize_weight_mxfp8",
|
| 29 |
"quantize_mxfp8",
|
| 30 |
"mxfp8_gemm",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
]
|
|
|
|
| 4 |
Fp8Linear,
|
| 5 |
fp8_linear,
|
| 6 |
mxfp8_linear,
|
| 7 |
+
nvfp4_linear,
|
| 8 |
quantize_,
|
| 9 |
quantize_weight,
|
| 10 |
quantize_weight_mxfp8,
|
| 11 |
+
quantize_weight_nvfp4,
|
| 12 |
)
|
| 13 |
|
| 14 |
quantize_fp8 = ops.quantize_fp8
|
| 15 |
fp8_gemm = ops.fp8_gemm
|
| 16 |
quantize_mxfp8 = ops.quantize_mxfp8
|
| 17 |
mxfp8_gemm = ops.mxfp8_gemm
|
| 18 |
+
quantize_nvfp4 = ops.quantize_nvfp4
|
| 19 |
+
nvfp4_gemm = ops.nvfp4_gemm
|
| 20 |
|
| 21 |
__all__ = [
|
| 22 |
"ops",
|
|
|
|
| 32 |
"quantize_weight_mxfp8",
|
| 33 |
"quantize_mxfp8",
|
| 34 |
"mxfp8_gemm",
|
| 35 |
+
# Blackwell NVFP4 path
|
| 36 |
+
"nvfp4_linear",
|
| 37 |
+
"quantize_weight_nvfp4",
|
| 38 |
+
"quantize_nvfp4",
|
| 39 |
+
"nvfp4_gemm",
|
| 40 |
]
|
build/torch212-cxx11-cu126-x86_64-linux/{_fp8linear_cuda_91cad61.abi3.so → _fp8linear_cuda_999b53f.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:6fe5c7462cddd5f946175249b544fa71192e1001d34f28b465de3ba032a6432e
|
| 3 |
+
size 291240
|
build/torch212-cxx11-cu126-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 _fp8linear_cuda_999b53f
|
| 3 |
+
ops = torch.ops._fp8linear_cuda_999b53f
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
+
return f"_fp8linear_cuda_999b53f::{op_name}"
|
build/torch212-cxx11-cu126-x86_64-linux/layers.py
CHANGED
|
@@ -47,6 +47,25 @@ def _mxfp8_linear_fake(x, wq, w_scales, bias=None):
|
|
| 47 |
return x.new_empty((*x.shape[:-1], wq.shape[0]), dtype=torch.float16)
|
| 48 |
|
| 49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
MX_BLOCK = 32
|
| 51 |
|
| 52 |
|
|
@@ -67,6 +86,23 @@ def mxfp8_linear(x, wq, w_scales, bias=None):
|
|
| 67 |
return ops.mxfp8_linear(x, wq, w_scales, bias)
|
| 68 |
|
| 69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
def quantize_weight(weight: torch.Tensor):
|
| 71 |
"""Arch-aware weight quantization (the choice lives in C++ `ops.quantize_weight`).
|
| 72 |
|
|
|
|
| 47 |
return x.new_empty((*x.shape[:-1], wq.shape[0]), dtype=torch.float16)
|
| 48 |
|
| 49 |
|
| 50 |
+
@torch.library.register_fake(add_op_namespace_prefix("quantize_nvfp4"))
|
| 51 |
+
def _quantize_nvfp4_fake(x):
|
| 52 |
+
xq = x.new_empty((x.shape[0], x.shape[1] // 2), dtype=torch.uint8)
|
| 53 |
+
nrb = (x.shape[0] + 127) // 128
|
| 54 |
+
ncb = (x.shape[1] // 16 + 3) // 4
|
| 55 |
+
scales = x.new_empty((nrb * ncb * 512,), dtype=torch.uint8)
|
| 56 |
+
return xq, scales
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
@torch.library.register_fake(add_op_namespace_prefix("nvfp4_gemm"))
|
| 60 |
+
def _nvfp4_gemm_fake(xq, x_scales, wq, w_scales, bias=None):
|
| 61 |
+
return xq.new_empty((xq.shape[0], wq.shape[0]), dtype=torch.float16)
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
@torch.library.register_fake(add_op_namespace_prefix("nvfp4_linear"))
|
| 65 |
+
def _nvfp4_linear_fake(x, wq, w_scales, bias=None):
|
| 66 |
+
return x.new_empty((*x.shape[:-1], wq.shape[0]), dtype=torch.float16)
|
| 67 |
+
|
| 68 |
+
|
| 69 |
MX_BLOCK = 32
|
| 70 |
|
| 71 |
|
|
|
|
| 86 |
return ops.mxfp8_linear(x, wq, w_scales, bias)
|
| 87 |
|
| 88 |
|
| 89 |
+
def quantize_weight_nvfp4(weight: torch.Tensor):
|
| 90 |
+
"""NVFP4 block-quantize a [N, K] weight (offline) via the CUDA kernel.
|
| 91 |
+
|
| 92 |
+
Returns (wq[N, K/2] packed e2m1 uint8, scales uint8/e4m3 in the tiled cuBLASLt
|
| 93 |
+
layout) for `nvfp4_gemm`/`nvfp4_linear`.
|
| 94 |
+
"""
|
| 95 |
+
w = weight.detach()
|
| 96 |
+
if w.dtype not in (torch.float16, torch.bfloat16):
|
| 97 |
+
w = w.to(torch.bfloat16)
|
| 98 |
+
return ops.quantize_nvfp4(w.contiguous())
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
def nvfp4_linear(x, wq, w_scales, bias=None):
|
| 102 |
+
"""NVFP4 linear (Blackwell sm_100+). `wq`/`w_scales` from quantize_weight_nvfp4."""
|
| 103 |
+
return ops.nvfp4_linear(x, wq, w_scales, bias)
|
| 104 |
+
|
| 105 |
+
|
| 106 |
def quantize_weight(weight: torch.Tensor):
|
| 107 |
"""Arch-aware weight quantization (the choice lives in C++ `ops.quantize_weight`).
|
| 108 |
|
build/torch212-cxx11-cu126-x86_64-linux/metadata.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "fp8linear",
|
| 3 |
-
"id": "
|
| 4 |
"version": 1,
|
| 5 |
"license": "MIT",
|
| 6 |
"python-depends": [],
|
|
@@ -14,11 +14,11 @@
|
|
| 14 |
"digest": {
|
| 15 |
"algorithm": "sha256",
|
| 16 |
"files": {
|
| 17 |
-
"__init__.py": "
|
| 18 |
-
"
|
| 19 |
-
"_ops.py": "
|
| 20 |
"fp8linear/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY=",
|
| 21 |
-
"layers.py": "
|
| 22 |
}
|
| 23 |
}
|
| 24 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"name": "fp8linear",
|
| 3 |
+
"id": "_fp8linear_cuda_999b53f",
|
| 4 |
"version": 1,
|
| 5 |
"license": "MIT",
|
| 6 |
"python-depends": [],
|
|
|
|
| 14 |
"digest": {
|
| 15 |
"algorithm": "sha256",
|
| 16 |
"files": {
|
| 17 |
+
"__init__.py": "kuYXA/yMzeG8mUeRuFseTWi5nnWR13ZFrBVvAZqJPeY=",
|
| 18 |
+
"_fp8linear_cuda_999b53f.abi3.so": "b+XHRizd1flGF1JJtUT6cRkuEAHTTyi0Zd47oDKmQy4=",
|
| 19 |
+
"_ops.py": "DKOF2voEdv6S/MArdkqK14wb9yDH06Fmy9QNdlQ4Kgo=",
|
| 20 |
"fp8linear/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY=",
|
| 21 |
+
"layers.py": "6JzuLWloloQ29zkTO9Dv9jJX4aV/yrFU5MbkJqiNr5w="
|
| 22 |
}
|
| 23 |
}
|
| 24 |
}
|
build/torch212-cxx11-cu130-x86_64-linux/__init__.py
CHANGED
|
@@ -4,15 +4,19 @@ from .layers import (
|
|
| 4 |
Fp8Linear,
|
| 5 |
fp8_linear,
|
| 6 |
mxfp8_linear,
|
|
|
|
| 7 |
quantize_,
|
| 8 |
quantize_weight,
|
| 9 |
quantize_weight_mxfp8,
|
|
|
|
| 10 |
)
|
| 11 |
|
| 12 |
quantize_fp8 = ops.quantize_fp8
|
| 13 |
fp8_gemm = ops.fp8_gemm
|
| 14 |
quantize_mxfp8 = ops.quantize_mxfp8
|
| 15 |
mxfp8_gemm = ops.mxfp8_gemm
|
|
|
|
|
|
|
| 16 |
|
| 17 |
__all__ = [
|
| 18 |
"ops",
|
|
@@ -28,4 +32,9 @@ __all__ = [
|
|
| 28 |
"quantize_weight_mxfp8",
|
| 29 |
"quantize_mxfp8",
|
| 30 |
"mxfp8_gemm",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
]
|
|
|
|
| 4 |
Fp8Linear,
|
| 5 |
fp8_linear,
|
| 6 |
mxfp8_linear,
|
| 7 |
+
nvfp4_linear,
|
| 8 |
quantize_,
|
| 9 |
quantize_weight,
|
| 10 |
quantize_weight_mxfp8,
|
| 11 |
+
quantize_weight_nvfp4,
|
| 12 |
)
|
| 13 |
|
| 14 |
quantize_fp8 = ops.quantize_fp8
|
| 15 |
fp8_gemm = ops.fp8_gemm
|
| 16 |
quantize_mxfp8 = ops.quantize_mxfp8
|
| 17 |
mxfp8_gemm = ops.mxfp8_gemm
|
| 18 |
+
quantize_nvfp4 = ops.quantize_nvfp4
|
| 19 |
+
nvfp4_gemm = ops.nvfp4_gemm
|
| 20 |
|
| 21 |
__all__ = [
|
| 22 |
"ops",
|
|
|
|
| 32 |
"quantize_weight_mxfp8",
|
| 33 |
"quantize_mxfp8",
|
| 34 |
"mxfp8_gemm",
|
| 35 |
+
# Blackwell NVFP4 path
|
| 36 |
+
"nvfp4_linear",
|
| 37 |
+
"quantize_weight_nvfp4",
|
| 38 |
+
"quantize_nvfp4",
|
| 39 |
+
"nvfp4_gemm",
|
| 40 |
]
|
build/torch212-cxx11-cu130-x86_64-linux/_fp8linear_cuda_91cad61.abi3.so
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:3c3c3adab2d82001ef96d31278c5e5134638894995c25439db9b0f433d79f37a
|
| 3 |
-
size 528400
|
|
|
|
|
|
|
|
|
|
|
|
build/torch212-cxx11-cu130-x86_64-linux/_fp8linear_cuda_999b53f.abi3.so
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5714d408fc21891bf66b73ae3302cf026a62cef9ab6cfcf2c71cd703ef40db9a
|
| 3 |
+
size 653472
|
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 _fp8linear_cuda_999b53f
|
| 3 |
+
ops = torch.ops._fp8linear_cuda_999b53f
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
+
return f"_fp8linear_cuda_999b53f::{op_name}"
|
build/torch212-cxx11-cu130-x86_64-linux/layers.py
CHANGED
|
@@ -47,6 +47,25 @@ def _mxfp8_linear_fake(x, wq, w_scales, bias=None):
|
|
| 47 |
return x.new_empty((*x.shape[:-1], wq.shape[0]), dtype=torch.float16)
|
| 48 |
|
| 49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
MX_BLOCK = 32
|
| 51 |
|
| 52 |
|
|
@@ -67,6 +86,23 @@ def mxfp8_linear(x, wq, w_scales, bias=None):
|
|
| 67 |
return ops.mxfp8_linear(x, wq, w_scales, bias)
|
| 68 |
|
| 69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
def quantize_weight(weight: torch.Tensor):
|
| 71 |
"""Arch-aware weight quantization (the choice lives in C++ `ops.quantize_weight`).
|
| 72 |
|
|
|
|
| 47 |
return x.new_empty((*x.shape[:-1], wq.shape[0]), dtype=torch.float16)
|
| 48 |
|
| 49 |
|
| 50 |
+
@torch.library.register_fake(add_op_namespace_prefix("quantize_nvfp4"))
|
| 51 |
+
def _quantize_nvfp4_fake(x):
|
| 52 |
+
xq = x.new_empty((x.shape[0], x.shape[1] // 2), dtype=torch.uint8)
|
| 53 |
+
nrb = (x.shape[0] + 127) // 128
|
| 54 |
+
ncb = (x.shape[1] // 16 + 3) // 4
|
| 55 |
+
scales = x.new_empty((nrb * ncb * 512,), dtype=torch.uint8)
|
| 56 |
+
return xq, scales
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
@torch.library.register_fake(add_op_namespace_prefix("nvfp4_gemm"))
|
| 60 |
+
def _nvfp4_gemm_fake(xq, x_scales, wq, w_scales, bias=None):
|
| 61 |
+
return xq.new_empty((xq.shape[0], wq.shape[0]), dtype=torch.float16)
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
@torch.library.register_fake(add_op_namespace_prefix("nvfp4_linear"))
|
| 65 |
+
def _nvfp4_linear_fake(x, wq, w_scales, bias=None):
|
| 66 |
+
return x.new_empty((*x.shape[:-1], wq.shape[0]), dtype=torch.float16)
|
| 67 |
+
|
| 68 |
+
|
| 69 |
MX_BLOCK = 32
|
| 70 |
|
| 71 |
|
|
|
|
| 86 |
return ops.mxfp8_linear(x, wq, w_scales, bias)
|
| 87 |
|
| 88 |
|
| 89 |
+
def quantize_weight_nvfp4(weight: torch.Tensor):
|
| 90 |
+
"""NVFP4 block-quantize a [N, K] weight (offline) via the CUDA kernel.
|
| 91 |
+
|
| 92 |
+
Returns (wq[N, K/2] packed e2m1 uint8, scales uint8/e4m3 in the tiled cuBLASLt
|
| 93 |
+
layout) for `nvfp4_gemm`/`nvfp4_linear`.
|
| 94 |
+
"""
|
| 95 |
+
w = weight.detach()
|
| 96 |
+
if w.dtype not in (torch.float16, torch.bfloat16):
|
| 97 |
+
w = w.to(torch.bfloat16)
|
| 98 |
+
return ops.quantize_nvfp4(w.contiguous())
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
def nvfp4_linear(x, wq, w_scales, bias=None):
|
| 102 |
+
"""NVFP4 linear (Blackwell sm_100+). `wq`/`w_scales` from quantize_weight_nvfp4."""
|
| 103 |
+
return ops.nvfp4_linear(x, wq, w_scales, bias)
|
| 104 |
+
|
| 105 |
+
|
| 106 |
def quantize_weight(weight: torch.Tensor):
|
| 107 |
"""Arch-aware weight quantization (the choice lives in C++ `ops.quantize_weight`).
|
| 108 |
|
build/torch212-cxx11-cu130-x86_64-linux/metadata.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "fp8linear",
|
| 3 |
-
"id": "
|
| 4 |
"version": 1,
|
| 5 |
"license": "MIT",
|
| 6 |
"python-depends": [],
|
|
@@ -17,11 +17,11 @@
|
|
| 17 |
"digest": {
|
| 18 |
"algorithm": "sha256",
|
| 19 |
"files": {
|
| 20 |
-
"__init__.py": "
|
| 21 |
-
"
|
| 22 |
-
"_ops.py": "
|
| 23 |
"fp8linear/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY=",
|
| 24 |
-
"layers.py": "
|
| 25 |
}
|
| 26 |
}
|
| 27 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"name": "fp8linear",
|
| 3 |
+
"id": "_fp8linear_cuda_999b53f",
|
| 4 |
"version": 1,
|
| 5 |
"license": "MIT",
|
| 6 |
"python-depends": [],
|
|
|
|
| 17 |
"digest": {
|
| 18 |
"algorithm": "sha256",
|
| 19 |
"files": {
|
| 20 |
+
"__init__.py": "kuYXA/yMzeG8mUeRuFseTWi5nnWR13ZFrBVvAZqJPeY=",
|
| 21 |
+
"_fp8linear_cuda_999b53f.abi3.so": "VxTUCPwhiRv2a3OuMwLPAmpizvmrbPzyxxzXA+9A25o=",
|
| 22 |
+
"_ops.py": "DKOF2voEdv6S/MArdkqK14wb9yDH06Fmy9QNdlQ4Kgo=",
|
| 23 |
"fp8linear/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY=",
|
| 24 |
+
"layers.py": "6JzuLWloloQ29zkTO9Dv9jJX4aV/yrFU5MbkJqiNr5w="
|
| 25 |
}
|
| 26 |
}
|
| 27 |
}
|
build/torch212-cxx11-cu132-x86_64-linux/__init__.py
CHANGED
|
@@ -4,15 +4,19 @@ from .layers import (
|
|
| 4 |
Fp8Linear,
|
| 5 |
fp8_linear,
|
| 6 |
mxfp8_linear,
|
|
|
|
| 7 |
quantize_,
|
| 8 |
quantize_weight,
|
| 9 |
quantize_weight_mxfp8,
|
|
|
|
| 10 |
)
|
| 11 |
|
| 12 |
quantize_fp8 = ops.quantize_fp8
|
| 13 |
fp8_gemm = ops.fp8_gemm
|
| 14 |
quantize_mxfp8 = ops.quantize_mxfp8
|
| 15 |
mxfp8_gemm = ops.mxfp8_gemm
|
|
|
|
|
|
|
| 16 |
|
| 17 |
__all__ = [
|
| 18 |
"ops",
|
|
@@ -28,4 +32,9 @@ __all__ = [
|
|
| 28 |
"quantize_weight_mxfp8",
|
| 29 |
"quantize_mxfp8",
|
| 30 |
"mxfp8_gemm",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
]
|
|
|
|
| 4 |
Fp8Linear,
|
| 5 |
fp8_linear,
|
| 6 |
mxfp8_linear,
|
| 7 |
+
nvfp4_linear,
|
| 8 |
quantize_,
|
| 9 |
quantize_weight,
|
| 10 |
quantize_weight_mxfp8,
|
| 11 |
+
quantize_weight_nvfp4,
|
| 12 |
)
|
| 13 |
|
| 14 |
quantize_fp8 = ops.quantize_fp8
|
| 15 |
fp8_gemm = ops.fp8_gemm
|
| 16 |
quantize_mxfp8 = ops.quantize_mxfp8
|
| 17 |
mxfp8_gemm = ops.mxfp8_gemm
|
| 18 |
+
quantize_nvfp4 = ops.quantize_nvfp4
|
| 19 |
+
nvfp4_gemm = ops.nvfp4_gemm
|
| 20 |
|
| 21 |
__all__ = [
|
| 22 |
"ops",
|
|
|
|
| 32 |
"quantize_weight_mxfp8",
|
| 33 |
"quantize_mxfp8",
|
| 34 |
"mxfp8_gemm",
|
| 35 |
+
# Blackwell NVFP4 path
|
| 36 |
+
"nvfp4_linear",
|
| 37 |
+
"quantize_weight_nvfp4",
|
| 38 |
+
"quantize_nvfp4",
|
| 39 |
+
"nvfp4_gemm",
|
| 40 |
]
|
build/torch212-cxx11-cu132-x86_64-linux/_fp8linear_cuda_91cad61.abi3.so
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:dd694ce980ce13b0e67f67346c56be0f91a0ff134483ff60e36eca751e83f814
|
| 3 |
-
size 600152
|
|
|
|
|
|
|
|
|
|
|
|
build/torch212-cxx11-cu132-x86_64-linux/_fp8linear_cuda_999b53f.abi3.so
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c5212b7322375abb616c64a440e138d35f41a3a6308ef0c4958c94ccd534a1dd
|
| 3 |
+
size 725224
|
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 _fp8linear_cuda_999b53f
|
| 3 |
+
ops = torch.ops._fp8linear_cuda_999b53f
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
+
return f"_fp8linear_cuda_999b53f::{op_name}"
|
build/torch212-cxx11-cu132-x86_64-linux/layers.py
CHANGED
|
@@ -47,6 +47,25 @@ def _mxfp8_linear_fake(x, wq, w_scales, bias=None):
|
|
| 47 |
return x.new_empty((*x.shape[:-1], wq.shape[0]), dtype=torch.float16)
|
| 48 |
|
| 49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
MX_BLOCK = 32
|
| 51 |
|
| 52 |
|
|
@@ -67,6 +86,23 @@ def mxfp8_linear(x, wq, w_scales, bias=None):
|
|
| 67 |
return ops.mxfp8_linear(x, wq, w_scales, bias)
|
| 68 |
|
| 69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
def quantize_weight(weight: torch.Tensor):
|
| 71 |
"""Arch-aware weight quantization (the choice lives in C++ `ops.quantize_weight`).
|
| 72 |
|
|
|
|
| 47 |
return x.new_empty((*x.shape[:-1], wq.shape[0]), dtype=torch.float16)
|
| 48 |
|
| 49 |
|
| 50 |
+
@torch.library.register_fake(add_op_namespace_prefix("quantize_nvfp4"))
|
| 51 |
+
def _quantize_nvfp4_fake(x):
|
| 52 |
+
xq = x.new_empty((x.shape[0], x.shape[1] // 2), dtype=torch.uint8)
|
| 53 |
+
nrb = (x.shape[0] + 127) // 128
|
| 54 |
+
ncb = (x.shape[1] // 16 + 3) // 4
|
| 55 |
+
scales = x.new_empty((nrb * ncb * 512,), dtype=torch.uint8)
|
| 56 |
+
return xq, scales
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
@torch.library.register_fake(add_op_namespace_prefix("nvfp4_gemm"))
|
| 60 |
+
def _nvfp4_gemm_fake(xq, x_scales, wq, w_scales, bias=None):
|
| 61 |
+
return xq.new_empty((xq.shape[0], wq.shape[0]), dtype=torch.float16)
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
@torch.library.register_fake(add_op_namespace_prefix("nvfp4_linear"))
|
| 65 |
+
def _nvfp4_linear_fake(x, wq, w_scales, bias=None):
|
| 66 |
+
return x.new_empty((*x.shape[:-1], wq.shape[0]), dtype=torch.float16)
|
| 67 |
+
|
| 68 |
+
|
| 69 |
MX_BLOCK = 32
|
| 70 |
|
| 71 |
|
|
|
|
| 86 |
return ops.mxfp8_linear(x, wq, w_scales, bias)
|
| 87 |
|
| 88 |
|
| 89 |
+
def quantize_weight_nvfp4(weight: torch.Tensor):
|
| 90 |
+
"""NVFP4 block-quantize a [N, K] weight (offline) via the CUDA kernel.
|
| 91 |
+
|
| 92 |
+
Returns (wq[N, K/2] packed e2m1 uint8, scales uint8/e4m3 in the tiled cuBLASLt
|
| 93 |
+
layout) for `nvfp4_gemm`/`nvfp4_linear`.
|
| 94 |
+
"""
|
| 95 |
+
w = weight.detach()
|
| 96 |
+
if w.dtype not in (torch.float16, torch.bfloat16):
|
| 97 |
+
w = w.to(torch.bfloat16)
|
| 98 |
+
return ops.quantize_nvfp4(w.contiguous())
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
def nvfp4_linear(x, wq, w_scales, bias=None):
|
| 102 |
+
"""NVFP4 linear (Blackwell sm_100+). `wq`/`w_scales` from quantize_weight_nvfp4."""
|
| 103 |
+
return ops.nvfp4_linear(x, wq, w_scales, bias)
|
| 104 |
+
|
| 105 |
+
|
| 106 |
def quantize_weight(weight: torch.Tensor):
|
| 107 |
"""Arch-aware weight quantization (the choice lives in C++ `ops.quantize_weight`).
|
| 108 |
|
build/torch212-cxx11-cu132-x86_64-linux/metadata.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "fp8linear",
|
| 3 |
-
"id": "
|
| 4 |
"version": 1,
|
| 5 |
"license": "MIT",
|
| 6 |
"python-depends": [],
|
|
@@ -17,11 +17,11 @@
|
|
| 17 |
"digest": {
|
| 18 |
"algorithm": "sha256",
|
| 19 |
"files": {
|
| 20 |
-
"__init__.py": "
|
| 21 |
-
"
|
| 22 |
-
"_ops.py": "
|
| 23 |
"fp8linear/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY=",
|
| 24 |
-
"layers.py": "
|
| 25 |
}
|
| 26 |
}
|
| 27 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"name": "fp8linear",
|
| 3 |
+
"id": "_fp8linear_cuda_999b53f",
|
| 4 |
"version": 1,
|
| 5 |
"license": "MIT",
|
| 6 |
"python-depends": [],
|
|
|
|
| 17 |
"digest": {
|
| 18 |
"algorithm": "sha256",
|
| 19 |
"files": {
|
| 20 |
+
"__init__.py": "kuYXA/yMzeG8mUeRuFseTWi5nnWR13ZFrBVvAZqJPeY=",
|
| 21 |
+
"_fp8linear_cuda_999b53f.abi3.so": "xSErcyI3WrthbGSkQOE4019Bo6YwjvDElYyUzNU0od0=",
|
| 22 |
+
"_ops.py": "DKOF2voEdv6S/MArdkqK14wb9yDH06Fmy9QNdlQ4Kgo=",
|
| 23 |
"fp8linear/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY=",
|
| 24 |
+
"layers.py": "6JzuLWloloQ29zkTO9Dv9jJX4aV/yrFU5MbkJqiNr5w="
|
| 25 |
}
|
| 26 |
}
|
| 27 |
}
|