liangsu9988 commited on
Commit
f1d1375
·
verified ·
1 Parent(s): 256e18e

Uploaded using `kernel-builder`.

Browse files
build/torch211-cxx11-cu128-x86_64-linux/__init__.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """FlashRT sequential state-scan kernels for linear attention."""
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(add_op_namespace_prefix("gated_delta_recurrent_seq_bf16"))
13
+ def _gated_delta_recurrent_seq_fake(
14
+ q: torch.Tensor,
15
+ k: torch.Tensor,
16
+ v: torch.Tensor,
17
+ g: torch.Tensor,
18
+ beta: torch.Tensor,
19
+ state: torch.Tensor,
20
+ out: torch.Tensor,
21
+ use_qk_l2norm: bool = False,
22
+ ) -> None:
23
+ if q.dim() != 3 or k.shape != q.shape or v.shape != q.shape:
24
+ raise RuntimeError("q/k/v must have shape (S,H,D)")
25
+ if g.shape != (q.shape[0], q.shape[1]) or beta.shape != g.shape:
26
+ raise RuntimeError("g/beta must have shape (S,H)")
27
+ if state.shape != (q.shape[1], q.shape[2], q.shape[2]) or out.shape != q.shape:
28
+ raise RuntimeError("state/out shape mismatch")
29
+ return None
30
+
31
+
32
+ def gated_delta_recurrent_seq_bf16(
33
+ q: torch.Tensor,
34
+ k: torch.Tensor,
35
+ v: torch.Tensor,
36
+ g: torch.Tensor,
37
+ beta: torch.Tensor,
38
+ state: torch.Tensor,
39
+ *,
40
+ out: Optional[torch.Tensor] = None,
41
+ use_qk_l2norm: bool = False,
42
+ ) -> tuple[torch.Tensor, torch.Tensor]:
43
+ """Scan a full `(S,H,128)` Gated DeltaNet sequence in one launch.
44
+
45
+ `state` is updated in place with the final `(H,128,128)` state.
46
+ """
47
+
48
+ if out is None:
49
+ out = torch.empty_like(q)
50
+ ops.gated_delta_recurrent_seq_bf16(q, k, v, g, beta, state, out, bool(use_qk_l2norm))
51
+ return out, state
52
+
53
+
54
+ __all__ = ["gated_delta_recurrent_seq_bf16"]
build/torch211-cxx11-cu128-x86_64-linux/_linear_attention_seq_state_cuda_1683349.abi3.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2bdf6f3e2a0220ff5b2252ea763d934cabeff608e6dbce17947a23a3f3862cdd
3
+ size 246792
build/torch211-cxx11-cu128-x86_64-linux/_ops.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from . import _linear_attention_seq_state_cuda_1683349
3
+ ops = torch.ops._linear_attention_seq_state_cuda_1683349
4
+
5
+ def add_op_namespace_prefix(op_name: str):
6
+ """
7
+ Prefix op by namespace.
8
+ """
9
+ return f"_linear_attention_seq_state_cuda_1683349::{op_name}"
build/torch211-cxx11-cu128-x86_64-linux/linear_attention_seq_state/__init__.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import ctypes
2
+ import importlib.util
3
+ import sys
4
+ from pathlib import Path
5
+ from types import ModuleType
6
+
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/torch211-cxx11-cu128-x86_64-linux/metadata.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "linear-attention-seq-state",
3
+ "id": "_linear_attention_seq_state_cuda_1683349",
4
+ "version": 1,
5
+ "license": "Apache-2.0",
6
+ "python-depends": [],
7
+ "backend": {
8
+ "type": "cuda",
9
+ "archs": [
10
+ "10.0",
11
+ "10.1",
12
+ "12.0+PTX",
13
+ "7.0",
14
+ "7.2",
15
+ "7.5",
16
+ "8.0",
17
+ "8.6",
18
+ "8.7",
19
+ "8.9",
20
+ "9.0"
21
+ ]
22
+ }
23
+ }
build/torch211-cxx11-cu130-x86_64-linux/__init__.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """FlashRT sequential state-scan kernels for linear attention."""
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(add_op_namespace_prefix("gated_delta_recurrent_seq_bf16"))
13
+ def _gated_delta_recurrent_seq_fake(
14
+ q: torch.Tensor,
15
+ k: torch.Tensor,
16
+ v: torch.Tensor,
17
+ g: torch.Tensor,
18
+ beta: torch.Tensor,
19
+ state: torch.Tensor,
20
+ out: torch.Tensor,
21
+ use_qk_l2norm: bool = False,
22
+ ) -> None:
23
+ if q.dim() != 3 or k.shape != q.shape or v.shape != q.shape:
24
+ raise RuntimeError("q/k/v must have shape (S,H,D)")
25
+ if g.shape != (q.shape[0], q.shape[1]) or beta.shape != g.shape:
26
+ raise RuntimeError("g/beta must have shape (S,H)")
27
+ if state.shape != (q.shape[1], q.shape[2], q.shape[2]) or out.shape != q.shape:
28
+ raise RuntimeError("state/out shape mismatch")
29
+ return None
30
+
31
+
32
+ def gated_delta_recurrent_seq_bf16(
33
+ q: torch.Tensor,
34
+ k: torch.Tensor,
35
+ v: torch.Tensor,
36
+ g: torch.Tensor,
37
+ beta: torch.Tensor,
38
+ state: torch.Tensor,
39
+ *,
40
+ out: Optional[torch.Tensor] = None,
41
+ use_qk_l2norm: bool = False,
42
+ ) -> tuple[torch.Tensor, torch.Tensor]:
43
+ """Scan a full `(S,H,128)` Gated DeltaNet sequence in one launch.
44
+
45
+ `state` is updated in place with the final `(H,128,128)` state.
46
+ """
47
+
48
+ if out is None:
49
+ out = torch.empty_like(q)
50
+ ops.gated_delta_recurrent_seq_bf16(q, k, v, g, beta, state, out, bool(use_qk_l2norm))
51
+ return out, state
52
+
53
+
54
+ __all__ = ["gated_delta_recurrent_seq_bf16"]
build/torch211-cxx11-cu130-x86_64-linux/_linear_attention_seq_state_cuda_1683349.abi3.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9a5d6e5abc9da250257dbf1be4732dc552399a3a4d0398d1d0b49480dda21609
3
+ size 239784
build/torch211-cxx11-cu130-x86_64-linux/_ops.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from . import _linear_attention_seq_state_cuda_1683349
3
+ ops = torch.ops._linear_attention_seq_state_cuda_1683349
4
+
5
+ def add_op_namespace_prefix(op_name: str):
6
+ """
7
+ Prefix op by namespace.
8
+ """
9
+ return f"_linear_attention_seq_state_cuda_1683349::{op_name}"
build/torch211-cxx11-cu130-x86_64-linux/linear_attention_seq_state/__init__.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import ctypes
2
+ import importlib.util
3
+ import sys
4
+ from pathlib import Path
5
+ from types import ModuleType
6
+
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/torch211-cxx11-cu130-x86_64-linux/metadata.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "linear-attention-seq-state",
3
+ "id": "_linear_attention_seq_state_cuda_1683349",
4
+ "version": 1,
5
+ "license": "Apache-2.0",
6
+ "python-depends": [],
7
+ "backend": {
8
+ "type": "cuda",
9
+ "archs": [
10
+ "10.0",
11
+ "11.0",
12
+ "12.0",
13
+ "12.1+PTX",
14
+ "7.5",
15
+ "8.0",
16
+ "8.6",
17
+ "8.7",
18
+ "8.9",
19
+ "9.0"
20
+ ]
21
+ }
22
+ }
build/torch212-cxx11-cu130-x86_64-linux/__init__.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """FlashRT sequential state-scan kernels for linear attention."""
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(add_op_namespace_prefix("gated_delta_recurrent_seq_bf16"))
13
+ def _gated_delta_recurrent_seq_fake(
14
+ q: torch.Tensor,
15
+ k: torch.Tensor,
16
+ v: torch.Tensor,
17
+ g: torch.Tensor,
18
+ beta: torch.Tensor,
19
+ state: torch.Tensor,
20
+ out: torch.Tensor,
21
+ use_qk_l2norm: bool = False,
22
+ ) -> None:
23
+ if q.dim() != 3 or k.shape != q.shape or v.shape != q.shape:
24
+ raise RuntimeError("q/k/v must have shape (S,H,D)")
25
+ if g.shape != (q.shape[0], q.shape[1]) or beta.shape != g.shape:
26
+ raise RuntimeError("g/beta must have shape (S,H)")
27
+ if state.shape != (q.shape[1], q.shape[2], q.shape[2]) or out.shape != q.shape:
28
+ raise RuntimeError("state/out shape mismatch")
29
+ return None
30
+
31
+
32
+ def gated_delta_recurrent_seq_bf16(
33
+ q: torch.Tensor,
34
+ k: torch.Tensor,
35
+ v: torch.Tensor,
36
+ g: torch.Tensor,
37
+ beta: torch.Tensor,
38
+ state: torch.Tensor,
39
+ *,
40
+ out: Optional[torch.Tensor] = None,
41
+ use_qk_l2norm: bool = False,
42
+ ) -> tuple[torch.Tensor, torch.Tensor]:
43
+ """Scan a full `(S,H,128)` Gated DeltaNet sequence in one launch.
44
+
45
+ `state` is updated in place with the final `(H,128,128)` state.
46
+ """
47
+
48
+ if out is None:
49
+ out = torch.empty_like(q)
50
+ ops.gated_delta_recurrent_seq_bf16(q, k, v, g, beta, state, out, bool(use_qk_l2norm))
51
+ return out, state
52
+
53
+
54
+ __all__ = ["gated_delta_recurrent_seq_bf16"]
build/torch212-cxx11-cu130-x86_64-linux/_linear_attention_seq_state_cuda_1683349.abi3.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:74141413c509ead42f5fdcb0365e697b404b1295476e4754371cca503b8d68f7
3
+ size 250696
build/torch212-cxx11-cu130-x86_64-linux/_ops.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from . import _linear_attention_seq_state_cuda_1683349
3
+ ops = torch.ops._linear_attention_seq_state_cuda_1683349
4
+
5
+ def add_op_namespace_prefix(op_name: str):
6
+ """
7
+ Prefix op by namespace.
8
+ """
9
+ return f"_linear_attention_seq_state_cuda_1683349::{op_name}"
build/torch212-cxx11-cu130-x86_64-linux/linear_attention_seq_state/__init__.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import ctypes
2
+ import importlib.util
3
+ import sys
4
+ from pathlib import Path
5
+ from types import ModuleType
6
+
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/torch212-cxx11-cu130-x86_64-linux/metadata.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "linear-attention-seq-state",
3
+ "id": "_linear_attention_seq_state_cuda_1683349",
4
+ "version": 1,
5
+ "license": "Apache-2.0",
6
+ "python-depends": [],
7
+ "backend": {
8
+ "type": "cuda",
9
+ "archs": [
10
+ "10.0",
11
+ "11.0",
12
+ "12.0",
13
+ "12.1+PTX",
14
+ "7.5",
15
+ "8.0",
16
+ "8.6",
17
+ "8.7",
18
+ "8.9",
19
+ "9.0"
20
+ ]
21
+ }
22
+ }
build/torch212-cxx11-cu132-x86_64-linux/__init__.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """FlashRT sequential state-scan kernels for linear attention."""
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(add_op_namespace_prefix("gated_delta_recurrent_seq_bf16"))
13
+ def _gated_delta_recurrent_seq_fake(
14
+ q: torch.Tensor,
15
+ k: torch.Tensor,
16
+ v: torch.Tensor,
17
+ g: torch.Tensor,
18
+ beta: torch.Tensor,
19
+ state: torch.Tensor,
20
+ out: torch.Tensor,
21
+ use_qk_l2norm: bool = False,
22
+ ) -> None:
23
+ if q.dim() != 3 or k.shape != q.shape or v.shape != q.shape:
24
+ raise RuntimeError("q/k/v must have shape (S,H,D)")
25
+ if g.shape != (q.shape[0], q.shape[1]) or beta.shape != g.shape:
26
+ raise RuntimeError("g/beta must have shape (S,H)")
27
+ if state.shape != (q.shape[1], q.shape[2], q.shape[2]) or out.shape != q.shape:
28
+ raise RuntimeError("state/out shape mismatch")
29
+ return None
30
+
31
+
32
+ def gated_delta_recurrent_seq_bf16(
33
+ q: torch.Tensor,
34
+ k: torch.Tensor,
35
+ v: torch.Tensor,
36
+ g: torch.Tensor,
37
+ beta: torch.Tensor,
38
+ state: torch.Tensor,
39
+ *,
40
+ out: Optional[torch.Tensor] = None,
41
+ use_qk_l2norm: bool = False,
42
+ ) -> tuple[torch.Tensor, torch.Tensor]:
43
+ """Scan a full `(S,H,128)` Gated DeltaNet sequence in one launch.
44
+
45
+ `state` is updated in place with the final `(H,128,128)` state.
46
+ """
47
+
48
+ if out is None:
49
+ out = torch.empty_like(q)
50
+ ops.gated_delta_recurrent_seq_bf16(q, k, v, g, beta, state, out, bool(use_qk_l2norm))
51
+ return out, state
52
+
53
+
54
+ __all__ = ["gated_delta_recurrent_seq_bf16"]
build/torch212-cxx11-cu132-x86_64-linux/_linear_attention_seq_state_cuda_1683349.abi3.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:05da7be0c6e4a9f61f3ddc86a0ac7afda7ab573b4c369a5a21b30340310b143d
3
+ size 250696
build/torch212-cxx11-cu132-x86_64-linux/_ops.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from . import _linear_attention_seq_state_cuda_1683349
3
+ ops = torch.ops._linear_attention_seq_state_cuda_1683349
4
+
5
+ def add_op_namespace_prefix(op_name: str):
6
+ """
7
+ Prefix op by namespace.
8
+ """
9
+ return f"_linear_attention_seq_state_cuda_1683349::{op_name}"
build/torch212-cxx11-cu132-x86_64-linux/linear_attention_seq_state/__init__.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import ctypes
2
+ import importlib.util
3
+ import sys
4
+ from pathlib import Path
5
+ from types import ModuleType
6
+
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/torch212-cxx11-cu132-x86_64-linux/metadata.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "linear-attention-seq-state",
3
+ "id": "_linear_attention_seq_state_cuda_1683349",
4
+ "version": 1,
5
+ "license": "Apache-2.0",
6
+ "python-depends": [],
7
+ "backend": {
8
+ "type": "cuda",
9
+ "archs": [
10
+ "10.0",
11
+ "11.0",
12
+ "12.0",
13
+ "12.1+PTX",
14
+ "7.5",
15
+ "8.0",
16
+ "8.6",
17
+ "8.7",
18
+ "8.9",
19
+ "9.0"
20
+ ]
21
+ }
22
+ }