liangsu9988 commited on
Commit
751c440
·
verified ·
1 Parent(s): 3465882

Add torch213-cxx11-cu130-aarch64-linux artifact

Browse files
build/torch213-cxx11-cu130-aarch64-linux/__init__.py ADDED
@@ -0,0 +1,430 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """FlashRT world-model convolution kernels."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Optional
6
+
7
+ import torch
8
+
9
+ from ._ops import add_op_namespace_prefix, ops
10
+
11
+
12
+ @torch.library.register_fake(
13
+ add_op_namespace_prefix("bf16_causal_conv3d_ndhwc_bf16")
14
+ )
15
+ def _bf16_causal_conv3d_fake(cache_x, new_x, weight, bias, alpha, out) -> None:
16
+ n, t, h, w, ci = new_x.shape
17
+ co = weight.shape[0]
18
+ if cache_x.shape != (n, 2, h, w, ci):
19
+ raise RuntimeError("cache_x must have shape (N,2,H,W,Ci)")
20
+ if weight.shape != (co, 3, 3, 3, ci):
21
+ raise RuntimeError("weight must have shape (Co,3,3,3,Ci)")
22
+ if bias.shape != (co,) or out.shape != (n, t, h, w, co):
23
+ raise RuntimeError("bias/out shape mismatch")
24
+ return None
25
+
26
+
27
+ @torch.library.register_fake(add_op_namespace_prefix("fp8_conv3d_v18_ncdhw_res_bf16out"))
28
+ def _fp8_conv3d_fake(
29
+ cache_x: torch.Tensor,
30
+ new_x: torch.Tensor,
31
+ weight: torch.Tensor,
32
+ bias: torch.Tensor,
33
+ residual: torch.Tensor,
34
+ alpha: float,
35
+ out: torch.Tensor,
36
+ ) -> None:
37
+ if cache_x.dim() != 5 or new_x.dim() != 5:
38
+ raise RuntimeError("cache_x/new_x must be NDHWC")
39
+ n, t_new, h, w, ci = new_x.shape
40
+ co = weight.shape[0]
41
+ if cache_x.shape != (n, 2, h, w, ci):
42
+ raise RuntimeError("cache_x must have shape (N,2,H,W,Ci)")
43
+ if weight.shape != (co, 3, 3, 3, ci):
44
+ raise RuntimeError("weight must have shape (Co,3,3,3,Ci)")
45
+ if ci not in (32, 64):
46
+ raise RuntimeError(
47
+ "FP8 Conv3D is accepted only for Ci=32/64; use the "
48
+ "strong-library or NVFP4 path for larger channels"
49
+ )
50
+ if residual.shape != (n, co, t_new, h, w) or out.shape != residual.shape:
51
+ raise RuntimeError("residual/out must be NCDHW")
52
+ if bias.shape != (co,):
53
+ raise RuntimeError("bias must have shape (Co,)")
54
+ return None
55
+
56
+
57
+ @torch.library.register_fake(
58
+ add_op_namespace_prefix("fp8_causal_conv3d_ndhwc_bf16")
59
+ )
60
+ def _fp8_causal_conv3d_fake(
61
+ cache_x: torch.Tensor,
62
+ new_x: torch.Tensor,
63
+ weight: torch.Tensor,
64
+ bias: torch.Tensor,
65
+ alpha: float,
66
+ out: torch.Tensor,
67
+ ) -> None:
68
+ if cache_x.dim() != 5 or new_x.dim() != 5:
69
+ raise RuntimeError("cache_x/new_x must be NDHWC")
70
+ n, t, h, w, ci = new_x.shape
71
+ co = weight.shape[0]
72
+ if cache_x.shape != (n, 2, h, w, ci):
73
+ raise RuntimeError("cache_x must have shape (N,2,H,W,Ci)")
74
+ if weight.shape != (co, 3, 3, 3, ci):
75
+ raise RuntimeError("weight must have shape (Co,3,3,3,Ci)")
76
+ if ci not in (32, 64):
77
+ raise RuntimeError(
78
+ "FP8 Conv3D is accepted only for Ci=32/64; use the "
79
+ "strong-library or NVFP4 path for larger channels"
80
+ )
81
+ if bias.shape != (co,) or out.shape != (n, t, h, w, co):
82
+ raise RuntimeError("bias/out shape mismatch")
83
+ return None
84
+
85
+
86
+ @torch.library.register_fake(
87
+ add_op_namespace_prefix("fp8_conv2d_3x3_nhwc_bf16")
88
+ )
89
+ def _fp8_conv2d_fake(
90
+ input: torch.Tensor,
91
+ weight: torch.Tensor,
92
+ bias: torch.Tensor,
93
+ alpha: float,
94
+ out: torch.Tensor,
95
+ ) -> None:
96
+ if input.dim() != 4:
97
+ raise RuntimeError("input must have shape (N,H,W,Ci)")
98
+ n, h, w, ci = input.shape
99
+ co = weight.shape[0]
100
+ if weight.shape != (co, 3, 3, ci):
101
+ raise RuntimeError("weight must have shape (Co,3,3,Ci)")
102
+ if bias.shape != (co,) or out.shape != (n, h, w, co):
103
+ raise RuntimeError("bias/out shape mismatch")
104
+ return None
105
+
106
+
107
+ @torch.library.register_fake(
108
+ add_op_namespace_prefix("fp8_conv2d_3x3_ncdhw_bf16")
109
+ )
110
+ def _fp8_conv2d_ncdhw_fake(
111
+ input: torch.Tensor,
112
+ weight: torch.Tensor,
113
+ bias: torch.Tensor,
114
+ alpha: float,
115
+ out: torch.Tensor,
116
+ ) -> None:
117
+ if input.dim() != 5:
118
+ raise RuntimeError("input must have shape (B,T,H,W,Ci)")
119
+ b, t, h, w, ci = input.shape
120
+ co = weight.shape[0]
121
+ if weight.shape != (co, 3, 3, ci):
122
+ raise RuntimeError("weight must have shape (Co,3,3,Ci)")
123
+ if bias.shape != (co,) or out.shape != (b, co, t, h, w):
124
+ raise RuntimeError("bias/out shape mismatch")
125
+ return None
126
+
127
+
128
+ def _check_nvfp4_conv_shapes(
129
+ cache_packed: torch.Tensor,
130
+ new_packed: torch.Tensor,
131
+ weight_packed: torch.Tensor,
132
+ cache_sf: torch.Tensor,
133
+ new_sf: torch.Tensor,
134
+ weight_sf: torch.Tensor,
135
+ bias: torch.Tensor,
136
+ outer_weight: torch.Tensor | None,
137
+ ) -> tuple[int, int, int, int, int]:
138
+ if (
139
+ cache_packed.dim() != 5
140
+ or new_packed.dim() != 5
141
+ or weight_packed.dim() != 5
142
+ ):
143
+ raise RuntimeError("packed inputs must be five-dimensional")
144
+ n, t, h, w, ci_half = new_packed.shape
145
+ ci = ci_half * 2
146
+ co = weight_packed.shape[0]
147
+ if (
148
+ (ci != 64 and ci % 128 != 0)
149
+ or co % 8 != 0
150
+ or cache_packed.shape != (n, 2, h, w, ci // 2)
151
+ or weight_packed.shape != (co, 3, 3, 3, ci // 2)
152
+ or cache_sf.shape != (n, 2, h, w, ci // 16)
153
+ or new_sf.shape != (n, t, h, w, ci // 16)
154
+ or weight_sf.shape != (co, 3, 3, 3, ci // 16)
155
+ or bias.shape != (co,)
156
+ or (outer_weight is not None and outer_weight.shape != (co,))
157
+ ):
158
+ raise RuntimeError(
159
+ "NVFP4 Conv3D accepts Ci=64 or multiples of 128; "
160
+ "other shapes must use the strong-library path"
161
+ )
162
+ return n, t, h, w, co
163
+
164
+
165
+ @torch.library.register_fake(
166
+ add_op_namespace_prefix("nvfp4_causal_conv3d_ndhwc_bf16")
167
+ )
168
+ def _nvfp4_causal_conv3d_fake(
169
+ cache_packed: torch.Tensor,
170
+ new_packed: torch.Tensor,
171
+ weight_packed: torch.Tensor,
172
+ cache_sf: torch.Tensor,
173
+ new_sf: torch.Tensor,
174
+ weight_sf: torch.Tensor,
175
+ bias: torch.Tensor,
176
+ outer_weight: torch.Tensor | None,
177
+ alpha: float,
178
+ out: torch.Tensor,
179
+ ) -> None:
180
+ del alpha
181
+ n, t, h, w, co = _check_nvfp4_conv_shapes(
182
+ cache_packed,
183
+ new_packed,
184
+ weight_packed,
185
+ cache_sf,
186
+ new_sf,
187
+ weight_sf,
188
+ bias,
189
+ outer_weight,
190
+ )
191
+ if out.shape != (n, t, h, w, co):
192
+ raise RuntimeError("out must have shape (N,T,H,W,Co)")
193
+ return None
194
+
195
+
196
+ @torch.library.register_fake(
197
+ add_op_namespace_prefix(
198
+ "nvfp4_causal_conv3d_residual_ncdhw_bf16"
199
+ )
200
+ )
201
+ def _nvfp4_causal_conv3d_residual_fake(
202
+ cache_packed: torch.Tensor,
203
+ new_packed: torch.Tensor,
204
+ weight_packed: torch.Tensor,
205
+ cache_sf: torch.Tensor,
206
+ new_sf: torch.Tensor,
207
+ weight_sf: torch.Tensor,
208
+ bias: torch.Tensor,
209
+ residual: torch.Tensor,
210
+ outer_weight: torch.Tensor | None,
211
+ alpha: float,
212
+ out: torch.Tensor,
213
+ ) -> None:
214
+ del alpha
215
+ n, t, h, w, co = _check_nvfp4_conv_shapes(
216
+ cache_packed,
217
+ new_packed,
218
+ weight_packed,
219
+ cache_sf,
220
+ new_sf,
221
+ weight_sf,
222
+ bias,
223
+ outer_weight,
224
+ )
225
+ if residual.shape != (n, co, t, h, w) or out.shape != residual.shape:
226
+ raise RuntimeError("residual/out must have shape (N,Co,T,H,W)")
227
+ return None
228
+
229
+
230
+ def fp8_conv3d_v18_ncdhw_res_bf16out(
231
+ cache_x: torch.Tensor,
232
+ new_x: torch.Tensor,
233
+ weight: torch.Tensor,
234
+ bias: torch.Tensor,
235
+ residual: torch.Tensor,
236
+ alpha: float = 1.0,
237
+ *,
238
+ out: Optional[torch.Tensor] = None,
239
+ ) -> torch.Tensor:
240
+ """FP8 3D causal conv with virtual cache concat, bias, residual, BF16 NCDHW output."""
241
+
242
+ n, t_new, h, w, _ = new_x.shape
243
+ co = weight.shape[0]
244
+ if out is None:
245
+ out = torch.empty((n, co, t_new, h, w), device=new_x.device, dtype=torch.bfloat16)
246
+ ops.fp8_conv3d_v18_ncdhw_res_bf16out(cache_x, new_x, weight, bias, residual, float(alpha), out)
247
+ return out
248
+
249
+
250
+ def bf16_causal_conv3d_ndhwc_bf16(
251
+ cache_x: torch.Tensor,
252
+ new_x: torch.Tensor,
253
+ weight: torch.Tensor,
254
+ bias: torch.Tensor,
255
+ alpha: float = 1.0,
256
+ *,
257
+ out: Optional[torch.Tensor] = None,
258
+ ) -> torch.Tensor:
259
+ """Experimental SM110 BF16 causal Conv3D probe.
260
+
261
+ This entry is explicit opt-in. It is not the default world-model Conv3D
262
+ backend because the current native kernel does not beat cuDNN.
263
+ """
264
+ n, t, h, w, _ = new_x.shape
265
+ if out is None:
266
+ out = torch.empty(
267
+ (n, t, h, w, weight.shape[0]),
268
+ device=new_x.device,
269
+ dtype=torch.bfloat16,
270
+ )
271
+ ops.bf16_causal_conv3d_ndhwc_bf16(
272
+ cache_x, new_x, weight, bias, float(alpha), out
273
+ )
274
+ return out
275
+
276
+
277
+ def fp8_causal_conv3d_ndhwc_bf16(
278
+ cache_x: torch.Tensor,
279
+ new_x: torch.Tensor,
280
+ weight: torch.Tensor,
281
+ bias: torch.Tensor,
282
+ alpha: float = 1.0,
283
+ *,
284
+ out: Optional[torch.Tensor] = None,
285
+ ) -> torch.Tensor:
286
+ """FP8 causal 3D convolution with virtual two-frame cache concat."""
287
+
288
+ n, t, h, w, _ = new_x.shape
289
+ if out is None:
290
+ out = torch.empty(
291
+ (n, t, h, w, weight.shape[0]),
292
+ device=new_x.device,
293
+ dtype=torch.bfloat16,
294
+ )
295
+ ops.fp8_causal_conv3d_ndhwc_bf16(
296
+ cache_x, new_x, weight, bias, float(alpha), out
297
+ )
298
+ return out
299
+
300
+
301
+ def fp8_conv2d_3x3_nhwc_bf16(
302
+ input: torch.Tensor,
303
+ weight: torch.Tensor,
304
+ bias: torch.Tensor,
305
+ alpha: float = 1.0,
306
+ *,
307
+ out: Optional[torch.Tensor] = None,
308
+ ) -> torch.Tensor:
309
+ """FP8 3x3 Conv2D with NHWC input/output and BF16 epilogue."""
310
+
311
+ if out is None:
312
+ out = torch.empty(
313
+ (*input.shape[:3], weight.shape[0]),
314
+ device=input.device,
315
+ dtype=torch.bfloat16,
316
+ )
317
+ ops.fp8_conv2d_3x3_nhwc_bf16(
318
+ input, weight, bias, float(alpha), out
319
+ )
320
+ return out
321
+
322
+
323
+ def fp8_conv2d_3x3_ncdhw_bf16(
324
+ input: torch.Tensor,
325
+ weight: torch.Tensor,
326
+ bias: torch.Tensor,
327
+ alpha: float = 1.0,
328
+ *,
329
+ out: Optional[torch.Tensor] = None,
330
+ ) -> torch.Tensor:
331
+ """FP8 3x3 Conv2D over B*T frames with direct BF16 NCDHW output."""
332
+
333
+ if out is None:
334
+ out = torch.empty(
335
+ (
336
+ input.shape[0],
337
+ weight.shape[0],
338
+ input.shape[1],
339
+ input.shape[2],
340
+ input.shape[3],
341
+ ),
342
+ device=input.device,
343
+ dtype=torch.bfloat16,
344
+ )
345
+ ops.fp8_conv2d_3x3_ncdhw_bf16(
346
+ input, weight, bias, float(alpha), out
347
+ )
348
+ return out
349
+
350
+
351
+ def nvfp4_causal_conv3d_ndhwc_bf16(
352
+ cache_packed: torch.Tensor,
353
+ new_packed: torch.Tensor,
354
+ weight_packed: torch.Tensor,
355
+ cache_sf: torch.Tensor,
356
+ new_sf: torch.Tensor,
357
+ weight_sf: torch.Tensor,
358
+ bias: torch.Tensor,
359
+ outer_weight: torch.Tensor | None = None,
360
+ alpha: float = 1.0,
361
+ *,
362
+ out: Optional[torch.Tensor] = None,
363
+ ) -> torch.Tensor:
364
+ """NVFP4 causal Conv3D with linear UE4M3 scale factors and BF16 NDHWC output."""
365
+
366
+ n, t, h, w, _ = new_packed.shape
367
+ if out is None:
368
+ out = torch.empty(
369
+ (n, t, h, w, weight_packed.shape[0]),
370
+ device=new_packed.device,
371
+ dtype=torch.bfloat16,
372
+ )
373
+ ops.nvfp4_causal_conv3d_ndhwc_bf16(
374
+ cache_packed,
375
+ new_packed,
376
+ weight_packed,
377
+ cache_sf,
378
+ new_sf,
379
+ weight_sf,
380
+ bias,
381
+ outer_weight,
382
+ float(alpha),
383
+ out,
384
+ )
385
+ return out
386
+
387
+
388
+ def nvfp4_causal_conv3d_residual_ncdhw_bf16(
389
+ cache_packed: torch.Tensor,
390
+ new_packed: torch.Tensor,
391
+ weight_packed: torch.Tensor,
392
+ cache_sf: torch.Tensor,
393
+ new_sf: torch.Tensor,
394
+ weight_sf: torch.Tensor,
395
+ bias: torch.Tensor,
396
+ residual: torch.Tensor,
397
+ outer_weight: torch.Tensor | None = None,
398
+ alpha: float = 1.0,
399
+ *,
400
+ out: Optional[torch.Tensor] = None,
401
+ ) -> torch.Tensor:
402
+ """NVFP4 causal Conv3D with fused bias, residual, and BF16 NCDHW output."""
403
+
404
+ if out is None:
405
+ out = torch.empty_like(residual)
406
+ ops.nvfp4_causal_conv3d_residual_ncdhw_bf16(
407
+ cache_packed,
408
+ new_packed,
409
+ weight_packed,
410
+ cache_sf,
411
+ new_sf,
412
+ weight_sf,
413
+ bias,
414
+ residual,
415
+ outer_weight,
416
+ float(alpha),
417
+ out,
418
+ )
419
+ return out
420
+
421
+
422
+ __all__ = [
423
+ "bf16_causal_conv3d_ndhwc_bf16",
424
+ "fp8_conv3d_v18_ncdhw_res_bf16out",
425
+ "fp8_causal_conv3d_ndhwc_bf16",
426
+ "fp8_conv2d_3x3_nhwc_bf16",
427
+ "fp8_conv2d_3x3_ncdhw_bf16",
428
+ "nvfp4_causal_conv3d_ndhwc_bf16",
429
+ "nvfp4_causal_conv3d_residual_ncdhw_bf16",
430
+ ]
build/torch213-cxx11-cu130-aarch64-linux/_ops.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ import torch
2
+ from . import world_model_conv_test
3
+ ops = torch.ops.world_model_conv_test
4
+
5
+ def add_op_namespace_prefix(op_name: str):
6
+ return f"world_model_conv_test::{op_name}"
build/torch213-cxx11-cu130-aarch64-linux/metadata.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "world-model-conv",
3
+ "id": "world_model_conv_test",
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": "04caWU2syFAi2nTxD3Utrqn/ihEMR0PWAdr/Leh+wG8=",
17
+ "world_model_conv_test.abi3.so": "Qr5H/prvxbsSRNzdmlXzJT69F75XvSkirGaGMWgg1u4=",
18
+ "_ops.py": "xNoPbc5GjPFmOOVKvHN2Z3c414ISLzosGRA1UyvDsLc=",
19
+ "world_model_conv/__init__.py": "v6p5XMfQzddhi1fLSAw4HX9CyS0rQsidvu9VsT01xi4="
20
+ }
21
+ },
22
+ "provenance": {
23
+ "kernel": {
24
+ "sha": "456d297",
25
+ "dirty": false
26
+ },
27
+ "validation": {
28
+ "torch": "2.13.0+cu130",
29
+ "cuda": "13.0"
30
+ }
31
+ }
32
+ }
build/torch213-cxx11-cu130-aarch64-linux/world_model_conv/__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/world_model_conv_test.abi3.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:42be47fe9aefc5bb1244dcdd9a55f3253ebd17be57bd2922ac6686316820d6ee
3
+ size 250960