Add torch211-cxx11-cu130-aarch64-linux SM110 artifact
Browse files- build/torch211-cxx11-cu130-aarch64-linux/__init__.py +168 -0
- build/torch211-cxx11-cu130-aarch64-linux/_flashrt_vla_video_cuda_c4d802d.abi3.so +3 -0
- build/torch211-cxx11-cu130-aarch64-linux/_ops.py +6 -0
- build/torch211-cxx11-cu130-aarch64-linux/flashrt_vla_video/__init__.py +14 -0
- build/torch211-cxx11-cu130-aarch64-linux/metadata.json +22 -0
build/torch211-cxx11-cu130-aarch64-linux/__init__.py
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""FlashRT VLA, vision, video, and diffusion 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(add_op_namespace_prefix("q_norm_rope_bf16"))
|
| 13 |
+
def _q_norm_rope_bf16_fake(
|
| 14 |
+
q: torch.Tensor,
|
| 15 |
+
weight: torch.Tensor,
|
| 16 |
+
cos: torch.Tensor,
|
| 17 |
+
sin: torch.Tensor,
|
| 18 |
+
out: torch.Tensor,
|
| 19 |
+
eps: float = 1e-6,
|
| 20 |
+
) -> None:
|
| 21 |
+
if out.shape != q.shape:
|
| 22 |
+
raise RuntimeError("out shape must match q shape")
|
| 23 |
+
return None
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
@torch.library.register_fake(add_op_namespace_prefix("k_norm_rope_v_cache_bf16"))
|
| 27 |
+
def _k_norm_rope_v_cache_bf16_fake(
|
| 28 |
+
k: torch.Tensor,
|
| 29 |
+
v: torch.Tensor,
|
| 30 |
+
weight: torch.Tensor,
|
| 31 |
+
cos: torch.Tensor,
|
| 32 |
+
sin: torch.Tensor,
|
| 33 |
+
k_out: torch.Tensor,
|
| 34 |
+
v_out: torch.Tensor,
|
| 35 |
+
eps: float = 1e-6,
|
| 36 |
+
) -> None:
|
| 37 |
+
if k_out.shape != k.shape or v_out.shape != v.shape:
|
| 38 |
+
raise RuntimeError("k_out and v_out shapes must match k and v")
|
| 39 |
+
return None
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
@torch.library.register_fake(add_op_namespace_prefix("qkv_split_norm_rope_bf16"))
|
| 43 |
+
def _qkv_split_norm_rope_bf16_fake(
|
| 44 |
+
packed_qkv: torch.Tensor,
|
| 45 |
+
norm_q_weight: torch.Tensor,
|
| 46 |
+
norm_k_weight: torch.Tensor,
|
| 47 |
+
freqs_re: torch.Tensor,
|
| 48 |
+
freqs_im: torch.Tensor,
|
| 49 |
+
q_out: torch.Tensor,
|
| 50 |
+
k_out: torch.Tensor,
|
| 51 |
+
heads: int,
|
| 52 |
+
head_dim: int,
|
| 53 |
+
seq_len: int,
|
| 54 |
+
eps: float = 1e-6,
|
| 55 |
+
) -> None:
|
| 56 |
+
expected = (packed_qkv.shape[0], packed_qkv.shape[1], heads, head_dim)
|
| 57 |
+
if q_out.shape != expected or k_out.shape != expected:
|
| 58 |
+
raise RuntimeError(
|
| 59 |
+
"q_out and k_out shapes must be (batch, tokens, heads, head_dim)"
|
| 60 |
+
)
|
| 61 |
+
return None
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
def q_norm_rope_bf16(
|
| 65 |
+
q: torch.Tensor,
|
| 66 |
+
weight: torch.Tensor,
|
| 67 |
+
cos: torch.Tensor,
|
| 68 |
+
sin: torch.Tensor,
|
| 69 |
+
out: Optional[torch.Tensor] = None,
|
| 70 |
+
*,
|
| 71 |
+
eps: float = 1e-6,
|
| 72 |
+
) -> torch.Tensor:
|
| 73 |
+
"""Compute per-row RMSNorm plus rotate-half RoPE for BF16 Q heads.
|
| 74 |
+
|
| 75 |
+
``q`` must be contiguous BF16 with shape ``(..., 128)``. ``weight`` must
|
| 76 |
+
have shape ``(128,)``. ``cos`` and ``sin`` must have shape ``(64,)`` for
|
| 77 |
+
the current decode position. If ``out`` is omitted, a BF16 tensor with the
|
| 78 |
+
same shape as ``q`` is allocated.
|
| 79 |
+
"""
|
| 80 |
+
|
| 81 |
+
if out is None:
|
| 82 |
+
out = torch.empty_like(q)
|
| 83 |
+
ops.q_norm_rope_bf16(q, weight, cos, sin, out, eps)
|
| 84 |
+
return out
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
def k_norm_rope_v_cache_bf16(
|
| 88 |
+
k: torch.Tensor,
|
| 89 |
+
v: torch.Tensor,
|
| 90 |
+
weight: torch.Tensor,
|
| 91 |
+
cos: torch.Tensor,
|
| 92 |
+
sin: torch.Tensor,
|
| 93 |
+
k_out: Optional[torch.Tensor] = None,
|
| 94 |
+
v_out: Optional[torch.Tensor] = None,
|
| 95 |
+
*,
|
| 96 |
+
eps: float = 1e-6,
|
| 97 |
+
) -> tuple[torch.Tensor, torch.Tensor]:
|
| 98 |
+
"""Compute K RMSNorm plus RoPE and copy V into cache-shaped outputs.
|
| 99 |
+
|
| 100 |
+
``k`` and ``v`` must be contiguous BF16 tensors with shape ``(..., 128)``.
|
| 101 |
+
``weight`` must have shape ``(128,)``. ``cos`` and ``sin`` must have shape
|
| 102 |
+
``(64,)`` for the current decode position. If outputs are omitted, BF16
|
| 103 |
+
tensors with the same shape as ``k`` are allocated.
|
| 104 |
+
"""
|
| 105 |
+
|
| 106 |
+
if k_out is None:
|
| 107 |
+
k_out = torch.empty_like(k)
|
| 108 |
+
if v_out is None:
|
| 109 |
+
v_out = torch.empty_like(v)
|
| 110 |
+
ops.k_norm_rope_v_cache_bf16(k, v, weight, cos, sin, k_out, v_out, eps)
|
| 111 |
+
return k_out, v_out
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
def qkv_split_norm_rope_bf16(
|
| 115 |
+
packed_qkv: torch.Tensor,
|
| 116 |
+
norm_q_weight: torch.Tensor,
|
| 117 |
+
norm_k_weight: torch.Tensor,
|
| 118 |
+
freqs_re: torch.Tensor,
|
| 119 |
+
freqs_im: torch.Tensor,
|
| 120 |
+
*,
|
| 121 |
+
heads: int,
|
| 122 |
+
head_dim: int,
|
| 123 |
+
seq_len: Optional[int] = None,
|
| 124 |
+
q_out: Optional[torch.Tensor] = None,
|
| 125 |
+
k_out: Optional[torch.Tensor] = None,
|
| 126 |
+
eps: float = 1e-6,
|
| 127 |
+
) -> tuple[torch.Tensor, torch.Tensor]:
|
| 128 |
+
"""Split packed QKV, RMS-normalize Q/K, and apply interleaved RoPE.
|
| 129 |
+
|
| 130 |
+
``packed_qkv`` must be contiguous BF16 with shape
|
| 131 |
+
``(batch, tokens, 3 * heads * head_dim)``. ``norm_q_weight`` and
|
| 132 |
+
``norm_k_weight`` must have shape ``(heads * head_dim,)``. ``freqs_re`` and
|
| 133 |
+
``freqs_im`` must be contiguous FP32 tensors with shape
|
| 134 |
+
``(seq_len_table, head_dim // 2)``. Outputs have shape
|
| 135 |
+
``(batch, tokens, heads, head_dim)``.
|
| 136 |
+
"""
|
| 137 |
+
|
| 138 |
+
if seq_len is None:
|
| 139 |
+
seq_len = packed_qkv.shape[1]
|
| 140 |
+
if q_out is None:
|
| 141 |
+
q_out = torch.empty(
|
| 142 |
+
(packed_qkv.shape[0], packed_qkv.shape[1], heads, head_dim),
|
| 143 |
+
device=packed_qkv.device,
|
| 144 |
+
dtype=packed_qkv.dtype,
|
| 145 |
+
)
|
| 146 |
+
if k_out is None:
|
| 147 |
+
k_out = torch.empty_like(q_out)
|
| 148 |
+
ops.qkv_split_norm_rope_bf16(
|
| 149 |
+
packed_qkv,
|
| 150 |
+
norm_q_weight,
|
| 151 |
+
norm_k_weight,
|
| 152 |
+
freqs_re,
|
| 153 |
+
freqs_im,
|
| 154 |
+
q_out,
|
| 155 |
+
k_out,
|
| 156 |
+
heads,
|
| 157 |
+
head_dim,
|
| 158 |
+
seq_len,
|
| 159 |
+
eps,
|
| 160 |
+
)
|
| 161 |
+
return q_out, k_out
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
__all__ = [
|
| 165 |
+
"q_norm_rope_bf16",
|
| 166 |
+
"k_norm_rope_v_cache_bf16",
|
| 167 |
+
"qkv_split_norm_rope_bf16",
|
| 168 |
+
]
|
build/torch211-cxx11-cu130-aarch64-linux/_flashrt_vla_video_cuda_c4d802d.abi3.so
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c319aa0097d5dd9bfac6d9f74f43c547a03f056296e82ffe977d22caa1f69396
|
| 3 |
+
size 242672
|
build/torch211-cxx11-cu130-aarch64-linux/_ops.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from . import _flashrt_vla_video_cuda_c4d802d
|
| 3 |
+
ops = torch.ops._flashrt_vla_video_cuda_c4d802d
|
| 4 |
+
|
| 5 |
+
def add_op_namespace_prefix(op_name: str):
|
| 6 |
+
return f"_flashrt_vla_video_cuda_c4d802d::{op_name}"
|
build/torch211-cxx11-cu130-aarch64-linux/flashrt_vla_video/__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/torch211-cxx11-cu130-aarch64-linux/metadata.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "flashrt-vla-video",
|
| 3 |
+
"id": "_flashrt_vla_video_cuda_c4d802d",
|
| 4 |
+
"version": 1,
|
| 5 |
+
"license": "Apache-2.0",
|
| 6 |
+
"python-depends": [],
|
| 7 |
+
"backend": {
|
| 8 |
+
"type": "cuda",
|
| 9 |
+
"archs": [
|
| 10 |
+
"11.0"
|
| 11 |
+
]
|
| 12 |
+
},
|
| 13 |
+
"digest": {
|
| 14 |
+
"algorithm": "sha256",
|
| 15 |
+
"files": {
|
| 16 |
+
"__init__.py": "4/S2aAbFffcUrOnK9JO9NS944YoogdJSwqdRXWU7VLo=",
|
| 17 |
+
"_flashrt_vla_video_cuda_c4d802d.abi3.so": "wxmqAJfV3Zv6xtn3T0PFR6A/BWKW6C/+l30iyqH2k5Y=",
|
| 18 |
+
"_ops.py": "NhuyMSqzjMK5Nt+2BoUvQhZOFwXajZ3PMDiBmyqABA8=",
|
| 19 |
+
"flashrt_vla_video/__init__.py": "v6p5XMfQzddhi1fLSAw4HX9CyS0rQsidvu9VsT01xi4="
|
| 20 |
+
}
|
| 21 |
+
}
|
| 22 |
+
}
|