Remove invalid relabeled torch213 artifact
Browse files- build/torch213-cxx11-cu130-aarch64-linux/__init__.py +0 -455
- build/torch213-cxx11-cu130-aarch64-linux/_adaptive_layernorm_producers_cuda_8a66d8b.abi3.so +0 -3
- build/torch213-cxx11-cu130-aarch64-linux/_ops.py +0 -6
- build/torch213-cxx11-cu130-aarch64-linux/adaptive_layernorm_producers/__init__.py +0 -14
- build/torch213-cxx11-cu130-aarch64-linux/metadata.json +0 -28
build/torch213-cxx11-cu130-aarch64-linux/__init__.py
DELETED
|
@@ -1,455 +0,0 @@
|
|
| 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 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
build/torch213-cxx11-cu130-aarch64-linux/_adaptive_layernorm_producers_cuda_8a66d8b.abi3.so
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:b7a2db2e007dbc80da262c206891058c7db8c1c7f249b92ad6185c1ce11b814f
|
| 3 |
-
size 535776
|
|
|
|
|
|
|
|
|
|
|
|
build/torch213-cxx11-cu130-aarch64-linux/_ops.py
DELETED
|
@@ -1,6 +0,0 @@
|
|
| 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
DELETED
|
@@ -1,14 +0,0 @@
|
|
| 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
DELETED
|
@@ -1,28 +0,0 @@
|
|
| 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 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|