Promote latest kernel artifacts to main
Browse files- README.md +148 -6
- build/torch213-cxx11-cu130-aarch64-linux/__init__.py +455 -0
- build/torch213-cxx11-cu130-aarch64-linux/_adaptive_layernorm_producers_cuda_8a66d8b.abi3.so +3 -0
- build/torch213-cxx11-cu130-aarch64-linux/_ops.py +6 -0
- build/torch213-cxx11-cu130-aarch64-linux/adaptive_layernorm_producers/__init__.py +14 -0
- build/torch213-cxx11-cu130-aarch64-linux/metadata.json +28 -0
README.md
CHANGED
|
@@ -1,9 +1,151 @@
|
|
| 1 |
-
#
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
|
| 6 |
-
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# adaptive-layernorm-producers
|
| 2 |
|
| 3 |
+
FlashRT native CUDA producer kernels for DiT/Wan-style adaptive LayerNorm
|
| 4 |
+
blocks.
|
| 5 |
|
| 6 |
+
This package fuses the producer side of the block:
|
| 7 |
|
| 8 |
+
```text
|
| 9 |
+
LayerNorm / adaptive LayerNorm modulation -> low-precision activation
|
| 10 |
+
```
|
| 11 |
+
|
| 12 |
+
into a single Kernel Hub operator. It is intended for transformer and diffuser
|
| 13 |
+
runtimes where the following GEMM already consumes FP8 or NVFP4 activations.
|
| 14 |
+
Without this fusion, the runtime pays for separate normalization, modulation,
|
| 15 |
+
BF16 materialization, and quantization launches before the GEMM.
|
| 16 |
+
|
| 17 |
+
The source kernels are derived from the production FlashRT runtime:
|
| 18 |
+
|
| 19 |
+
- `official/FlashRT/csrc/quantize/ada_layer_norm_fp8.cu`
|
| 20 |
+
- `official/FlashRT/csrc/kernels/dit_bf16.cu::layer_norm_no_affine_fp8_static_bf16`
|
| 21 |
+
|
| 22 |
+
The full FlashRT model runtime and serving pipeline live upstream at
|
| 23 |
+
[LiangSu8899/FlashRT](https://github.com/LiangSu8899/FlashRT).
|
| 24 |
+
|
| 25 |
+
## Available Functions
|
| 26 |
+
|
| 27 |
+
- `ada_layer_norm_quant_fp8_bf16(x, scale, shift, act_scale, eps=1e-5, out=None)`
|
| 28 |
+
- `ada_layer_norm_quant_fp8_ptok_bf16(x, scale, shift, act_scale, eps=1e-5, out=None)`
|
| 29 |
+
- `ada_layer_norm_quant_fp8_ptok_table_bf16(x, temb, table, act_scale, shift_idx, scale_idx, eps=1e-5, out=None)`
|
| 30 |
+
- `ada_layer_norm_quant_fp8_modfp8_bf16(x, scale_fp8, shift_fp8, scale_deq, shift_deq, act_scale, eps=1e-5, out=None)`
|
| 31 |
+
- `awq_ada_layer_norm_quant_fp8_bf16(x, scale, shift, inv_s, act_scale, eps=1e-5, out=None)`
|
| 32 |
+
- `ada_layer_norm_quant_nvfp4_swizzled_bf16(x, scale, shift, eps=1e-5, packed=None, sf_swizzled=None)`
|
| 33 |
+
- `ada_layer_norm_quant_nvfp4_swizzled_modfp8_bf16(x, scale_fp8, shift_fp8, scale_deq, shift_deq, eps=1e-5, packed=None, sf_swizzled=None)`
|
| 34 |
+
- `layer_norm_no_affine_quant_fp8_static_bf16(x, act_scale, eps=1e-5, out=None)`
|
| 35 |
+
- `layer_norm_no_affine_quant_nvfp4_swizzled_bf16(x, eps=1e-5, packed=None, sf_swizzled=None)`
|
| 36 |
+
- `adaln_modulation6_bf16(adaln_params, layer_modulation, out=None)`
|
| 37 |
+
- `swizzled_sf_size(rows, dim)`
|
| 38 |
+
|
| 39 |
+
## Tensor Contract
|
| 40 |
+
|
| 41 |
+
- `x`: contiguous CUDA `torch.bfloat16`, shape `(rows, dim)`.
|
| 42 |
+
- Broadcast `scale`, `shift`, and `inv_s`: contiguous CUDA
|
| 43 |
+
`torch.bfloat16`, shape `(dim,)`.
|
| 44 |
+
- Per-token `scale` and `shift`: contiguous CUDA `torch.bfloat16`, shape
|
| 45 |
+
`(rows, dim)`.
|
| 46 |
+
- Table form `temb`: contiguous CUDA `torch.bfloat16`, shape
|
| 47 |
+
`(rows, chunks, dim)`; `table`: contiguous CUDA `torch.float32`, shape
|
| 48 |
+
`(chunks, dim)`.
|
| 49 |
+
- `scale_fp8`, `shift_fp8`: contiguous CUDA `torch.float8_e4m3fn`, shape `(dim,)`.
|
| 50 |
+
- `scale_deq`, `shift_deq`, `act_scale`: CUDA `torch.float32` scalar tensors.
|
| 51 |
+
- FP8 outputs use `torch.float8_e4m3fn`, shape `(rows, dim)`.
|
| 52 |
+
- NVFP4 packed output uses `torch.uint8`, shape `(rows, dim // 2)`.
|
| 53 |
+
- NVFP4 scale output uses the FlashRT/CUTLASS 128x4 swizzled uint8 scale
|
| 54 |
+
layout. Allocate with `swizzled_sf_size(rows, dim)`.
|
| 55 |
+
- `dim` must be even for FP8 outputs and divisible by 16 for NVFP4 outputs.
|
| 56 |
+
- The package targets CUDA 12.8+ and Blackwell-class deployment paths.
|
| 57 |
+
- `adaln_modulation6_bf16` takes FP32 `(batch, sequence, 6, dim)` parameters
|
| 58 |
+
plus FP32 `(6, dim)` layer modulation and returns six BF16
|
| 59 |
+
`(batch, sequence, dim)` tensors.
|
| 60 |
+
|
| 61 |
+
## Minimal Usage
|
| 62 |
+
|
| 63 |
+
```python
|
| 64 |
+
from kernels import get_kernel
|
| 65 |
+
import torch
|
| 66 |
+
|
| 67 |
+
ops = get_kernel("flashrt/adaptive-layernorm-producers", version=1, trust_remote_code=True)
|
| 68 |
+
|
| 69 |
+
rows, dim = 2520, 3072
|
| 70 |
+
x = torch.randn((rows, dim), device="cuda", dtype=torch.bfloat16)
|
| 71 |
+
scale = torch.zeros((dim,), device="cuda", dtype=torch.bfloat16)
|
| 72 |
+
shift = torch.zeros((dim,), device="cuda", dtype=torch.bfloat16)
|
| 73 |
+
act_scale = torch.tensor([0.025], device="cuda", dtype=torch.float32)
|
| 74 |
+
|
| 75 |
+
x_fp8 = ops.ada_layer_norm_quant_fp8_bf16(x, scale, shift, act_scale)
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
Per-token modulation without materializing a broadcast buffer:
|
| 79 |
+
|
| 80 |
+
```python
|
| 81 |
+
ptok_scale = torch.zeros_like(x)
|
| 82 |
+
ptok_shift = torch.zeros_like(x)
|
| 83 |
+
x_fp8 = ops.ada_layer_norm_quant_fp8_ptok_bf16(
|
| 84 |
+
x, ptok_scale, ptok_shift, act_scale
|
| 85 |
+
)
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
Fused host modulation table add and chunk selection:
|
| 89 |
+
|
| 90 |
+
```python
|
| 91 |
+
chunks = 6
|
| 92 |
+
temb = torch.zeros((rows, chunks, dim), device="cuda", dtype=torch.bfloat16)
|
| 93 |
+
table = torch.zeros((chunks, dim), device="cuda", dtype=torch.float32)
|
| 94 |
+
x_fp8 = ops.ada_layer_norm_quant_fp8_ptok_table_bf16(
|
| 95 |
+
x, temb, table, act_scale, shift_idx=0, scale_idx=1
|
| 96 |
+
)
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
Static-buffer usage for CUDA Graph capture:
|
| 100 |
+
|
| 101 |
+
```python
|
| 102 |
+
out = torch.empty_like(x, dtype=torch.float8_e4m3fn)
|
| 103 |
+
ops.ada_layer_norm_quant_fp8_bf16(x, scale, shift, act_scale, out=out)
|
| 104 |
+
```
|
| 105 |
+
|
| 106 |
+
NVFP4 producer:
|
| 107 |
+
|
| 108 |
+
```python
|
| 109 |
+
packed, sf = ops.ada_layer_norm_quant_nvfp4_swizzled_bf16(x, scale, shift)
|
| 110 |
+
|
| 111 |
+
# GROOT N1.7 pre-FFN producer on Thor.
|
| 112 |
+
packed_ln, sf_ln = ops.layer_norm_no_affine_quant_nvfp4_swizzled_bf16(x)
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
Six-way DiT modulation:
|
| 116 |
+
|
| 117 |
+
```python
|
| 118 |
+
params = torch.randn((1, rows, 6, dim), device="cuda", dtype=torch.float32)
|
| 119 |
+
modulation = torch.randn((6, dim), device="cuda", dtype=torch.float32)
|
| 120 |
+
outputs = ops.adaln_modulation6_bf16(params, modulation)
|
| 121 |
+
```
|
| 122 |
+
|
| 123 |
+
## Validation
|
| 124 |
+
|
| 125 |
+
```bash
|
| 126 |
+
python adaptive-layernorm-producers/tests/test_adaptive_layernorm_producers.py --backend source --mode full
|
| 127 |
+
python adaptive-layernorm-producers/benchmarks/benchmark.py --backend source --iters 100
|
| 128 |
+
```
|
| 129 |
+
|
| 130 |
+
The validation suite checks exact FP8 output for small producer shapes, exact
|
| 131 |
+
NVFP4 packed/scalefactor output against the native staged BF16-norm plus FP4
|
| 132 |
+
quantizer contract on SM110, and strict FP8
|
| 133 |
+
boundary accounting for long video shapes. The long-shape policy requires
|
| 134 |
+
`p99_abs == 0` and only a tiny count of adjacent FP8-code boundary differences
|
| 135 |
+
against the eager reference.
|
| 136 |
+
|
| 137 |
+
See `VALIDATION.md` and `benchmarks/RESULTS.md` for the current local RTX 5090
|
| 138 |
+
source-build results.
|
| 139 |
+
|
| 140 |
+
The SM110 FP4 producer uses the native GROOT N1.7 contract from FlashRT commit
|
| 141 |
+
`24df793f4fa2d50780aea03b644208c6e0cb4162`. Its scale conversion and FP4 bin
|
| 142 |
+
boundaries intentionally differ from the older SM120 producer; release tests
|
| 143 |
+
compare each architecture against its own production contract.
|
| 144 |
+
|
| 145 |
+
The aarch64 release variant `torch211-cxx11-cu130-aarch64-linux` contains
|
| 146 |
+
native SM87 and SM110a code objects. Its SM110a path was validated on NVIDIA
|
| 147 |
+
Thor from the exact Hub-downloaded artifact over decode, DiT, vision, and
|
| 148 |
+
2K/4K video rows. The two per-token entry points were also compared directly
|
| 149 |
+
with their raw registered ops using A-B-B-A timing; all six wrapper/raw rows
|
| 150 |
+
were bit-exact and the measured ratio was `0.997-1.000`. SM87 runtime
|
| 151 |
+
validation remains pending on Jetson AGX Orin hardware.
|
build/torch213-cxx11-cu130-aarch64-linux/__init__.py
ADDED
|
@@ -0,0 +1,455 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""FlashRT adaptive LayerNorm producer kernels for DiT/Wan-style blocks."""
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
import torch
|
| 6 |
+
|
| 7 |
+
from ._ops import add_op_namespace_prefix, ops
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def _check_x(x: torch.Tensor) -> None:
|
| 11 |
+
if x.dim() != 2:
|
| 12 |
+
raise RuntimeError("x must have shape (rows, dim)")
|
| 13 |
+
if x.shape[1] % 2 != 0:
|
| 14 |
+
raise RuntimeError("x.shape[1] must be even")
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def _check_mod(x: torch.Tensor, scale: torch.Tensor, shift: torch.Tensor) -> None:
|
| 18 |
+
_check_x(x)
|
| 19 |
+
dim = x.shape[1]
|
| 20 |
+
if scale.shape != (dim,) or shift.shape != (dim,):
|
| 21 |
+
raise RuntimeError("scale and shift must have shape (dim,)")
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def _check_scalar(scale: torch.Tensor, name: str) -> None:
|
| 25 |
+
if scale.numel() != 1:
|
| 26 |
+
raise RuntimeError(f"{name} must be a scalar tensor")
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def swizzled_sf_size(rows: int, dim: int) -> int:
|
| 30 |
+
"""Return bytes required by the FlashRT/CUTLASS NVFP4 swizzled scale layout."""
|
| 31 |
+
|
| 32 |
+
if dim % 16 != 0:
|
| 33 |
+
raise RuntimeError("dim must be divisible by 16 for NVFP4 swizzled output")
|
| 34 |
+
n_blocks = dim // 16
|
| 35 |
+
n_row_super = (rows + 127) // 128
|
| 36 |
+
n_col_super = (n_blocks + 3) // 4
|
| 37 |
+
return n_row_super * n_col_super * 128 * 64
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def _alloc_fp8(x: torch.Tensor) -> torch.Tensor:
|
| 41 |
+
return torch.empty_like(x, dtype=torch.float8_e4m3fn)
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
def _alloc_nvfp4(x: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor]:
|
| 45 |
+
rows, dim = x.shape
|
| 46 |
+
packed = torch.empty((rows, dim // 2), device=x.device, dtype=torch.uint8)
|
| 47 |
+
sf = torch.zeros((swizzled_sf_size(rows, dim),), device=x.device, dtype=torch.uint8)
|
| 48 |
+
return packed, sf
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
@torch.library.register_fake(add_op_namespace_prefix("ada_layer_norm_quant_fp8_bf16"))
|
| 52 |
+
def _ada_layer_norm_quant_fp8_bf16_fake(
|
| 53 |
+
x: torch.Tensor,
|
| 54 |
+
scale: torch.Tensor,
|
| 55 |
+
shift: torch.Tensor,
|
| 56 |
+
act_scale: torch.Tensor,
|
| 57 |
+
eps: float,
|
| 58 |
+
out: torch.Tensor,
|
| 59 |
+
) -> None:
|
| 60 |
+
_check_mod(x, scale, shift)
|
| 61 |
+
_check_scalar(act_scale, "act_scale")
|
| 62 |
+
if out.shape != x.shape:
|
| 63 |
+
raise RuntimeError("out must have the same shape as x")
|
| 64 |
+
return None
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
@torch.library.register_fake(add_op_namespace_prefix("ada_layer_norm_quant_fp8_ptok_bf16"))
|
| 68 |
+
def _ada_layer_norm_quant_fp8_ptok_bf16_fake(
|
| 69 |
+
x: torch.Tensor,
|
| 70 |
+
scale: torch.Tensor,
|
| 71 |
+
shift: torch.Tensor,
|
| 72 |
+
act_scale: torch.Tensor,
|
| 73 |
+
eps: float,
|
| 74 |
+
out: torch.Tensor,
|
| 75 |
+
) -> None:
|
| 76 |
+
_check_x(x)
|
| 77 |
+
if scale.shape != x.shape or shift.shape != x.shape:
|
| 78 |
+
raise RuntimeError(
|
| 79 |
+
"per-token scale and shift must have shape (seq_len, dim)")
|
| 80 |
+
_check_scalar(act_scale, "act_scale")
|
| 81 |
+
if out.shape != x.shape:
|
| 82 |
+
raise RuntimeError("out must have the same shape as x")
|
| 83 |
+
return None
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
@torch.library.register_fake(add_op_namespace_prefix("ada_layer_norm_quant_fp8_ptok_table_bf16"))
|
| 87 |
+
def _ada_layer_norm_quant_fp8_ptok_table_bf16_fake(
|
| 88 |
+
x: torch.Tensor,
|
| 89 |
+
temb: torch.Tensor,
|
| 90 |
+
table: torch.Tensor,
|
| 91 |
+
act_scale: torch.Tensor,
|
| 92 |
+
shift_idx: int,
|
| 93 |
+
scale_idx: int,
|
| 94 |
+
eps: float,
|
| 95 |
+
out: torch.Tensor,
|
| 96 |
+
) -> None:
|
| 97 |
+
_check_x(x)
|
| 98 |
+
if temb.dim() != 3 or temb.shape[0] != x.shape[0] or temb.shape[2] != x.shape[1]:
|
| 99 |
+
raise RuntimeError("temb must have shape (seq_len, n_chunks, dim)")
|
| 100 |
+
if table.dim() != 2 or table.shape[0] != temb.shape[1] or table.shape[1] != x.shape[1]:
|
| 101 |
+
raise RuntimeError("table must have shape (n_chunks, dim)")
|
| 102 |
+
_check_scalar(act_scale, "act_scale")
|
| 103 |
+
if out.shape != x.shape:
|
| 104 |
+
raise RuntimeError("out must have the same shape as x")
|
| 105 |
+
return None
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
@torch.library.register_fake(add_op_namespace_prefix("ada_layer_norm_quant_fp8_modfp8_bf16"))
|
| 109 |
+
def _ada_layer_norm_quant_fp8_modfp8_bf16_fake(
|
| 110 |
+
x: torch.Tensor,
|
| 111 |
+
scale_fp8: torch.Tensor,
|
| 112 |
+
shift_fp8: torch.Tensor,
|
| 113 |
+
scale_deq: torch.Tensor,
|
| 114 |
+
shift_deq: torch.Tensor,
|
| 115 |
+
act_scale: torch.Tensor,
|
| 116 |
+
eps: float,
|
| 117 |
+
out: torch.Tensor,
|
| 118 |
+
) -> None:
|
| 119 |
+
_check_mod(x, scale_fp8, shift_fp8)
|
| 120 |
+
_check_scalar(scale_deq, "scale_deq")
|
| 121 |
+
_check_scalar(shift_deq, "shift_deq")
|
| 122 |
+
_check_scalar(act_scale, "act_scale")
|
| 123 |
+
if out.shape != x.shape:
|
| 124 |
+
raise RuntimeError("out must have the same shape as x")
|
| 125 |
+
return None
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
@torch.library.register_fake(add_op_namespace_prefix("awq_ada_layer_norm_quant_fp8_bf16"))
|
| 129 |
+
def _awq_ada_layer_norm_quant_fp8_bf16_fake(
|
| 130 |
+
x: torch.Tensor,
|
| 131 |
+
scale: torch.Tensor,
|
| 132 |
+
shift: torch.Tensor,
|
| 133 |
+
inv_s: torch.Tensor,
|
| 134 |
+
act_scale: torch.Tensor,
|
| 135 |
+
eps: float,
|
| 136 |
+
out: torch.Tensor,
|
| 137 |
+
) -> None:
|
| 138 |
+
_check_mod(x, scale, shift)
|
| 139 |
+
if inv_s.shape != (x.shape[1],):
|
| 140 |
+
raise RuntimeError("inv_s must have shape (dim,)")
|
| 141 |
+
_check_scalar(act_scale, "act_scale")
|
| 142 |
+
if out.shape != x.shape:
|
| 143 |
+
raise RuntimeError("out must have the same shape as x")
|
| 144 |
+
return None
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
@torch.library.register_fake(add_op_namespace_prefix("ada_layer_norm_quant_nvfp4_swizzled_bf16"))
|
| 148 |
+
def _ada_layer_norm_quant_nvfp4_swizzled_bf16_fake(
|
| 149 |
+
x: torch.Tensor,
|
| 150 |
+
scale: torch.Tensor,
|
| 151 |
+
shift: torch.Tensor,
|
| 152 |
+
eps: float,
|
| 153 |
+
packed: torch.Tensor,
|
| 154 |
+
sf_swizzled: torch.Tensor,
|
| 155 |
+
) -> None:
|
| 156 |
+
_check_mod(x, scale, shift)
|
| 157 |
+
rows, dim = x.shape
|
| 158 |
+
if packed.shape != (rows, dim // 2):
|
| 159 |
+
raise RuntimeError("packed must have shape (rows, dim // 2)")
|
| 160 |
+
if sf_swizzled.numel() < swizzled_sf_size(rows, dim):
|
| 161 |
+
raise RuntimeError("sf_swizzled is too small")
|
| 162 |
+
return None
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
@torch.library.register_fake(add_op_namespace_prefix("ada_layer_norm_quant_nvfp4_swizzled_modfp8_bf16"))
|
| 166 |
+
def _ada_layer_norm_quant_nvfp4_swizzled_modfp8_bf16_fake(
|
| 167 |
+
x: torch.Tensor,
|
| 168 |
+
scale_fp8: torch.Tensor,
|
| 169 |
+
shift_fp8: torch.Tensor,
|
| 170 |
+
scale_deq: torch.Tensor,
|
| 171 |
+
shift_deq: torch.Tensor,
|
| 172 |
+
eps: float,
|
| 173 |
+
packed: torch.Tensor,
|
| 174 |
+
sf_swizzled: torch.Tensor,
|
| 175 |
+
) -> None:
|
| 176 |
+
_check_mod(x, scale_fp8, shift_fp8)
|
| 177 |
+
_check_scalar(scale_deq, "scale_deq")
|
| 178 |
+
_check_scalar(shift_deq, "shift_deq")
|
| 179 |
+
rows, dim = x.shape
|
| 180 |
+
if packed.shape != (rows, dim // 2):
|
| 181 |
+
raise RuntimeError("packed must have shape (rows, dim // 2)")
|
| 182 |
+
if sf_swizzled.numel() < swizzled_sf_size(rows, dim):
|
| 183 |
+
raise RuntimeError("sf_swizzled is too small")
|
| 184 |
+
return None
|
| 185 |
+
|
| 186 |
+
|
| 187 |
+
@torch.library.register_fake(add_op_namespace_prefix("layer_norm_no_affine_quant_fp8_static_bf16"))
|
| 188 |
+
def _layer_norm_no_affine_quant_fp8_static_bf16_fake(
|
| 189 |
+
x: torch.Tensor,
|
| 190 |
+
act_scale: torch.Tensor,
|
| 191 |
+
eps: float,
|
| 192 |
+
out: torch.Tensor,
|
| 193 |
+
) -> None:
|
| 194 |
+
_check_x(x)
|
| 195 |
+
_check_scalar(act_scale, "act_scale")
|
| 196 |
+
if out.shape != x.shape:
|
| 197 |
+
raise RuntimeError("out must have the same shape as x")
|
| 198 |
+
return None
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
@torch.library.register_fake(add_op_namespace_prefix("layer_norm_no_affine_quant_nvfp4_swizzled_bf16"))
|
| 202 |
+
def _layer_norm_no_affine_quant_nvfp4_swizzled_bf16_fake(
|
| 203 |
+
x: torch.Tensor,
|
| 204 |
+
eps: float,
|
| 205 |
+
packed: torch.Tensor,
|
| 206 |
+
sf_swizzled: torch.Tensor,
|
| 207 |
+
) -> None:
|
| 208 |
+
_check_x(x)
|
| 209 |
+
rows, dim = x.shape
|
| 210 |
+
if packed.shape != (rows, dim // 2):
|
| 211 |
+
raise RuntimeError("packed must have shape (rows, dim // 2)")
|
| 212 |
+
if sf_swizzled.numel() < swizzled_sf_size(rows, dim):
|
| 213 |
+
raise RuntimeError("sf_swizzled is too small")
|
| 214 |
+
return None
|
| 215 |
+
|
| 216 |
+
|
| 217 |
+
def ada_layer_norm_quant_fp8_bf16(
|
| 218 |
+
x: torch.Tensor,
|
| 219 |
+
scale: torch.Tensor,
|
| 220 |
+
shift: torch.Tensor,
|
| 221 |
+
act_scale: torch.Tensor,
|
| 222 |
+
eps: float = 1e-5,
|
| 223 |
+
out: torch.Tensor | None = None,
|
| 224 |
+
) -> torch.Tensor:
|
| 225 |
+
"""Fused no-affine LayerNorm + AdaLN scale/shift + static FP8 quantize."""
|
| 226 |
+
|
| 227 |
+
if out is None:
|
| 228 |
+
out = _alloc_fp8(x)
|
| 229 |
+
ops.ada_layer_norm_quant_fp8_bf16(x, scale, shift, act_scale, float(eps), out)
|
| 230 |
+
return out
|
| 231 |
+
|
| 232 |
+
|
| 233 |
+
def ada_layer_norm_quant_fp8_ptok_bf16(
|
| 234 |
+
x: torch.Tensor,
|
| 235 |
+
scale: torch.Tensor,
|
| 236 |
+
shift: torch.Tensor,
|
| 237 |
+
act_scale: torch.Tensor,
|
| 238 |
+
eps: float = 1e-5,
|
| 239 |
+
out: torch.Tensor | None = None,
|
| 240 |
+
) -> torch.Tensor:
|
| 241 |
+
"""Per-token AdaLN producer: no-affine LayerNorm + [M, D] scale/shift
|
| 242 |
+
modulation + static FP8 quantize, one pass.
|
| 243 |
+
|
| 244 |
+
The per-token form serves hosts whose timestep embedding carries one
|
| 245 |
+
modulation vector per activation row (video DiTs with [B, S, 6, D]
|
| 246 |
+
tables); the broadcast form above cannot express that seam.
|
| 247 |
+
"""
|
| 248 |
+
|
| 249 |
+
if out is None:
|
| 250 |
+
out = _alloc_fp8(x)
|
| 251 |
+
ops.ada_layer_norm_quant_fp8_ptok_bf16(
|
| 252 |
+
x, scale, shift, act_scale, float(eps), out)
|
| 253 |
+
return out
|
| 254 |
+
|
| 255 |
+
|
| 256 |
+
def ada_layer_norm_quant_fp8_ptok_table_bf16(
|
| 257 |
+
x: torch.Tensor,
|
| 258 |
+
temb: torch.Tensor,
|
| 259 |
+
table: torch.Tensor,
|
| 260 |
+
act_scale: torch.Tensor,
|
| 261 |
+
shift_idx: int,
|
| 262 |
+
scale_idx: int,
|
| 263 |
+
eps: float = 1e-5,
|
| 264 |
+
out: torch.Tensor | None = None,
|
| 265 |
+
) -> torch.Tensor:
|
| 266 |
+
"""Per-token AdaLN producer, table form.
|
| 267 |
+
|
| 268 |
+
``temb`` is the host's per-token modulation embedding
|
| 269 |
+
``[seq_len, n_chunks, dim]`` (cast to BF16 once per call) and
|
| 270 |
+
``table`` the block's own ``[n_chunks, dim]`` FP32 modulation
|
| 271 |
+
parameter. The table add, chunk selection, no-affine LayerNorm,
|
| 272 |
+
modulation and static FP8 quantize all happen in one pass — the
|
| 273 |
+
per-block six-chunk materialization the host would otherwise pay
|
| 274 |
+
never exists.
|
| 275 |
+
"""
|
| 276 |
+
|
| 277 |
+
if out is None:
|
| 278 |
+
out = _alloc_fp8(x)
|
| 279 |
+
ops.ada_layer_norm_quant_fp8_ptok_table_bf16(
|
| 280 |
+
x, temb, table, act_scale, int(shift_idx), int(scale_idx),
|
| 281 |
+
float(eps), out)
|
| 282 |
+
return out
|
| 283 |
+
|
| 284 |
+
|
| 285 |
+
def ada_layer_norm_quant_fp8_modfp8_bf16(
|
| 286 |
+
x: torch.Tensor,
|
| 287 |
+
scale_fp8: torch.Tensor,
|
| 288 |
+
shift_fp8: torch.Tensor,
|
| 289 |
+
scale_deq: torch.Tensor,
|
| 290 |
+
shift_deq: torch.Tensor,
|
| 291 |
+
act_scale: torch.Tensor,
|
| 292 |
+
eps: float = 1e-5,
|
| 293 |
+
out: torch.Tensor | None = None,
|
| 294 |
+
) -> torch.Tensor:
|
| 295 |
+
"""Fused AdaLN producer when modulation vectors are stored in FP8."""
|
| 296 |
+
|
| 297 |
+
if out is None:
|
| 298 |
+
out = _alloc_fp8(x)
|
| 299 |
+
ops.ada_layer_norm_quant_fp8_modfp8_bf16(
|
| 300 |
+
x, scale_fp8, shift_fp8, scale_deq, shift_deq, act_scale, float(eps), out
|
| 301 |
+
)
|
| 302 |
+
return out
|
| 303 |
+
|
| 304 |
+
|
| 305 |
+
def awq_ada_layer_norm_quant_fp8_bf16(
|
| 306 |
+
x: torch.Tensor,
|
| 307 |
+
scale: torch.Tensor,
|
| 308 |
+
shift: torch.Tensor,
|
| 309 |
+
inv_s: torch.Tensor,
|
| 310 |
+
act_scale: torch.Tensor,
|
| 311 |
+
eps: float = 1e-5,
|
| 312 |
+
out: torch.Tensor | None = None,
|
| 313 |
+
) -> torch.Tensor:
|
| 314 |
+
"""Fused AdaLN producer with AWQ/SmoothQuant per-channel activation scale."""
|
| 315 |
+
|
| 316 |
+
if out is None:
|
| 317 |
+
out = _alloc_fp8(x)
|
| 318 |
+
ops.awq_ada_layer_norm_quant_fp8_bf16(x, scale, shift, inv_s, act_scale, float(eps), out)
|
| 319 |
+
return out
|
| 320 |
+
|
| 321 |
+
|
| 322 |
+
def ada_layer_norm_quant_nvfp4_swizzled_bf16(
|
| 323 |
+
x: torch.Tensor,
|
| 324 |
+
scale: torch.Tensor,
|
| 325 |
+
shift: torch.Tensor,
|
| 326 |
+
eps: float = 1e-5,
|
| 327 |
+
packed: torch.Tensor | None = None,
|
| 328 |
+
sf_swizzled: torch.Tensor | None = None,
|
| 329 |
+
) -> tuple[torch.Tensor, torch.Tensor]:
|
| 330 |
+
"""Fused AdaLN producer to NVFP4 packed activations and swizzled scale factors."""
|
| 331 |
+
|
| 332 |
+
if packed is None or sf_swizzled is None:
|
| 333 |
+
packed, sf_swizzled = _alloc_nvfp4(x)
|
| 334 |
+
ops.ada_layer_norm_quant_nvfp4_swizzled_bf16(x, scale, shift, float(eps), packed, sf_swizzled)
|
| 335 |
+
return packed, sf_swizzled
|
| 336 |
+
|
| 337 |
+
|
| 338 |
+
def ada_layer_norm_quant_nvfp4_swizzled_modfp8_bf16(
|
| 339 |
+
x: torch.Tensor,
|
| 340 |
+
scale_fp8: torch.Tensor,
|
| 341 |
+
shift_fp8: torch.Tensor,
|
| 342 |
+
scale_deq: torch.Tensor,
|
| 343 |
+
shift_deq: torch.Tensor,
|
| 344 |
+
eps: float = 1e-5,
|
| 345 |
+
packed: torch.Tensor | None = None,
|
| 346 |
+
sf_swizzled: torch.Tensor | None = None,
|
| 347 |
+
) -> tuple[torch.Tensor, torch.Tensor]:
|
| 348 |
+
"""Fused FP8-modulated AdaLN producer to NVFP4 packed activations."""
|
| 349 |
+
|
| 350 |
+
if packed is None or sf_swizzled is None:
|
| 351 |
+
packed, sf_swizzled = _alloc_nvfp4(x)
|
| 352 |
+
ops.ada_layer_norm_quant_nvfp4_swizzled_modfp8_bf16(
|
| 353 |
+
x, scale_fp8, shift_fp8, scale_deq, shift_deq, float(eps), packed, sf_swizzled
|
| 354 |
+
)
|
| 355 |
+
return packed, sf_swizzled
|
| 356 |
+
|
| 357 |
+
|
| 358 |
+
def layer_norm_no_affine_quant_fp8_static_bf16(
|
| 359 |
+
x: torch.Tensor,
|
| 360 |
+
act_scale: torch.Tensor,
|
| 361 |
+
eps: float = 1e-5,
|
| 362 |
+
out: torch.Tensor | None = None,
|
| 363 |
+
) -> torch.Tensor:
|
| 364 |
+
"""Fused no-affine LayerNorm + static FP8 quantize."""
|
| 365 |
+
|
| 366 |
+
if out is None:
|
| 367 |
+
out = _alloc_fp8(x)
|
| 368 |
+
ops.layer_norm_no_affine_quant_fp8_static_bf16(x, act_scale, float(eps), out)
|
| 369 |
+
return out
|
| 370 |
+
|
| 371 |
+
|
| 372 |
+
def layer_norm_no_affine_quant_nvfp4_swizzled_bf16(
|
| 373 |
+
x: torch.Tensor,
|
| 374 |
+
eps: float = 1e-5,
|
| 375 |
+
packed: torch.Tensor | None = None,
|
| 376 |
+
sf_swizzled: torch.Tensor | None = None,
|
| 377 |
+
) -> tuple[torch.Tensor, torch.Tensor]:
|
| 378 |
+
"""SM110 no-affine LayerNorm producing NVFP4 and CUTLASS SFA."""
|
| 379 |
+
if packed is None or sf_swizzled is None:
|
| 380 |
+
packed, sf_swizzled = _alloc_nvfp4(x)
|
| 381 |
+
ops.layer_norm_no_affine_quant_nvfp4_swizzled_bf16(
|
| 382 |
+
x, float(eps), packed, sf_swizzled
|
| 383 |
+
)
|
| 384 |
+
return packed, sf_swizzled
|
| 385 |
+
|
| 386 |
+
|
| 387 |
+
@torch.library.register_fake(add_op_namespace_prefix("adaln_modulation6_bf16"))
|
| 388 |
+
def _adaln_modulation6_bf16_fake(
|
| 389 |
+
adaln_params: torch.Tensor,
|
| 390 |
+
layer_modulation: torch.Tensor,
|
| 391 |
+
out0: torch.Tensor,
|
| 392 |
+
out1: torch.Tensor,
|
| 393 |
+
out2: torch.Tensor,
|
| 394 |
+
out3: torch.Tensor,
|
| 395 |
+
out4: torch.Tensor,
|
| 396 |
+
out5: torch.Tensor,
|
| 397 |
+
) -> None:
|
| 398 |
+
if adaln_params.dim() != 4 or adaln_params.shape[2] != 6:
|
| 399 |
+
raise RuntimeError(
|
| 400 |
+
"adaln_params must have shape (batch, sequence, 6, dim)"
|
| 401 |
+
)
|
| 402 |
+
expected = (
|
| 403 |
+
adaln_params.shape[0],
|
| 404 |
+
adaln_params.shape[1],
|
| 405 |
+
adaln_params.shape[3],
|
| 406 |
+
)
|
| 407 |
+
if layer_modulation.shape != (6, expected[2]):
|
| 408 |
+
raise RuntimeError("layer_modulation must have shape (6, dim)")
|
| 409 |
+
for output in (out0, out1, out2, out3, out4, out5):
|
| 410 |
+
if output.shape != expected:
|
| 411 |
+
raise RuntimeError(
|
| 412 |
+
"each output must have shape (batch, sequence, dim)"
|
| 413 |
+
)
|
| 414 |
+
return None
|
| 415 |
+
|
| 416 |
+
|
| 417 |
+
def adaln_modulation6_bf16(
|
| 418 |
+
adaln_params: torch.Tensor,
|
| 419 |
+
layer_modulation: torch.Tensor,
|
| 420 |
+
*,
|
| 421 |
+
out: tuple[torch.Tensor, ...] | None = None,
|
| 422 |
+
) -> tuple[torch.Tensor, ...]:
|
| 423 |
+
"""Add six FP32 AdaLN modulation vectors and return six BF16 tensors."""
|
| 424 |
+
|
| 425 |
+
batch, sequence, _, dim = adaln_params.shape
|
| 426 |
+
if out is None:
|
| 427 |
+
out = tuple(
|
| 428 |
+
torch.empty(
|
| 429 |
+
(batch, sequence, dim),
|
| 430 |
+
device=adaln_params.device,
|
| 431 |
+
dtype=torch.bfloat16,
|
| 432 |
+
)
|
| 433 |
+
for _ in range(6)
|
| 434 |
+
)
|
| 435 |
+
if len(out) != 6:
|
| 436 |
+
raise RuntimeError("out must contain six tensors")
|
| 437 |
+
ops.adaln_modulation6_bf16(
|
| 438 |
+
adaln_params, layer_modulation, *out
|
| 439 |
+
)
|
| 440 |
+
return out
|
| 441 |
+
|
| 442 |
+
|
| 443 |
+
__all__ = [
|
| 444 |
+
"ada_layer_norm_quant_fp8_bf16",
|
| 445 |
+
"ada_layer_norm_quant_fp8_ptok_bf16",
|
| 446 |
+
"ada_layer_norm_quant_fp8_ptok_table_bf16",
|
| 447 |
+
"ada_layer_norm_quant_fp8_modfp8_bf16",
|
| 448 |
+
"awq_ada_layer_norm_quant_fp8_bf16",
|
| 449 |
+
"ada_layer_norm_quant_nvfp4_swizzled_bf16",
|
| 450 |
+
"ada_layer_norm_quant_nvfp4_swizzled_modfp8_bf16",
|
| 451 |
+
"layer_norm_no_affine_quant_fp8_static_bf16",
|
| 452 |
+
"layer_norm_no_affine_quant_nvfp4_swizzled_bf16",
|
| 453 |
+
"adaln_modulation6_bf16",
|
| 454 |
+
"swizzled_sf_size",
|
| 455 |
+
]
|
build/torch213-cxx11-cu130-aarch64-linux/_adaptive_layernorm_producers_cuda_8a66d8b.abi3.so
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b7a2db2e007dbc80da262c206891058c7db8c1c7f249b92ad6185c1ce11b814f
|
| 3 |
+
size 535776
|
build/torch213-cxx11-cu130-aarch64-linux/_ops.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from . import _adaptive_layernorm_producers_cuda_8a66d8b
|
| 3 |
+
ops = torch.ops._adaptive_layernorm_producers_cuda_8a66d8b
|
| 4 |
+
|
| 5 |
+
def add_op_namespace_prefix(op_name: str):
|
| 6 |
+
return f"_adaptive_layernorm_producers_cuda_8a66d8b::{op_name}"
|
build/torch213-cxx11-cu130-aarch64-linux/adaptive_layernorm_producers/__init__.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import ctypes
|
| 2 |
+
import importlib.util
|
| 3 |
+
import sys
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
|
| 6 |
+
def _import_from_path(file_path: Path):
|
| 7 |
+
path_hash = '{:x}'.format(ctypes.c_size_t(hash(file_path.absolute())).value)
|
| 8 |
+
spec = importlib.util.spec_from_file_location(path_hash, file_path)
|
| 9 |
+
module = importlib.util.module_from_spec(spec)
|
| 10 |
+
sys.modules[path_hash] = module
|
| 11 |
+
spec.loader.exec_module(module)
|
| 12 |
+
return module
|
| 13 |
+
|
| 14 |
+
globals().update(vars(_import_from_path(Path(__file__).parent.parent / '__init__.py')))
|
build/torch213-cxx11-cu130-aarch64-linux/metadata.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "adaptive-layernorm-producers",
|
| 3 |
+
"id": "_adaptive_layernorm_producers_cuda_8a66d8b",
|
| 4 |
+
"version": 1,
|
| 5 |
+
"license": "Apache-2.0",
|
| 6 |
+
"python-depends": [],
|
| 7 |
+
"backend": {
|
| 8 |
+
"type": "cuda",
|
| 9 |
+
"archs": [
|
| 10 |
+
"11.0a"
|
| 11 |
+
]
|
| 12 |
+
},
|
| 13 |
+
"digest": {
|
| 14 |
+
"algorithm": "sha256",
|
| 15 |
+
"files": {
|
| 16 |
+
"__init__.py": "/6Ld6WSyL7PjILcYt4P7x3fnXi2C+ovbSP/7nNFetb8=",
|
| 17 |
+
"_adaptive_layernorm_producers_cuda_8a66d8b.abi3.so": "t6LbLgB9vIDaJiwgaJEFjH24wcfySbkq1hhcHOEbgU8=",
|
| 18 |
+
"_ops.py": "8CjL8CxdQouAOnaox+O0AKwLERGSDc8mao+V3ArMuTk=",
|
| 19 |
+
"adaptive_layernorm_producers/__init__.py": "v6p5XMfQzddhi1fLSAw4HX9CyS0rQsidvu9VsT01xi4="
|
| 20 |
+
}
|
| 21 |
+
},
|
| 22 |
+
"provenance": {
|
| 23 |
+
"kernel": {
|
| 24 |
+
"sha": "8a66d8b",
|
| 25 |
+
"dirty": false
|
| 26 |
+
}
|
| 27 |
+
}
|
| 28 |
+
}
|