Promote latest kernel artifacts to main
Browse files- README.md +113 -6
- build/torch211-cxx11-cu128-x86_64-linux/__init__.py +22 -1
- build/torch211-cxx11-cu128-x86_64-linux/{_fp4_gemm_cuda_e1f10b6.abi3.so → _fp4_gemm_cuda_dc57d15.abi3.so} +1 -1
- build/torch211-cxx11-cu128-x86_64-linux/_ops.py +3 -3
- build/torch211-cxx11-cu128-x86_64-linux/metadata.json +5 -5
- build/torch211-cxx11-cu130-x86_64-linux/__init__.py +22 -1
- build/torch211-cxx11-cu130-x86_64-linux/{_fp4_gemm_cuda_e1f10b6.abi3.so → _fp4_gemm_cuda_dc57d15.abi3.so} +1 -1
- build/torch211-cxx11-cu130-x86_64-linux/_ops.py +3 -3
- build/torch211-cxx11-cu130-x86_64-linux/metadata.json +5 -5
- build/torch212-cxx11-cu130-x86_64-linux/__init__.py +22 -1
- build/torch212-cxx11-cu130-x86_64-linux/{_fp4_gemm_cuda_e1f10b6.abi3.so → _fp4_gemm_cuda_dc57d15.abi3.so} +1 -1
- build/torch212-cxx11-cu130-x86_64-linux/_ops.py +3 -3
- build/torch212-cxx11-cu130-x86_64-linux/metadata.json +5 -5
- build/torch212-cxx11-cu132-x86_64-linux/__init__.py +22 -1
- build/torch212-cxx11-cu132-x86_64-linux/{_fp4_gemm_cuda_e1f10b6.abi3.so → _fp4_gemm_cuda_dc57d15.abi3.so} +1 -1
- build/torch212-cxx11-cu132-x86_64-linux/_ops.py +3 -3
- build/torch212-cxx11-cu132-x86_64-linux/metadata.json +5 -5
- build/torch213-cxx11-cu130-x86_64-linux/__init__.py +22 -1
- build/torch213-cxx11-cu130-x86_64-linux/{_fp4_gemm_cuda_e1f10b6.abi3.so → _fp4_gemm_cuda_dc57d15.abi3.so} +1 -1
- build/torch213-cxx11-cu130-x86_64-linux/_ops.py +3 -3
- build/torch213-cxx11-cu130-x86_64-linux/metadata.json +5 -5
- build/torch213-cxx11-cu132-x86_64-linux/__init__.py +22 -1
- build/torch213-cxx11-cu132-x86_64-linux/{_fp4_gemm_cuda_e1f10b6.abi3.so → _fp4_gemm_cuda_dc57d15.abi3.so} +1 -1
- build/torch213-cxx11-cu132-x86_64-linux/_ops.py +3 -3
- build/torch213-cxx11-cu132-x86_64-linux/metadata.json +5 -5
README.md
CHANGED
|
@@ -1,9 +1,116 @@
|
|
| 1 |
-
#
|
| 2 |
|
| 3 |
-
|
| 4 |
-
that resolve repositories through the default Hugging Face model repo API.
|
| 5 |
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# fp4-gemm
|
| 2 |
|
| 3 |
+
FlashRT native Blackwell NVFP4 A4W4 GEMM kernels.
|
|
|
|
| 4 |
|
| 5 |
+
This package consumes packed FP4 E2M1 tensors plus CUTLASS Sm1xx SFA/SFB scale
|
| 6 |
+
buffers and produces BF16 output. It is designed to pair with
|
| 7 |
+
`flashrt/fp4-fused-ops` and other static low-bit transformer/diffuser runtime
|
| 8 |
+
paths.
|
| 9 |
|
| 10 |
+
## Available Functions
|
| 11 |
+
|
| 12 |
+
- `sfa_size_bytes(rows, dim)`
|
| 13 |
+
- `quantize_fp4_sfa_fp16(x, packed=None, sfa=None, is_sfb=False)`
|
| 14 |
+
- `quantize_fp4_sfa_bf16(x, packed=None, sfa=None, is_sfb=False)`
|
| 15 |
+
- `dequantize_fp4_sfa_fp16(packed, sfa, out=None, is_sfb=False)`
|
| 16 |
+
- `nvfp4_gemm_bf16(a_packed, b_packed, sfa, sfb, alpha=1.0, out=None, variant=-1)`
|
| 17 |
+
- `nvfp4_gemm_bias_bf16(a_packed, b_packed, sfa, sfb, bias, out=None)`
|
| 18 |
+
- `nvfp4_gemm_bias_residual_bf16(a_packed, b_packed, sfa, sfb, bias, residual, out=None)`
|
| 19 |
+
- `nvfp4_gemm_residual_bf16(a_packed, b_packed, sfa, sfb, residual, alpha=1.0, out=None)`
|
| 20 |
+
- `nvfp4_gemm_bias_gelu_bf16(a_packed, b_packed, sfa, sfb, bias, alpha=1.0, out=None)`
|
| 21 |
+
- `nvfp4_gemm_bias_gelu_nvfp4(a_packed, b_packed, sfa, sfb, bias, alpha=1.0, out_packed=None, out_sfa=None)`
|
| 22 |
+
- `nvfp4_gemm_streamk_bf16(a_packed, b_packed, sfa, sfb, alpha=1.0, out=None)`
|
| 23 |
+
- `nvfp4_gemm_streamk_bias_bf16(a_packed, b_packed, sfa, sfb, bias, alpha=1.0, out=None)`
|
| 24 |
+
- `fp4_w4a16_linear_bf16(...)` is retained as a compatibility alias
|
| 25 |
+
|
| 26 |
+
## Tensor Contract
|
| 27 |
+
|
| 28 |
+
- `a_packed`: `torch.uint8`, shape `(M, K / 2)`.
|
| 29 |
+
- `b_packed`: `torch.uint8`, shape `(N, K / 2)`.
|
| 30 |
+
- `sfa`: `torch.uint8`, CUTLASS SFA layout for `(M, K)`.
|
| 31 |
+
- `sfb`: `torch.uint8`, CUTLASS SFB layout for `(N, K)`.
|
| 32 |
+
- output: `torch.bfloat16`, shape `(M, N)`.
|
| 33 |
+
- `K` must be divisible by 16.
|
| 34 |
+
- Targets: Blackwell `sm_110a` (Jetson AGX Thor, CUDA 13+) and `sm_120a`
|
| 35 |
+
(RTX Blackwell, CUDA 12.8+).
|
| 36 |
+
|
| 37 |
+
`variant` selects the CUTLASS schedule:
|
| 38 |
+
|
| 39 |
+
- `-1`: architecture-aware auto-dispatch (public default).
|
| 40 |
+
- `0`: default `<128,128,256>` cooperative schedule.
|
| 41 |
+
- `1`: widen `<128,256,128>` schedule, intended for very large `N`.
|
| 42 |
+
- `2`: pingpong schedule for A/B testing shape-specific wins.
|
| 43 |
+
|
| 44 |
+
The canonical linear API and FP4/SFA quantize/dequantize helpers are available
|
| 45 |
+
on both SM110 and SM120. SM110 additionally provides the GROOT N1.7 production
|
| 46 |
+
epilogues `nvfp4_gemm_bias_bf16`, `nvfp4_gemm_bias_residual_bf16`, and
|
| 47 |
+
`nvfp4_gemm_bias_gelu_nvfp4`. The latter emits packed FP4 plus CUTLASS SFA so
|
| 48 |
+
the following projection can consume it without a BF16 materialization and a
|
| 49 |
+
standalone quantization launch. Stream-K and the older BF16 GELU epilogue keep
|
| 50 |
+
their existing SM120 dispatch and reject unsupported architectures explicitly.
|
| 51 |
+
|
| 52 |
+
The SM110 release gate includes the production `(M,N,K)` shapes
|
| 53 |
+
`(41,4608,1536)`, `(41,6144,1536)`, and `(41,1536,6144)`, plus the legacy
|
| 54 |
+
`M=51` compatibility row. The kernels are the native sources used by FlashRT's
|
| 55 |
+
GROOT N1.7 Thor NVFP4 pipeline.
|
| 56 |
+
|
| 57 |
+
## Minimal Usage
|
| 58 |
+
|
| 59 |
+
```python
|
| 60 |
+
from kernels import get_kernel
|
| 61 |
+
import torch
|
| 62 |
+
|
| 63 |
+
ops = get_kernel("flashrt/fp4-gemm", version=1, trust_remote_code=True)
|
| 64 |
+
|
| 65 |
+
x = torch.randn((32, 256), device="cuda", dtype=torch.float16)
|
| 66 |
+
w = torch.randn((512, 256), device="cuda", dtype=torch.float16)
|
| 67 |
+
|
| 68 |
+
a_packed, sfa = ops.quantize_fp4_sfa_fp16(x, is_sfb=False)
|
| 69 |
+
b_packed, sfb = ops.quantize_fp4_sfa_fp16(w, is_sfb=True)
|
| 70 |
+
|
| 71 |
+
y = ops.nvfp4_gemm_bf16(a_packed, b_packed, sfa, sfb, alpha=1.0)
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
For BF16 model activations, use the direct producer so the hot path does not
|
| 75 |
+
materialize an intermediate FP16 tensor:
|
| 76 |
+
|
| 77 |
+
```python
|
| 78 |
+
x_bf16 = torch.randn((1, 5120), device="cuda", dtype=torch.bfloat16)
|
| 79 |
+
a_packed, sfa = ops.quantize_fp4_sfa_bf16(x_bf16)
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
The BF16 entry writes the same E2M1 bytes and CUTLASS SFA/SFB layout as
|
| 83 |
+
`quantize_fp4_sfa_fp16(x_bf16.to(torch.float16))` for finite FP16-range
|
| 84 |
+
inputs. It is an additive API; the existing FP16 producer remains unchanged.
|
| 85 |
+
|
| 86 |
+
The quantize/dequantize helpers are included for examples and validation. A
|
| 87 |
+
production runtime should keep weights prepacked and should avoid quantizing in
|
| 88 |
+
the hot path unless that producer kernel is part of the intended low-bit block.
|
| 89 |
+
|
| 90 |
+
Use the bias/GELU and residual variants to avoid returning to BF16
|
| 91 |
+
elementwise code between low-bit GEMMs. Stream-K variants are selected only
|
| 92 |
+
for the validated large down-projection shapes; unsupported shapes reject
|
| 93 |
+
rather than silently selecting a losing schedule.
|
| 94 |
+
|
| 95 |
+
## Validation
|
| 96 |
+
|
| 97 |
+
```bash
|
| 98 |
+
python fp4-gemm/tests/test_fp4_gemm.py --backend source --mode full
|
| 99 |
+
python fp4-gemm/tests/test_fp4_gemm.py --backend installed --mode full \
|
| 100 |
+
--artifact fp4-gemm/build/torch211-cxx11-cu128-x86_64-linux
|
| 101 |
+
python fp4-gemm/benchmarks/benchmark.py --backend installed --mode headline \
|
| 102 |
+
--artifact fp4-gemm/build/torch211-cxx11-cu128-x86_64-linux
|
| 103 |
+
|
| 104 |
+
# Thor model-shape gate
|
| 105 |
+
python fp4-gemm/tests/test_fp4_gemm.py --backend installed \
|
| 106 |
+
--mode thor-models \
|
| 107 |
+
--artifact fp4-gemm/build/torch211-cxx11-cu130-aarch64-linux
|
| 108 |
+
```
|
| 109 |
+
|
| 110 |
+
The correctness reference dequantizes the same FP4/SFA and FP4/SFB inputs used
|
| 111 |
+
by the kernel, then computes the PyTorch GEMM reference from those dequantized
|
| 112 |
+
low-bit values.
|
| 113 |
+
|
| 114 |
+
The producer gate also checks the BF16 direct entry byte-for-byte against the
|
| 115 |
+
established FP16 compatibility chain at decode widths 5120, 6144 and 17408,
|
| 116 |
+
plus multi-row activation and SFB layouts.
|
build/torch211-cxx11-cu128-x86_64-linux/__init__.py
CHANGED
|
@@ -150,6 +150,19 @@ def _gemv_warpsplit_interleaved_fake(
|
|
| 150 |
return None
|
| 151 |
|
| 152 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
@torch.library.register_fake(add_op_namespace_prefix("nvfp4_gemm_m256_bf16"))
|
| 154 |
def _m256_fake(a_packed, b_packed, sfa, sfb, workspace, out, alpha: float = 1.0) -> None:
|
| 155 |
if a_packed.shape[0] < 512:
|
|
@@ -733,8 +746,16 @@ def nvfp4_gemm_m256_bf16(
|
|
| 733 |
) -> torch.Tensor:
|
| 734 |
"""SM120 M>=512 NVFP4 GEMM with a caller-owned graph-stable workspace."""
|
| 735 |
if workspace is None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 736 |
workspace = torch.empty(
|
| 737 |
-
|
| 738 |
device=a_packed.device,
|
| 739 |
dtype=torch.uint8,
|
| 740 |
)
|
|
|
|
| 150 |
return None
|
| 151 |
|
| 152 |
|
| 153 |
+
@torch.library.register_fake(add_op_namespace_prefix("nvfp4_gemm_m256_workspace_size"))
|
| 154 |
+
def _m256_workspace_size_fake(a_packed, b_packed, sfa, sfb) -> int:
|
| 155 |
+
del sfa, sfb
|
| 156 |
+
if a_packed.ndim != 2 or b_packed.ndim != 2:
|
| 157 |
+
raise RuntimeError("a_packed and b_packed must be rank-2")
|
| 158 |
+
if a_packed.shape[0] < 512:
|
| 159 |
+
raise RuntimeError("the M256 tier requires M >= 512")
|
| 160 |
+
if a_packed.shape[1] != b_packed.shape[1]:
|
| 161 |
+
raise RuntimeError("packed A and B K dimensions must match")
|
| 162 |
+
# The current persistent M256 CUTLASS schedule has no auxiliary storage.
|
| 163 |
+
return 0
|
| 164 |
+
|
| 165 |
+
|
| 166 |
@torch.library.register_fake(add_op_namespace_prefix("nvfp4_gemm_m256_bf16"))
|
| 167 |
def _m256_fake(a_packed, b_packed, sfa, sfb, workspace, out, alpha: float = 1.0) -> None:
|
| 168 |
if a_packed.shape[0] < 512:
|
|
|
|
| 746 |
) -> torch.Tensor:
|
| 747 |
"""SM120 M>=512 NVFP4 GEMM with a caller-owned graph-stable workspace."""
|
| 748 |
if workspace is None:
|
| 749 |
+
# Dynamo cannot place a custom operator returning a Python scalar in
|
| 750 |
+
# an FX graph. This is exact for the current persistent M256 schedule;
|
| 751 |
+
# eager setup still queries the native helper as a future-proof check.
|
| 752 |
+
workspace_size = (
|
| 753 |
+
0
|
| 754 |
+
if torch.compiler.is_compiling()
|
| 755 |
+
else nvfp4_gemm_m256_workspace_size(a_packed, b_packed, sfa, sfb)
|
| 756 |
+
)
|
| 757 |
workspace = torch.empty(
|
| 758 |
+
workspace_size,
|
| 759 |
device=a_packed.device,
|
| 760 |
dtype=torch.uint8,
|
| 761 |
)
|
build/torch211-cxx11-cu128-x86_64-linux/{_fp4_gemm_cuda_e1f10b6.abi3.so → _fp4_gemm_cuda_dc57d15.abi3.so}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 2721416
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d1da1c9c5de85d62d2a39e29178eb3fb6e1fc4d772b04195fbcfd9683b63fcb5
|
| 3 |
size 2721416
|
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 _fp4_gemm_cuda_dc57d15
|
| 3 |
+
ops = torch.ops._fp4_gemm_cuda_dc57d15
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
+
return f"_fp4_gemm_cuda_dc57d15::{op_name}"
|
build/torch211-cxx11-cu128-x86_64-linux/metadata.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "fp4-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 |
"fp4_gemm/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY="
|
| 20 |
}
|
| 21 |
},
|
|
@@ -26,7 +26,7 @@
|
|
| 26 |
"dirty": false
|
| 27 |
},
|
| 28 |
"kernel": {
|
| 29 |
-
"sha": "
|
| 30 |
"dirty": false
|
| 31 |
}
|
| 32 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"name": "fp4-gemm",
|
| 3 |
+
"id": "_fp4_gemm_cuda_dc57d15",
|
| 4 |
"version": 1,
|
| 5 |
"license": "Apache-2.0",
|
| 6 |
"python-depends": [],
|
|
|
|
| 13 |
"digest": {
|
| 14 |
"algorithm": "sha256",
|
| 15 |
"files": {
|
| 16 |
+
"__init__.py": "XycjAPC24qtK6IH+GtF/jrPmWnB6DyNgSny26ep3w1Y=",
|
| 17 |
+
"_fp4_gemm_cuda_dc57d15.abi3.so": "0docnF3oXWLSo54pF46z+24fxNdysEGV+8/ZaDtj/LU=",
|
| 18 |
+
"_ops.py": "TM5HQsh2RfinhrEZ4U0XyWF2hFyrPWpxR79FQ41D5jk=",
|
| 19 |
"fp4_gemm/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY="
|
| 20 |
}
|
| 21 |
},
|
|
|
|
| 26 |
"dirty": false
|
| 27 |
},
|
| 28 |
"kernel": {
|
| 29 |
+
"sha": "dc57d15b8bb1d4b52d82012f7f789ae5ae6db17f",
|
| 30 |
"dirty": false
|
| 31 |
}
|
| 32 |
}
|
build/torch211-cxx11-cu130-x86_64-linux/__init__.py
CHANGED
|
@@ -150,6 +150,19 @@ def _gemv_warpsplit_interleaved_fake(
|
|
| 150 |
return None
|
| 151 |
|
| 152 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
@torch.library.register_fake(add_op_namespace_prefix("nvfp4_gemm_m256_bf16"))
|
| 154 |
def _m256_fake(a_packed, b_packed, sfa, sfb, workspace, out, alpha: float = 1.0) -> None:
|
| 155 |
if a_packed.shape[0] < 512:
|
|
@@ -733,8 +746,16 @@ def nvfp4_gemm_m256_bf16(
|
|
| 733 |
) -> torch.Tensor:
|
| 734 |
"""SM120 M>=512 NVFP4 GEMM with a caller-owned graph-stable workspace."""
|
| 735 |
if workspace is None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 736 |
workspace = torch.empty(
|
| 737 |
-
|
| 738 |
device=a_packed.device,
|
| 739 |
dtype=torch.uint8,
|
| 740 |
)
|
|
|
|
| 150 |
return None
|
| 151 |
|
| 152 |
|
| 153 |
+
@torch.library.register_fake(add_op_namespace_prefix("nvfp4_gemm_m256_workspace_size"))
|
| 154 |
+
def _m256_workspace_size_fake(a_packed, b_packed, sfa, sfb) -> int:
|
| 155 |
+
del sfa, sfb
|
| 156 |
+
if a_packed.ndim != 2 or b_packed.ndim != 2:
|
| 157 |
+
raise RuntimeError("a_packed and b_packed must be rank-2")
|
| 158 |
+
if a_packed.shape[0] < 512:
|
| 159 |
+
raise RuntimeError("the M256 tier requires M >= 512")
|
| 160 |
+
if a_packed.shape[1] != b_packed.shape[1]:
|
| 161 |
+
raise RuntimeError("packed A and B K dimensions must match")
|
| 162 |
+
# The current persistent M256 CUTLASS schedule has no auxiliary storage.
|
| 163 |
+
return 0
|
| 164 |
+
|
| 165 |
+
|
| 166 |
@torch.library.register_fake(add_op_namespace_prefix("nvfp4_gemm_m256_bf16"))
|
| 167 |
def _m256_fake(a_packed, b_packed, sfa, sfb, workspace, out, alpha: float = 1.0) -> None:
|
| 168 |
if a_packed.shape[0] < 512:
|
|
|
|
| 746 |
) -> torch.Tensor:
|
| 747 |
"""SM120 M>=512 NVFP4 GEMM with a caller-owned graph-stable workspace."""
|
| 748 |
if workspace is None:
|
| 749 |
+
# Dynamo cannot place a custom operator returning a Python scalar in
|
| 750 |
+
# an FX graph. This is exact for the current persistent M256 schedule;
|
| 751 |
+
# eager setup still queries the native helper as a future-proof check.
|
| 752 |
+
workspace_size = (
|
| 753 |
+
0
|
| 754 |
+
if torch.compiler.is_compiling()
|
| 755 |
+
else nvfp4_gemm_m256_workspace_size(a_packed, b_packed, sfa, sfb)
|
| 756 |
+
)
|
| 757 |
workspace = torch.empty(
|
| 758 |
+
workspace_size,
|
| 759 |
device=a_packed.device,
|
| 760 |
dtype=torch.uint8,
|
| 761 |
)
|
build/torch211-cxx11-cu130-x86_64-linux/{_fp4_gemm_cuda_e1f10b6.abi3.so → _fp4_gemm_cuda_dc57d15.abi3.so}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 8564792
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:687ec5c797f1519fed83a51f82bc7ecf53059fbe35843981d86fefe4143c3b87
|
| 3 |
size 8564792
|
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 _fp4_gemm_cuda_dc57d15
|
| 3 |
+
ops = torch.ops._fp4_gemm_cuda_dc57d15
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
+
return f"_fp4_gemm_cuda_dc57d15::{op_name}"
|
build/torch211-cxx11-cu130-x86_64-linux/metadata.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "fp4-gemm",
|
| 3 |
-
"id": "
|
| 4 |
"version": 1,
|
| 5 |
"license": "Apache-2.0",
|
| 6 |
"python-depends": [],
|
|
@@ -14,9 +14,9 @@
|
|
| 14 |
"digest": {
|
| 15 |
"algorithm": "sha256",
|
| 16 |
"files": {
|
| 17 |
-
"__init__.py": "
|
| 18 |
-
"
|
| 19 |
-
"_ops.py": "
|
| 20 |
"fp4_gemm/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY="
|
| 21 |
}
|
| 22 |
},
|
|
@@ -27,7 +27,7 @@
|
|
| 27 |
"dirty": false
|
| 28 |
},
|
| 29 |
"kernel": {
|
| 30 |
-
"sha": "
|
| 31 |
"dirty": false
|
| 32 |
}
|
| 33 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"name": "fp4-gemm",
|
| 3 |
+
"id": "_fp4_gemm_cuda_dc57d15",
|
| 4 |
"version": 1,
|
| 5 |
"license": "Apache-2.0",
|
| 6 |
"python-depends": [],
|
|
|
|
| 14 |
"digest": {
|
| 15 |
"algorithm": "sha256",
|
| 16 |
"files": {
|
| 17 |
+
"__init__.py": "XycjAPC24qtK6IH+GtF/jrPmWnB6DyNgSny26ep3w1Y=",
|
| 18 |
+
"_fp4_gemm_cuda_dc57d15.abi3.so": "aH7Fx5fxUZ/tg6Ufgrx+z1MFn741hDmB2G/v5BQ8O4c=",
|
| 19 |
+
"_ops.py": "TM5HQsh2RfinhrEZ4U0XyWF2hFyrPWpxR79FQ41D5jk=",
|
| 20 |
"fp4_gemm/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY="
|
| 21 |
}
|
| 22 |
},
|
|
|
|
| 27 |
"dirty": false
|
| 28 |
},
|
| 29 |
"kernel": {
|
| 30 |
+
"sha": "dc57d15b8bb1d4b52d82012f7f789ae5ae6db17f",
|
| 31 |
"dirty": false
|
| 32 |
}
|
| 33 |
}
|
build/torch212-cxx11-cu130-x86_64-linux/__init__.py
CHANGED
|
@@ -150,6 +150,19 @@ def _gemv_warpsplit_interleaved_fake(
|
|
| 150 |
return None
|
| 151 |
|
| 152 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
@torch.library.register_fake(add_op_namespace_prefix("nvfp4_gemm_m256_bf16"))
|
| 154 |
def _m256_fake(a_packed, b_packed, sfa, sfb, workspace, out, alpha: float = 1.0) -> None:
|
| 155 |
if a_packed.shape[0] < 512:
|
|
@@ -733,8 +746,16 @@ def nvfp4_gemm_m256_bf16(
|
|
| 733 |
) -> torch.Tensor:
|
| 734 |
"""SM120 M>=512 NVFP4 GEMM with a caller-owned graph-stable workspace."""
|
| 735 |
if workspace is None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 736 |
workspace = torch.empty(
|
| 737 |
-
|
| 738 |
device=a_packed.device,
|
| 739 |
dtype=torch.uint8,
|
| 740 |
)
|
|
|
|
| 150 |
return None
|
| 151 |
|
| 152 |
|
| 153 |
+
@torch.library.register_fake(add_op_namespace_prefix("nvfp4_gemm_m256_workspace_size"))
|
| 154 |
+
def _m256_workspace_size_fake(a_packed, b_packed, sfa, sfb) -> int:
|
| 155 |
+
del sfa, sfb
|
| 156 |
+
if a_packed.ndim != 2 or b_packed.ndim != 2:
|
| 157 |
+
raise RuntimeError("a_packed and b_packed must be rank-2")
|
| 158 |
+
if a_packed.shape[0] < 512:
|
| 159 |
+
raise RuntimeError("the M256 tier requires M >= 512")
|
| 160 |
+
if a_packed.shape[1] != b_packed.shape[1]:
|
| 161 |
+
raise RuntimeError("packed A and B K dimensions must match")
|
| 162 |
+
# The current persistent M256 CUTLASS schedule has no auxiliary storage.
|
| 163 |
+
return 0
|
| 164 |
+
|
| 165 |
+
|
| 166 |
@torch.library.register_fake(add_op_namespace_prefix("nvfp4_gemm_m256_bf16"))
|
| 167 |
def _m256_fake(a_packed, b_packed, sfa, sfb, workspace, out, alpha: float = 1.0) -> None:
|
| 168 |
if a_packed.shape[0] < 512:
|
|
|
|
| 746 |
) -> torch.Tensor:
|
| 747 |
"""SM120 M>=512 NVFP4 GEMM with a caller-owned graph-stable workspace."""
|
| 748 |
if workspace is None:
|
| 749 |
+
# Dynamo cannot place a custom operator returning a Python scalar in
|
| 750 |
+
# an FX graph. This is exact for the current persistent M256 schedule;
|
| 751 |
+
# eager setup still queries the native helper as a future-proof check.
|
| 752 |
+
workspace_size = (
|
| 753 |
+
0
|
| 754 |
+
if torch.compiler.is_compiling()
|
| 755 |
+
else nvfp4_gemm_m256_workspace_size(a_packed, b_packed, sfa, sfb)
|
| 756 |
+
)
|
| 757 |
workspace = torch.empty(
|
| 758 |
+
workspace_size,
|
| 759 |
device=a_packed.device,
|
| 760 |
dtype=torch.uint8,
|
| 761 |
)
|
build/torch212-cxx11-cu130-x86_64-linux/{_fp4_gemm_cuda_e1f10b6.abi3.so → _fp4_gemm_cuda_dc57d15.abi3.so}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 8566680
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0f26894cd8000a3c464811b255f07732758d8d53521c2b84c305e9cc07d96619
|
| 3 |
size 8566680
|
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 _fp4_gemm_cuda_dc57d15
|
| 3 |
+
ops = torch.ops._fp4_gemm_cuda_dc57d15
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
+
return f"_fp4_gemm_cuda_dc57d15::{op_name}"
|
build/torch212-cxx11-cu130-x86_64-linux/metadata.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "fp4-gemm",
|
| 3 |
-
"id": "
|
| 4 |
"version": 1,
|
| 5 |
"license": "Apache-2.0",
|
| 6 |
"python-depends": [],
|
|
@@ -14,9 +14,9 @@
|
|
| 14 |
"digest": {
|
| 15 |
"algorithm": "sha256",
|
| 16 |
"files": {
|
| 17 |
-
"__init__.py": "
|
| 18 |
-
"
|
| 19 |
-
"_ops.py": "
|
| 20 |
"fp4_gemm/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY="
|
| 21 |
}
|
| 22 |
},
|
|
@@ -27,7 +27,7 @@
|
|
| 27 |
"dirty": false
|
| 28 |
},
|
| 29 |
"kernel": {
|
| 30 |
-
"sha": "
|
| 31 |
"dirty": false
|
| 32 |
}
|
| 33 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"name": "fp4-gemm",
|
| 3 |
+
"id": "_fp4_gemm_cuda_dc57d15",
|
| 4 |
"version": 1,
|
| 5 |
"license": "Apache-2.0",
|
| 6 |
"python-depends": [],
|
|
|
|
| 14 |
"digest": {
|
| 15 |
"algorithm": "sha256",
|
| 16 |
"files": {
|
| 17 |
+
"__init__.py": "XycjAPC24qtK6IH+GtF/jrPmWnB6DyNgSny26ep3w1Y=",
|
| 18 |
+
"_fp4_gemm_cuda_dc57d15.abi3.so": "DyaJTNgACjxGSBGyVfB3MnWNjVNSHCuEwwXpzAfZZhk=",
|
| 19 |
+
"_ops.py": "TM5HQsh2RfinhrEZ4U0XyWF2hFyrPWpxR79FQ41D5jk=",
|
| 20 |
"fp4_gemm/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY="
|
| 21 |
}
|
| 22 |
},
|
|
|
|
| 27 |
"dirty": false
|
| 28 |
},
|
| 29 |
"kernel": {
|
| 30 |
+
"sha": "dc57d15b8bb1d4b52d82012f7f789ae5ae6db17f",
|
| 31 |
"dirty": false
|
| 32 |
}
|
| 33 |
}
|
build/torch212-cxx11-cu132-x86_64-linux/__init__.py
CHANGED
|
@@ -150,6 +150,19 @@ def _gemv_warpsplit_interleaved_fake(
|
|
| 150 |
return None
|
| 151 |
|
| 152 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
@torch.library.register_fake(add_op_namespace_prefix("nvfp4_gemm_m256_bf16"))
|
| 154 |
def _m256_fake(a_packed, b_packed, sfa, sfb, workspace, out, alpha: float = 1.0) -> None:
|
| 155 |
if a_packed.shape[0] < 512:
|
|
@@ -733,8 +746,16 @@ def nvfp4_gemm_m256_bf16(
|
|
| 733 |
) -> torch.Tensor:
|
| 734 |
"""SM120 M>=512 NVFP4 GEMM with a caller-owned graph-stable workspace."""
|
| 735 |
if workspace is None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 736 |
workspace = torch.empty(
|
| 737 |
-
|
| 738 |
device=a_packed.device,
|
| 739 |
dtype=torch.uint8,
|
| 740 |
)
|
|
|
|
| 150 |
return None
|
| 151 |
|
| 152 |
|
| 153 |
+
@torch.library.register_fake(add_op_namespace_prefix("nvfp4_gemm_m256_workspace_size"))
|
| 154 |
+
def _m256_workspace_size_fake(a_packed, b_packed, sfa, sfb) -> int:
|
| 155 |
+
del sfa, sfb
|
| 156 |
+
if a_packed.ndim != 2 or b_packed.ndim != 2:
|
| 157 |
+
raise RuntimeError("a_packed and b_packed must be rank-2")
|
| 158 |
+
if a_packed.shape[0] < 512:
|
| 159 |
+
raise RuntimeError("the M256 tier requires M >= 512")
|
| 160 |
+
if a_packed.shape[1] != b_packed.shape[1]:
|
| 161 |
+
raise RuntimeError("packed A and B K dimensions must match")
|
| 162 |
+
# The current persistent M256 CUTLASS schedule has no auxiliary storage.
|
| 163 |
+
return 0
|
| 164 |
+
|
| 165 |
+
|
| 166 |
@torch.library.register_fake(add_op_namespace_prefix("nvfp4_gemm_m256_bf16"))
|
| 167 |
def _m256_fake(a_packed, b_packed, sfa, sfb, workspace, out, alpha: float = 1.0) -> None:
|
| 168 |
if a_packed.shape[0] < 512:
|
|
|
|
| 746 |
) -> torch.Tensor:
|
| 747 |
"""SM120 M>=512 NVFP4 GEMM with a caller-owned graph-stable workspace."""
|
| 748 |
if workspace is None:
|
| 749 |
+
# Dynamo cannot place a custom operator returning a Python scalar in
|
| 750 |
+
# an FX graph. This is exact for the current persistent M256 schedule;
|
| 751 |
+
# eager setup still queries the native helper as a future-proof check.
|
| 752 |
+
workspace_size = (
|
| 753 |
+
0
|
| 754 |
+
if torch.compiler.is_compiling()
|
| 755 |
+
else nvfp4_gemm_m256_workspace_size(a_packed, b_packed, sfa, sfb)
|
| 756 |
+
)
|
| 757 |
workspace = torch.empty(
|
| 758 |
+
workspace_size,
|
| 759 |
device=a_packed.device,
|
| 760 |
dtype=torch.uint8,
|
| 761 |
)
|
build/torch212-cxx11-cu132-x86_64-linux/{_fp4_gemm_cuda_e1f10b6.abi3.so → _fp4_gemm_cuda_dc57d15.abi3.so}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 8550344
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3b1fc2155f02132014a4ed86a37eb5c945d705651eeda4cf4fc294c4e4d5a442
|
| 3 |
size 8550344
|
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 _fp4_gemm_cuda_dc57d15
|
| 3 |
+
ops = torch.ops._fp4_gemm_cuda_dc57d15
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
+
return f"_fp4_gemm_cuda_dc57d15::{op_name}"
|
build/torch212-cxx11-cu132-x86_64-linux/metadata.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "fp4-gemm",
|
| 3 |
-
"id": "
|
| 4 |
"version": 1,
|
| 5 |
"license": "Apache-2.0",
|
| 6 |
"python-depends": [],
|
|
@@ -14,9 +14,9 @@
|
|
| 14 |
"digest": {
|
| 15 |
"algorithm": "sha256",
|
| 16 |
"files": {
|
| 17 |
-
"__init__.py": "
|
| 18 |
-
"
|
| 19 |
-
"_ops.py": "
|
| 20 |
"fp4_gemm/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY="
|
| 21 |
}
|
| 22 |
},
|
|
@@ -27,7 +27,7 @@
|
|
| 27 |
"dirty": false
|
| 28 |
},
|
| 29 |
"kernel": {
|
| 30 |
-
"sha": "
|
| 31 |
"dirty": false
|
| 32 |
}
|
| 33 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"name": "fp4-gemm",
|
| 3 |
+
"id": "_fp4_gemm_cuda_dc57d15",
|
| 4 |
"version": 1,
|
| 5 |
"license": "Apache-2.0",
|
| 6 |
"python-depends": [],
|
|
|
|
| 14 |
"digest": {
|
| 15 |
"algorithm": "sha256",
|
| 16 |
"files": {
|
| 17 |
+
"__init__.py": "XycjAPC24qtK6IH+GtF/jrPmWnB6DyNgSny26ep3w1Y=",
|
| 18 |
+
"_fp4_gemm_cuda_dc57d15.abi3.so": "Ox/CFV8CEyAUpO2Go361yUXXBWUe7aTPT8KUxOTVpEI=",
|
| 19 |
+
"_ops.py": "TM5HQsh2RfinhrEZ4U0XyWF2hFyrPWpxR79FQ41D5jk=",
|
| 20 |
"fp4_gemm/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY="
|
| 21 |
}
|
| 22 |
},
|
|
|
|
| 27 |
"dirty": false
|
| 28 |
},
|
| 29 |
"kernel": {
|
| 30 |
+
"sha": "dc57d15b8bb1d4b52d82012f7f789ae5ae6db17f",
|
| 31 |
"dirty": false
|
| 32 |
}
|
| 33 |
}
|
build/torch213-cxx11-cu130-x86_64-linux/__init__.py
CHANGED
|
@@ -150,6 +150,19 @@ def _gemv_warpsplit_interleaved_fake(
|
|
| 150 |
return None
|
| 151 |
|
| 152 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
@torch.library.register_fake(add_op_namespace_prefix("nvfp4_gemm_m256_bf16"))
|
| 154 |
def _m256_fake(a_packed, b_packed, sfa, sfb, workspace, out, alpha: float = 1.0) -> None:
|
| 155 |
if a_packed.shape[0] < 512:
|
|
@@ -733,8 +746,16 @@ def nvfp4_gemm_m256_bf16(
|
|
| 733 |
) -> torch.Tensor:
|
| 734 |
"""SM120 M>=512 NVFP4 GEMM with a caller-owned graph-stable workspace."""
|
| 735 |
if workspace is None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 736 |
workspace = torch.empty(
|
| 737 |
-
|
| 738 |
device=a_packed.device,
|
| 739 |
dtype=torch.uint8,
|
| 740 |
)
|
|
|
|
| 150 |
return None
|
| 151 |
|
| 152 |
|
| 153 |
+
@torch.library.register_fake(add_op_namespace_prefix("nvfp4_gemm_m256_workspace_size"))
|
| 154 |
+
def _m256_workspace_size_fake(a_packed, b_packed, sfa, sfb) -> int:
|
| 155 |
+
del sfa, sfb
|
| 156 |
+
if a_packed.ndim != 2 or b_packed.ndim != 2:
|
| 157 |
+
raise RuntimeError("a_packed and b_packed must be rank-2")
|
| 158 |
+
if a_packed.shape[0] < 512:
|
| 159 |
+
raise RuntimeError("the M256 tier requires M >= 512")
|
| 160 |
+
if a_packed.shape[1] != b_packed.shape[1]:
|
| 161 |
+
raise RuntimeError("packed A and B K dimensions must match")
|
| 162 |
+
# The current persistent M256 CUTLASS schedule has no auxiliary storage.
|
| 163 |
+
return 0
|
| 164 |
+
|
| 165 |
+
|
| 166 |
@torch.library.register_fake(add_op_namespace_prefix("nvfp4_gemm_m256_bf16"))
|
| 167 |
def _m256_fake(a_packed, b_packed, sfa, sfb, workspace, out, alpha: float = 1.0) -> None:
|
| 168 |
if a_packed.shape[0] < 512:
|
|
|
|
| 746 |
) -> torch.Tensor:
|
| 747 |
"""SM120 M>=512 NVFP4 GEMM with a caller-owned graph-stable workspace."""
|
| 748 |
if workspace is None:
|
| 749 |
+
# Dynamo cannot place a custom operator returning a Python scalar in
|
| 750 |
+
# an FX graph. This is exact for the current persistent M256 schedule;
|
| 751 |
+
# eager setup still queries the native helper as a future-proof check.
|
| 752 |
+
workspace_size = (
|
| 753 |
+
0
|
| 754 |
+
if torch.compiler.is_compiling()
|
| 755 |
+
else nvfp4_gemm_m256_workspace_size(a_packed, b_packed, sfa, sfb)
|
| 756 |
+
)
|
| 757 |
workspace = torch.empty(
|
| 758 |
+
workspace_size,
|
| 759 |
device=a_packed.device,
|
| 760 |
dtype=torch.uint8,
|
| 761 |
)
|
build/torch213-cxx11-cu130-x86_64-linux/{_fp4_gemm_cuda_e1f10b6.abi3.so → _fp4_gemm_cuda_dc57d15.abi3.so}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 8566520
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a2e973560e69449ee79707984b7703d19e8f8ef9bba3902513887c57b64682c0
|
| 3 |
size 8566520
|
build/torch213-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 _fp4_gemm_cuda_dc57d15
|
| 3 |
+
ops = torch.ops._fp4_gemm_cuda_dc57d15
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
+
return f"_fp4_gemm_cuda_dc57d15::{op_name}"
|
build/torch213-cxx11-cu130-x86_64-linux/metadata.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "fp4-gemm",
|
| 3 |
-
"id": "
|
| 4 |
"version": 1,
|
| 5 |
"license": "Apache-2.0",
|
| 6 |
"python-depends": [],
|
|
@@ -14,9 +14,9 @@
|
|
| 14 |
"digest": {
|
| 15 |
"algorithm": "sha256",
|
| 16 |
"files": {
|
| 17 |
-
"__init__.py": "
|
| 18 |
-
"
|
| 19 |
-
"_ops.py": "
|
| 20 |
"fp4_gemm/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY="
|
| 21 |
}
|
| 22 |
},
|
|
@@ -27,7 +27,7 @@
|
|
| 27 |
"dirty": false
|
| 28 |
},
|
| 29 |
"kernel": {
|
| 30 |
-
"sha": "
|
| 31 |
"dirty": false
|
| 32 |
}
|
| 33 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"name": "fp4-gemm",
|
| 3 |
+
"id": "_fp4_gemm_cuda_dc57d15",
|
| 4 |
"version": 1,
|
| 5 |
"license": "Apache-2.0",
|
| 6 |
"python-depends": [],
|
|
|
|
| 14 |
"digest": {
|
| 15 |
"algorithm": "sha256",
|
| 16 |
"files": {
|
| 17 |
+
"__init__.py": "XycjAPC24qtK6IH+GtF/jrPmWnB6DyNgSny26ep3w1Y=",
|
| 18 |
+
"_fp4_gemm_cuda_dc57d15.abi3.so": "oulzVg5pRJ7nlweYS3cD0Z6Pjvm7o5AlE4h8V7ZGgsA=",
|
| 19 |
+
"_ops.py": "TM5HQsh2RfinhrEZ4U0XyWF2hFyrPWpxR79FQ41D5jk=",
|
| 20 |
"fp4_gemm/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY="
|
| 21 |
}
|
| 22 |
},
|
|
|
|
| 27 |
"dirty": false
|
| 28 |
},
|
| 29 |
"kernel": {
|
| 30 |
+
"sha": "dc57d15b8bb1d4b52d82012f7f789ae5ae6db17f",
|
| 31 |
"dirty": false
|
| 32 |
}
|
| 33 |
}
|
build/torch213-cxx11-cu132-x86_64-linux/__init__.py
CHANGED
|
@@ -150,6 +150,19 @@ def _gemv_warpsplit_interleaved_fake(
|
|
| 150 |
return None
|
| 151 |
|
| 152 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
@torch.library.register_fake(add_op_namespace_prefix("nvfp4_gemm_m256_bf16"))
|
| 154 |
def _m256_fake(a_packed, b_packed, sfa, sfb, workspace, out, alpha: float = 1.0) -> None:
|
| 155 |
if a_packed.shape[0] < 512:
|
|
@@ -733,8 +746,16 @@ def nvfp4_gemm_m256_bf16(
|
|
| 733 |
) -> torch.Tensor:
|
| 734 |
"""SM120 M>=512 NVFP4 GEMM with a caller-owned graph-stable workspace."""
|
| 735 |
if workspace is None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 736 |
workspace = torch.empty(
|
| 737 |
-
|
| 738 |
device=a_packed.device,
|
| 739 |
dtype=torch.uint8,
|
| 740 |
)
|
|
|
|
| 150 |
return None
|
| 151 |
|
| 152 |
|
| 153 |
+
@torch.library.register_fake(add_op_namespace_prefix("nvfp4_gemm_m256_workspace_size"))
|
| 154 |
+
def _m256_workspace_size_fake(a_packed, b_packed, sfa, sfb) -> int:
|
| 155 |
+
del sfa, sfb
|
| 156 |
+
if a_packed.ndim != 2 or b_packed.ndim != 2:
|
| 157 |
+
raise RuntimeError("a_packed and b_packed must be rank-2")
|
| 158 |
+
if a_packed.shape[0] < 512:
|
| 159 |
+
raise RuntimeError("the M256 tier requires M >= 512")
|
| 160 |
+
if a_packed.shape[1] != b_packed.shape[1]:
|
| 161 |
+
raise RuntimeError("packed A and B K dimensions must match")
|
| 162 |
+
# The current persistent M256 CUTLASS schedule has no auxiliary storage.
|
| 163 |
+
return 0
|
| 164 |
+
|
| 165 |
+
|
| 166 |
@torch.library.register_fake(add_op_namespace_prefix("nvfp4_gemm_m256_bf16"))
|
| 167 |
def _m256_fake(a_packed, b_packed, sfa, sfb, workspace, out, alpha: float = 1.0) -> None:
|
| 168 |
if a_packed.shape[0] < 512:
|
|
|
|
| 746 |
) -> torch.Tensor:
|
| 747 |
"""SM120 M>=512 NVFP4 GEMM with a caller-owned graph-stable workspace."""
|
| 748 |
if workspace is None:
|
| 749 |
+
# Dynamo cannot place a custom operator returning a Python scalar in
|
| 750 |
+
# an FX graph. This is exact for the current persistent M256 schedule;
|
| 751 |
+
# eager setup still queries the native helper as a future-proof check.
|
| 752 |
+
workspace_size = (
|
| 753 |
+
0
|
| 754 |
+
if torch.compiler.is_compiling()
|
| 755 |
+
else nvfp4_gemm_m256_workspace_size(a_packed, b_packed, sfa, sfb)
|
| 756 |
+
)
|
| 757 |
workspace = torch.empty(
|
| 758 |
+
workspace_size,
|
| 759 |
device=a_packed.device,
|
| 760 |
dtype=torch.uint8,
|
| 761 |
)
|
build/torch213-cxx11-cu132-x86_64-linux/{_fp4_gemm_cuda_e1f10b6.abi3.so → _fp4_gemm_cuda_dc57d15.abi3.so}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 8550192
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3c5c466015e9fda36acc0d9426f2c9281bb9e8af175afb1686edd37348a4f975
|
| 3 |
size 8550192
|
build/torch213-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 _fp4_gemm_cuda_dc57d15
|
| 3 |
+
ops = torch.ops._fp4_gemm_cuda_dc57d15
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
+
return f"_fp4_gemm_cuda_dc57d15::{op_name}"
|
build/torch213-cxx11-cu132-x86_64-linux/metadata.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "fp4-gemm",
|
| 3 |
-
"id": "
|
| 4 |
"version": 1,
|
| 5 |
"license": "Apache-2.0",
|
| 6 |
"python-depends": [],
|
|
@@ -14,9 +14,9 @@
|
|
| 14 |
"digest": {
|
| 15 |
"algorithm": "sha256",
|
| 16 |
"files": {
|
| 17 |
-
"__init__.py": "
|
| 18 |
-
"
|
| 19 |
-
"_ops.py": "
|
| 20 |
"fp4_gemm/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY="
|
| 21 |
}
|
| 22 |
},
|
|
@@ -27,7 +27,7 @@
|
|
| 27 |
"dirty": false
|
| 28 |
},
|
| 29 |
"kernel": {
|
| 30 |
-
"sha": "
|
| 31 |
"dirty": false
|
| 32 |
}
|
| 33 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"name": "fp4-gemm",
|
| 3 |
+
"id": "_fp4_gemm_cuda_dc57d15",
|
| 4 |
"version": 1,
|
| 5 |
"license": "Apache-2.0",
|
| 6 |
"python-depends": [],
|
|
|
|
| 14 |
"digest": {
|
| 15 |
"algorithm": "sha256",
|
| 16 |
"files": {
|
| 17 |
+
"__init__.py": "XycjAPC24qtK6IH+GtF/jrPmWnB6DyNgSny26ep3w1Y=",
|
| 18 |
+
"_fp4_gemm_cuda_dc57d15.abi3.so": "PFxGYBXp/aNqzA2UJvLJKBu56K8XWvsWhu3Tc0ik+XU=",
|
| 19 |
+
"_ops.py": "TM5HQsh2RfinhrEZ4U0XyWF2hFyrPWpxR79FQ41D5jk=",
|
| 20 |
"fp4_gemm/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY="
|
| 21 |
}
|
| 22 |
},
|
|
|
|
| 27 |
"dirty": false
|
| 28 |
},
|
| 29 |
"kernel": {
|
| 30 |
+
"sha": "dc57d15b8bb1d4b52d82012f7f789ae5ae6db17f",
|
| 31 |
"dirty": false
|
| 32 |
}
|
| 33 |
}
|