pat883 commited on
Commit
ffe6054
·
verified ·
1 Parent(s): c60ff2c

Add build/ variants to main

Browse files
.gitattributes CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ build/torch210-cxx11-rocm70-x86_64-linux/_tail_hip_20260703003713.abi3.so filter=lfs diff=lfs merge=lfs -text
37
+ build/torch210-cxx11-rocm71-x86_64-linux/_tail_hip_20260703003713.abi3.so filter=lfs diff=lfs merge=lfs -text
build/torch210-cxx11-rocm70-x86_64-linux/__init__.py ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """tail_hip — native HIP "tail" elementwise kernels for gfx1201 (RDNA4).
2
+
3
+ The kernel-builder / `kernels`-hub packaging of the kernel formerly vendored at minisgl-rdna4/tail_hip.
4
+ Framework-agnostic (shared by minisgl-rdna4 and vLLM), AOT-compiled once (no Triton) to cut per-op
5
+ launch/alloc overhead on the launch-sensitive decode path. Load with `kernels.get_kernel("<repo-id>")`
6
+ or import the built package directly. Ops are exposed both as callables here and (for torch.compile)
7
+ as opaque custom ops with registered fake/meta impls.
8
+
9
+ Ops: rms_norm, rms_norm_add, silu_and_mul, rope. Conventions match minisgl-rdna4 (plus_one RMSNorm
10
+ gain, gated silu over [...,2D], NeoX partial RoPE with cat(cos,sin) cache).
11
+ """
12
+ import torch
13
+
14
+ from ._ops import add_op_namespace_prefix, ops
15
+
16
+ # ---- fake/meta impls: keep torch.compile/Inductor from graph-breaking on the opaque custom ops ----
17
+
18
+
19
+ @torch.library.register_fake(add_op_namespace_prefix("rms_norm"))
20
+ def _rms_norm_fake(x, w, eps, plus_one):
21
+ return torch.empty_like(x)
22
+
23
+
24
+ @torch.library.register_fake(add_op_namespace_prefix("rms_norm_add"))
25
+ def _rms_norm_add_fake(x, residual, w, eps, plus_one):
26
+ return torch.empty_like(x)
27
+
28
+
29
+ @torch.library.register_fake(add_op_namespace_prefix("silu_and_mul"))
30
+ def _silu_and_mul_fake(x):
31
+ shape = list(x.shape)
32
+ shape[-1] //= 2
33
+ return x.new_empty(shape)
34
+
35
+
36
+ @torch.library.register_fake(add_op_namespace_prefix("rope"))
37
+ def _rope_fake(x, pos, cache, head_size, rotary_dim):
38
+ return torch.empty_like(x)
39
+
40
+
41
+ # ---- op wrappers ----
42
+ rms_norm = ops.rms_norm
43
+ rms_norm_add = ops.rms_norm_add
44
+ silu_and_mul = ops.silu_and_mul
45
+ rope = ops.rope
46
+
47
+ __all__ = ["rms_norm", "rms_norm_add", "silu_and_mul", "rope"]
build/torch210-cxx11-rocm70-x86_64-linux/_ops.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from . import _tail_hip_20260703003713
3
+ ops = torch.ops._tail_hip_20260703003713
4
+
5
+ def add_op_namespace_prefix(op_name: str):
6
+ """
7
+ Prefix op by namespace.
8
+ """
9
+ return f"_tail_hip_20260703003713::{op_name}"
build/torch210-cxx11-rocm70-x86_64-linux/_tail_hip_20260703003713.abi3.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a896ac92a978c91556d94b2979612e5c87672be9bd2cf9c9a2b2ca075041d4ca
3
+ size 1971408
build/torch210-cxx11-rocm70-x86_64-linux/metadata.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "version": 1,
3
+ "python-depends": []
4
+ }
build/torch210-cxx11-rocm70-x86_64-linux/tail_hip/__init__.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import ctypes
2
+ import sys
3
+
4
+ import importlib
5
+ from pathlib import Path
6
+ from types import ModuleType
7
+
8
+ def _import_from_path(file_path: Path) -> ModuleType:
9
+ # We cannot use the module name as-is, after adding it to `sys.modules`,
10
+ # it would also be used for other imports. So, we make a module name that
11
+ # depends on the path for it to be unique using the hex-encoded hash of
12
+ # the path.
13
+ path_hash = "{:x}".format(ctypes.c_size_t(hash(file_path.absolute())).value)
14
+ module_name = path_hash
15
+ spec = importlib.util.spec_from_file_location(module_name, file_path)
16
+ if spec is None:
17
+ raise ImportError(f"Cannot load spec for {module_name} from {file_path}")
18
+ module = importlib.util.module_from_spec(spec)
19
+ if module is None:
20
+ raise ImportError(f"Cannot load module {module_name} from spec")
21
+ sys.modules[module_name] = module
22
+ spec.loader.exec_module(module) # type: ignore
23
+ return module
24
+
25
+
26
+ globals().update(vars(_import_from_path(Path(__file__).parent.parent / "__init__.py")))
build/torch210-cxx11-rocm71-x86_64-linux/__init__.py ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """tail_hip — native HIP "tail" elementwise kernels for gfx1201 (RDNA4).
2
+
3
+ The kernel-builder / `kernels`-hub packaging of the kernel formerly vendored at minisgl-rdna4/tail_hip.
4
+ Framework-agnostic (shared by minisgl-rdna4 and vLLM), AOT-compiled once (no Triton) to cut per-op
5
+ launch/alloc overhead on the launch-sensitive decode path. Load with `kernels.get_kernel("<repo-id>")`
6
+ or import the built package directly. Ops are exposed both as callables here and (for torch.compile)
7
+ as opaque custom ops with registered fake/meta impls.
8
+
9
+ Ops: rms_norm, rms_norm_add, silu_and_mul, rope. Conventions match minisgl-rdna4 (plus_one RMSNorm
10
+ gain, gated silu over [...,2D], NeoX partial RoPE with cat(cos,sin) cache).
11
+ """
12
+ import torch
13
+
14
+ from ._ops import add_op_namespace_prefix, ops
15
+
16
+ # ---- fake/meta impls: keep torch.compile/Inductor from graph-breaking on the opaque custom ops ----
17
+
18
+
19
+ @torch.library.register_fake(add_op_namespace_prefix("rms_norm"))
20
+ def _rms_norm_fake(x, w, eps, plus_one):
21
+ return torch.empty_like(x)
22
+
23
+
24
+ @torch.library.register_fake(add_op_namespace_prefix("rms_norm_add"))
25
+ def _rms_norm_add_fake(x, residual, w, eps, plus_one):
26
+ return torch.empty_like(x)
27
+
28
+
29
+ @torch.library.register_fake(add_op_namespace_prefix("silu_and_mul"))
30
+ def _silu_and_mul_fake(x):
31
+ shape = list(x.shape)
32
+ shape[-1] //= 2
33
+ return x.new_empty(shape)
34
+
35
+
36
+ @torch.library.register_fake(add_op_namespace_prefix("rope"))
37
+ def _rope_fake(x, pos, cache, head_size, rotary_dim):
38
+ return torch.empty_like(x)
39
+
40
+
41
+ # ---- op wrappers ----
42
+ rms_norm = ops.rms_norm
43
+ rms_norm_add = ops.rms_norm_add
44
+ silu_and_mul = ops.silu_and_mul
45
+ rope = ops.rope
46
+
47
+ __all__ = ["rms_norm", "rms_norm_add", "silu_and_mul", "rope"]
build/torch210-cxx11-rocm71-x86_64-linux/_ops.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from . import _tail_hip_20260703003713
3
+ ops = torch.ops._tail_hip_20260703003713
4
+
5
+ def add_op_namespace_prefix(op_name: str):
6
+ """
7
+ Prefix op by namespace.
8
+ """
9
+ return f"_tail_hip_20260703003713::{op_name}"
build/torch210-cxx11-rocm71-x86_64-linux/_tail_hip_20260703003713.abi3.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:27b38cec13446ffeb8b65ad46081fa2fc13c417d8830db7a26a6dc47ffb6082e
3
+ size 1971312
build/torch210-cxx11-rocm71-x86_64-linux/metadata.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "version": 1,
3
+ "python-depends": []
4
+ }
build/torch210-cxx11-rocm71-x86_64-linux/tail_hip/__init__.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import ctypes
2
+ import sys
3
+
4
+ import importlib
5
+ from pathlib import Path
6
+ from types import ModuleType
7
+
8
+ def _import_from_path(file_path: Path) -> ModuleType:
9
+ # We cannot use the module name as-is, after adding it to `sys.modules`,
10
+ # it would also be used for other imports. So, we make a module name that
11
+ # depends on the path for it to be unique using the hex-encoded hash of
12
+ # the path.
13
+ path_hash = "{:x}".format(ctypes.c_size_t(hash(file_path.absolute())).value)
14
+ module_name = path_hash
15
+ spec = importlib.util.spec_from_file_location(module_name, file_path)
16
+ if spec is None:
17
+ raise ImportError(f"Cannot load spec for {module_name} from {file_path}")
18
+ module = importlib.util.module_from_spec(spec)
19
+ if module is None:
20
+ raise ImportError(f"Cannot load module {module_name} from spec")
21
+ sys.modules[module_name] = module
22
+ spec.loader.exec_module(module) # type: ignore
23
+ return module
24
+
25
+
26
+ globals().update(vars(_import_from_path(Path(__file__).parent.parent / "__init__.py")))