interplane.Get Omega
Read in your language

omega-bridge

Omega-first language interoperability: checked conversion backends and native language bindings

Brought by drakestapleton

GitHub aien-dev/omega-bridge#30 (code only)

closed derived bb52c5fe08246750 #30

Imported from GitHub aien-dev/omega-bridge#30 (code only)

GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed).

Base 7af4d11c3a9c853abc20a99f97d0a4f01524bb66 · Head 9701da1916f606ba22f069899f1d561b26fc7ed5

Fetch it

A git bundle of the pull request's head, 23009 bytes.

curl -fsSL https://interplane.io/drakestapleton/omega-bridge/patches/bb52c5fe08246750.bundle -o bb52c5fe08246750.bundle
git fetch bb52c5fe08246750.bundle refs/pull/30/head

Raw bundle · Diff

Provenance

This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:

github-import 1
aien-dev/omega-bridge
30
9701da1916f606ba22f069899f1d561b26fc7ed5
{"kind":"github-import","owner":"aien-dev","repo":"omega-bridge","number":30,"url":"https://github.com/aien-dev/omega-bridge/pull/30","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:39:58Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/README.md b/README.md
index 4c667cb..64477ec 100644
--- a/README.md
+++ b/README.md
@@ -98,6 +98,15 @@ failed/missing-toolchain controls passed EMULATED; see
 [the pinned receipts](evidence/native-x86-be8c5130.json). Earlier
 pins' receipts remain in `evidence/native-x86-62775d2a.json`, `evidence/native-x86-badedbb0/`, `evidence/native-x86-f7752bc5/` and `evidence/native-x86/`. Physical x86
 execution remains NOT_RUN.
+## Framework attachments
+
+| Framework | Attachment | Scope (receipt) |
+|---|---|---|
+| llama.cpp / ggml | [aien-dev/ggml-omega](https://github.com/aien-dev/ggml-omega), an out-of-tree ggml backend built on `src/native.om` | host device (draft ggml-omega#1): 16 ops on Omega CPU code; opt-in `OmegaGB10` device (draft ggml-omega#2): MUL_MAT, RMS_NORM, swiglu on the GB10 through CUDA++ (CUDApp#139 `gemm_ex`), every other op on ggml's CPU backend; test-backend-ops against the CPU backend on the chip, MUL_MAT 871 / RMS_NORM 7 / SWIGLU 12 cases OK, 0 FAIL |
+| PyTorch | [attach/torch](attach/torch/cudapp_torch.py): `torch.library` ops `cudapp::mm` (f32, bf16, f16) and `cudapp::swiglu` (f32) calling CUDA++ (`omega_gpu_gemm_ex`, `omega_gpu_swiglu_f32`) on the GB10 | CPU tensors in and out (staged to the chip per call), no autograd; checked against torch CPU plus `torch.library.opcheck` and a mutant (`attach/torch/test_cudapp_torch.py`); receipt `evidence/attach-gb10-20261027T0726Z/`, EXERCISED on a single GB10 |
+
+`attach/torch` is migration-pending host glue (`ctypes` at the torch ABI surface, switch `MIGRATION_PENDING`); its named successor is the `omega_native.py` binding that `tools/native` writes (the `python` word of `src/native.om`) once CUDA++ entries are callable as Omega units. Neither attachment has run a model on the GB10 yet: that needs an exclusive GPU window.
+
 ## Human-Directed Agentic Engineering
 
 Development follows Human-Directed Agentic Engineering (HDAE): humans define goals, architecture, constraints, acceptance criteria, and stopping points; agents implement, execute checks, diagnose failures, and revise within those boundaries. Human review retains responsibility for claims, acceptance, and release decisions.
diff --git a/attach/torch/.gitignore b/attach/torch/.gitignore
new file mode 100644
index 0000000..64a5275
--- /dev/null
+++ b/attach/torch/.gitignore
@@ -0,0 +1 @@
+libcudapp_attach.so
diff --git a/attach/torch/build.sh b/attach/torch/build.sh
new file mode 100755
index 0000000..3f63277
--- /dev/null
+++ b/attach/torch/build.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+# Link CUDA++'s libomega_gpu.a (built with -fPIC: make CC="gcc -fPIC" OUT_DIR=build-pic libomega_gpu) into the one
+# shared object cudapp_torch.py loads. usage: build.sh CUDAPP_LIB_A [OUT_SO]
+# The archive must carry omega_gpu_gemm_ex (CUDApp gemm_ex, build switch CUDAPP_MIGRATION_PENDING_GEMM_EX=1).
+set -eu
+A=${1:?usage: build.sh libomega_gpu.a [out.so]}
+O=${2:-$(dirname "$0")/libcudapp_attach.so}
+nm "$A" | grep -q ' T omega_gpu_gemm_ex$' || { echo "FAIL $A has no omega_gpu_gemm_ex" >&2; exit 1; }
+cc -shared -o "$O" -Wl,--whole-archive "$A" -Wl,--no-whole-archive -lpthread -lm
+echo "BUILT $O from $A (sha256 $(sha256sum < "$A" | cut -c1-16))"
diff --git a/attach/torch/cudapp_torch.py b/attach/torch/cudapp_torch.py
new file mode 100644
index 0000000..7574e09
--- /dev/null
+++ b/attach/torch/cudapp_torch.py
@@ -0,0 +1,119 @@
+"""cudapp_torch: PyTorch custom operators that run on the NVIDIA GB10 through CUDA++ (aien-dev/CUDApp).
+
+    torch.ops.cudapp.mm(a, b)          a (m, k) @ b (k, n) -> (m, n) float32, omega_gpu_gemm_ex
+    torch.ops.cudapp.swiglu(gate, up)  silu(gate) * up, float32, omega_gpu_swiglu_f32
+
+Registered with torch.library.custom_op on CPU tensors: the operands are host memory, CUDA++ stages them to the
+chip, runs kernels from Omega's own code generator (no CUDA toolkit, no NVIDIA user-space library) and copies the
+result back. Arithmetic (CUDApp src/omega_gpu_gemm_ex.h, src/omega_gpu_elementwise_api.h):
+    mm      bf16 x bf16 and f16 x f16 native HMMA with fp32 accumulation; anything with f32 the bf16x3 route
+            (not exact fp32); the k parts summed on the host in double.
+    swiglu  MUFU.EX2 / MUFU.RCP (each about 2^-22 relative).
+The library is CUDA++'s libomega_gpu.a linked into one shared object (build.sh, CUDAPP_TORCH_LIB).
+
+MIGRATION-PENDING host glue (Python): torch.library registration is a Python/C++ ABI, which seeded Omega cannot
+emit yet. MIGRATION_PENDING below marks it; the named successor is the omega_native.py binding that
+omega-bridge tools/native writes (the python word of src/native.om) for an Omega unit that calls the CUDA++ entries, once Omega
+code can call host functions.
+"""
+import ctypes
+import os
+
+import torch
+
+MIGRATION_PENDING = True
+
+OP_N, OP_T = 0, 1
+DT = {torch.float32: 0, torch.bfloat16: 1, torch.float16: 2}
+
+
+class _Info(ctypes.Structure):
+    _fields_ = [("route", ctypes.c_uint32), ("core_type", ctypes.c_uint32),
+                ("core_calls", ctypes.c_uint64), ("host_fixed", ctypes.c_uint64)]
+
+
+class _GemmEx(ctypes.Structure):  # OmegaGemmExArgs, src/omega_gpu_gemm_ex.h
+    _fields_ = [("op_a", ctypes.c_int), ("op_b", ctypes.c_int),
+                ("m", ctypes.c_uint64), ("n", ctypes.c_uint64), ("k", ctypes.c_uint64), ("batch", ctypes.c_uint64),
+                ("a_type", ctypes.c_int), ("b_type", ctypes.c_int), ("c_type", ctypes.c_int),
+                ("a", ctypes.c_void_p), ("lda", ctypes.c_uint64), ("stride_a", ctypes.c_uint64),
+                ("b", ctypes.c_void_p), ("ldb", ctypes.c_uint64), ("stride_b", ctypes.c_uint64),
+                ("c", ctypes.c_void_p), ("ldc", ctypes.c_uint64), ("stride_c", ctypes.c_uint64),
+                ("alpha", ctypes.c_float), ("beta", ctypes.c_float),
+                ("compute", ctypes.c_int), ("scale", ctypes.c_int),
+                ("scale_a", ctypes.c_void_p), ("scale_b", ctypes.c_void_p),
+                ("scale_stride_a", ctypes.c_uint64), ("scale_stride_b", ctypes.c_uint64),
+                ("block_m", ctypes.c_uint32), ("block_n", ctypes.c_uint32), ("block_k", ctypes.c_uint32),
+                ("info", ctypes.POINTER(_Info))]
+
+
+_lib = ctypes.CDLL(os.environ.get("CUDAPP_TORCH_LIB", os.path.join(os.path.dirname(__file__), "libcudapp_attach.so")))
+_lib.omega_gpu_gemm_ex.argtypes = [ctypes.POINTER(_GemmEx)]
+_lib.omega_gpu_gemm_ex.restype = ctypes.c_int
+_lib.omega_gpu_gemm_rc_name.argtypes = [ctypes.c_int]
+_lib.omega_gpu_gemm_rc_name.restype = ctypes.c_char_p
+_lib.omega_gpu_swiglu_f32.argtypes = [ctypes.c_uint32, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
+_lib.omega_gpu_swiglu_f32.restype = ctypes.c_int
+_lib.omega_gpu_elementwise_rc_name.argtypes = [ctypes.c_int]
+_lib.omega_gpu_elementwise_rc_name.restype = ctypes.c_char_p
+_lib.omega_gpu_gemm_ex_test_set_mutant.argtypes = [ctypes.c_int]
+_lib.omega_gpu_gemm_ex_test_set_mutant.restype = None
+
+last_route = None  # OmegaGemmRoute of the last cudapp::mm (3 = BF16X3, 1 = NATIVE)
+
+
+def set_gemm_mutant(m):
+    """Negative control: 1 drops the last k element of every product (CUDApp's own red check)."""
+    _lib.omega_gpu_gemm_ex_test_set_mutant(m)
+
+
+@torch.library.custom_op("cudapp::mm", mutates_args=())
+def mm(a: torch.Tensor, b: torch.Tensor) -> torch.Tensor:
+    global last_route
+    if a.dim() != 2 or b.dim() != 2 or a.shape[1] != b.shape[0]:
+        raise ValueError(f"cudapp::mm needs (m, k) @ (k, n), got {tuple(a.shape)} @ {tuple(b.shape)}")
+    if a.dtype not in DT or b.dtype not in DT or a.device.type != "cpu" or b.device.type != "cpu":
+        raise TypeError("cudapp::mm takes CPU float32, bfloat16 or float16 tensors")
+    a, b = a.contiguous(), b.contiguous()
+    m, k = a.shape
+    n = b.shape[1]
+    c = torch.empty((m, n), dtype=torch.float32)
+    if m == 0 or n == 0:
+        return c
+    if k == 0:
+        return c.zero_()
+    info = _Info()
+    args = _GemmEx(op_a=OP_N, op_b=OP_N, m=m, n=n, k=k, batch=1, a_type=DT[a.dtype], b_type=DT[b.dtype], c_type=0,
+                   a=a.data_ptr(), lda=k, b=b.data_ptr(), ldb=n, c=c.data_ptr(), ldc=n, alpha=1.0, beta=0.0,
+                   info=ctypes.pointer(info))
+    rc = _lib.omega_gpu_gemm_ex(ctypes.byref(args))
+    if rc != 0:
+        raise RuntimeError(f"omega_gpu_gemm_ex: {_lib.omega_gpu_gemm_rc_name(rc).decode()} ({rc})")
+    last_route = info.route
+    return c
+
+
+@mm.register_fake
+def _(a, b):
+    return a.new_empty((a.shape[0], b.shape[1]), dtype=torch.float32)
+
+
+@torch.library.custom_op("cudapp::swiglu", mutates_args=())
+def swiglu(gate: torch.Tensor, up: torch.Tensor) -> torch.Tensor:
+    if gate.shape != up.shape or gate.dtype != torch.float32 or up.dtype != torch.float32:
+        raise TypeError("cudapp::swiglu takes two float32 CPU tensors of one shape")
+    if gate.device.type != "cpu" or up.device.type != "cpu" or gate.numel() >= 2 ** 32:
+        raise TypeError("cudapp::swiglu takes CPU tensors of fewer than 2^32 elements")
+    gate, up = gate.contiguous(), up.contiguous()
+    out = torch.empty_like(gate)
+    if gate.numel() == 0:
+        return out
+    rc = _lib.omega_gpu_swiglu_f32(gate.numel(), gate.data_ptr(), up.data_ptr(), out.data_ptr(), None)
+    if rc != 0:
+        raise RuntimeError(f"omega_gpu_swiglu_f32: {_lib.omega_gpu_elementwise_rc_name(rc).decode()} ({rc})")
+    return out
+
+
+@swiglu.register_fake
+def _(gate, up):
+    return torch.empty_like(gate)
diff --git a/attach/torch/test_cudapp_torch.py b/attach/torch/test_cudapp_torch.py
new file mode 100644
index 0000000..b555f11
--- /dev/null
+++ b/attach/torch/test_cudapp_torch.py
@@ -0,0 +1,84 @@
+"""test_cudapp_torch.py: torch.ops.cudapp.mm / swiglu on the GB10 against torch CPU in float64.
+
+usage: CUDAPP_TORCH_LIB=<libcudapp_attach.so> python test_cudapp_torch.py RECEIPT.json
+Runs on the chip (CUDA++ opens the GB10): take /tmp/aien-gb10.lock first. Exit 0 only when every case is inside
+its bound, the routes are the stated ones, and the negative control (gemm_ex mutant 1: the last k element of every
+product dropped) goes red.
+
+Bounds, reference = float64 product of the same (exactly representable) inputs, S = (|a| @ |b|) in float64:
+  bf16 / f16 inputs (native HMMA, fp32 accumulation over k terms):  |c - ref| <= k * 2^-24 * S
+  f32 inputs (bf16x3: 9 exact plane products per k, fp32 accumulation over 9k terms, k parts summed in double):
+                                                                     |c - ref| <= 9 k * 2^-24 * S
+  swiglu (CUDApp tests/gpu_elementwise_test.c tolerance):           |y - ref| <= 1e-5 |ref| + 1e-6
+"""
+import json
+import sys
+
+import torch
+
+import cudapp_torch
+
+U = 2.0 ** -24
+torch.manual_seed(20261027)
+rows = []
+
+
+def mm_case(m, k, n, dt, mutant=0):
+    a = torch.randn(m, k, dtype=torch.float64).to(dt)
+    b = torch.randn(k, n, dtype=torch.float64).to(dt)
+    cudapp_torch.set_gemm_mutant(mutant)
+    try:
+        c = torch.ops.cudapp.mm(a, b).double()
+    finally:
+        cudapp_torch.set_gemm_mutant(0)
+    ref = a.double() @ b.double()
+    s = a.double().abs() @ b.double().abs()
+    terms = 9 * k if dt == torch.float32 else k
+    err = (c - ref).abs()
+    ratio = float((err / (terms * U * s + 1e-300)).max())
+    route_want = 3 if dt == torch.float32 else 1
+    ok = ratio <= 1.0 and cudapp_torch.last_route == route_want
+    rows.append({"op": "cudapp::mm", "m": m, "k": k, "n": n, "dtype": str(dt).split(".")[1], "mutant": mutant,
+                 "route": cudapp_torch.last_route, "route_expected": route_want,
+                 "max_abs_err": float(err.max()), "max_err_over_bound": ratio, "inside_bound": ok})
+    return ok
+
+
+def swiglu_case(n):
+    g = torch.randn(n, dtype=torch.float32) * 4
+    u = torch.randn(n, dtype=torch.float32)
+    y = torch.ops.cudapp.swiglu(g, u).double()
+    gd, ud = g.double(), u.double()
+    ref = gd / (1 + torch.exp(-gd)) * ud
+    ratio = float(((y - ref).abs() / (1e-5 * ref.abs() + 1e-6)).max())
+    ok = ratio <= 1.0
+    rows.append({"op": "cudapp::swiglu", "n": n, "max_abs_err": float((y - ref).abs().max()),
+                 "max_err_over_bound": ratio, "inside_bound": ok})
+    return ok
+
+
+good = True
+for m, k, n in [(1, 1, 1), (3, 257, 129), (17, 2048, 96), (64, 64, 64), (5, 1809, 33)]:
+    good &= mm_case(m, k, n, torch.float32)
+for dt in (torch.bfloat16, torch.float16):
+    for m, k, n in [(5, 300, 7), (32, 128, 64)]:
+        good &= mm_case(m, k, n, dt)
+for n in (1, 1000, 65536):
+    good &= swiglu_case(n)
+
+# torch.library's own operator checks (schema, fake tensor, autograd registration) on one small case each
+torch.library.opcheck(torch.ops.cudapp.mm.default, (torch.randn(3, 5), torch.randn(5, 4)))
+torch.library.opcheck(torch.ops.cudapp.swiglu.default, (torch.randn(7), torch.randn(7)))
+
+# negative control: must leave the bound
+caught = not mm_case(3, 257, 129, torch.float32, mutant=1)
+rows[-1]["negative_control"] = True
+rows[-1]["caught"] = caught
+
+verdict = "PASS" if good and caught else "FAIL"
+with open(sys.argv[1], "w") as f:
+    json.dump({"schema": "CUDAPP_TORCH_V1", "torch": torch.__version__, "verdict": verdict, "cases": rows}, f, indent=1)
+for r in rows:
+    print(json.dumps(r))
+print(verdict)
+sys.exit(0 if verdict == "PASS" else 1)
diff --git a/docs/NATIVE-ABI.md b/docs/NATIVE-ABI.md
index 892c042..73954b3 100644
--- a/docs/NATIVE-ABI.md
+++ b/docs/NATIVE-ABI.md
@@ -236,7 +236,10 @@ length and overlap. Python ctypes uses `c_float` and `c_uint16`. Rust and Zig de
 arrays as byte pointers (`*mut u8` / `*const u8`, Zig `?[*]u8`); Go stays `unsafe.Pointer`.
 `OMEGA_NATIVE_OMC=<seed omc> sh tests/native/kinds.sh` binds `fsum.om` and `halve.om`, compares every
 lane to a C `_Float16` oracle, refuses misaligned, wrong-length, overlapping and null arrays (status
-32), and requires a mutant that changes fsum's `add` to `sub` to fail. A unit may hold several functions: the seeded
+32), and requires a mutant that changes fsum's `add` to `sub` to fail. The same script calls both units
+through the `python` binding (`tests/native/pykinds.py`): lanes and halving against Python `struct`
+values, wrong lengths refused with status 32 and the arrays untouched, `f64`/`int32` arrays for an `f32`
+view, `bytes` for an `edit ushort` array and a 2^64 length refused by ctypes; the fsum mutant must fail there too. A unit may hold several functions: the seeded
 compiler enters function-mode code at the unit's last function (the leading entry branches to it), so the
 binding exports that one and the earlier functions stay private helpers, called directly inside the
 embedded code, with any Omega types. Only the last function's signature must be supported
diff --git a/evidence/attach-gb10-20261027T0726Z/SOURCES b/evidence/attach-gb10-20261027T0726Z/SOURCES
new file mode 100644
index 0000000..18fdf67
--- /dev/null
+++ b/evidence/attach-gb10-20261027T0726Z/SOURCES
@@ -0,0 +1,2 @@
+CUDApp src: aien-dev/CUDApp#139 fba0384 (diff -rq src clean), libomega_gpu.a sha256 725341d11fb8d879f70101fbf1c580aadee6aa113dfe1e46ca0374ad76a3543e
+libcudapp_attach.so sha256 b5fb715c9fe7dd48749a01ccd699135eca7f3e5a26635b28c510b5441de7a426; torch 2.14.1+cpu; python Python 3.12.3
diff --git a/evidence/attach-gb10-20261027T0726Z/health.log b/evidence/attach-gb10-20261027T0726Z/health.log
new file mode 100644
index 0000000..efba325
--- /dev/null
+++ b/evidence/attach-gb10-20261027T0726Z/health.log
@@ -0,0 +1,3 @@
+2026-10-27T07:26:56Z before compute-apps=[79557 ] 18091={"busy":false,"concurrency":8,"engine":"omega-qwen36-batch","in_flight":0,"model":"qwen3.6-35b-a3b-fp8","status":"ok","uptime_s":12587}
+2026-10-27T07:26:56Z locked compute-apps=[79557 ] 18091={"busy":false,"concurrency":8,"engine":"omega-qwen36-batch","in_flight":0,"model":"qwen3.6-35b-a3b-fp8","status":"ok","uptime_s":12587}
+2026-10-27T07:27:44Z after compute-apps=[79557 ] 18091={"busy":false,"concurrency":8,"engine":"omega-qwen36-batch","in_flight":0,"model":"qwen3.6-35b-a3b-fp8","status":"ok","uptime_s":12635}
diff --git a/evidence/attach-gb10-20261027T0726Z/torch-receipt.json b/evidence/attach-gb10-20261027T0726Z/torch-receipt.json
new file mode 100644
index 0000000..edb3e00
--- /dev/null
+++ b/evidence/attach-gb10-20261027T0726Z/torch-receipt.json
@@ -0,0 +1,160 @@
+{
+ "schema": "CUDAPP_TORCH_V1",
+ "torch": "2.14.1+cpu",
+ "verdict": "PASS",
+ "cases": [
+  {
+   "op": "cudapp::mm",
+   "m": 1,
+   "k": 1,
+   "n": 1,
+   "dtype": "float32",
+   "mutant": 0,
+   "route": 3,
+   "route_expected": 3,
+   "max_abs_err": 1.4553855010035477e-08,
+   "max_err_over_bound": 0.2094172903959941,
+   "inside_bound": true
+  },
+  {
+   "op": "cudapp::mm",
+   "m": 3,
+   "k": 257,
+   "n": 129,
+   "dtype": "float32",
+   "mutant": 0,
+   "route": 3,
+   "route_expected": 3,
+   "max_abs_err": 1.4199952246940484e-05,
+   "max_err_over_bound": 0.0006810386003039764,
+   "inside_bound": true
+  },
+  {
+   "op": "cudapp::mm",
+   "m": 17,
+   "k": 2048,
+   "n": 96,
+   "dtype": "float32",
+   "mutant": 0,
+   "route": 3,
+   "route_expected": 3,
+   "max_abs_err": 0.00031148626860044715,
+   "max_err_over_bound": 0.00022958310801540795,
+   "inside_bound": true
+  },
+  {
+   "op": "cudapp::mm",
+   "m": 64,
+   "k": 64,
+   "n": 64,
+   "dtype": "float32",
+   "mutant": 0,
+   "route": 3,
+   "route_expected": 3,
+   "max_abs_err": 4.476430376598728e-06,
+   "max_err_over_bound": 0.002678575901699341,
+   "inside_bound": true
+  },
+  {
+   "op": "cudapp::mm",
+   "m": 5,
+   "k": 1809,
+   "n": 33,
+   "dtype": "float32",
+   "mutant": 0,
+   "route": 3,
+   "route_expected": 3,
+   "max_abs_err": 0.00028849767313943175,
+   "max_err_over_bound": 0.0002479941293363415,
+   "inside_bound": true
+  },
+  {
+   "op": "cudapp::mm",
+   "m": 5,
+   "k": 300,
+   "n": 7,
+   "dtype": "bfloat16",
+   "mutant": 0,
+   "route": 1,
+   "route_expected": 1,
+   "max_abs_err": 2.4061650037765503e-05,
+   "max_err_over_bound": 0.006565537468473077,
+   "inside_bound": true
+  },
+  {
+   "op": "cudapp::mm",
+   "m": 32,
+   "k": 128,
+   "n": 64,
+   "dtype": "bfloat16",
+   "mutant": 0,
+   "route": 1,
+   "route_expected": 1,
+   "max_abs_err": 8.58306884765625e-06,
+   "max_err_over_bound": 0.013155373834931455,
+   "inside_bound": true
+  },
+  {
+   "op": "cudapp::mm",
+   "m": 5,
+   "k": 300,
+   "n": 7,
+   "dtype": "float16",
+   "mutant": 0,
+   "route": 1,
+   "route_expected": 1,
+   "max_abs_err": 1.6046687960624695e-05,
+   "max_err_over_bound": 0.004848975923834368,
+   "inside_bound": true
+  },
+  {
+   "op": "cudapp::mm",
+   "m": 32,
+   "k": 128,
+   "n": 64,
+   "dtype": "float16",
+   "mutant": 0,
+   "route": 1,
+   "route_expected": 1,
+   "max_abs_err": 1.1332333087921143e-05,
+   "max_err_over_bound": 0.018825492524675278,
+   "inside_bound": true
+  },
+  {
+   "op": "cudapp::swiglu",
+   "n": 1,
+   "max_abs_err": 8.461514294788586e-09,
+   "max_err_over_bound": 0.0034650273184958064,
+   "inside_bound": true
+  },
+  {
+   "op": "cudapp::swiglu",
+   "n": 1000,
+   "max_abs_err": 1.3221445520628095e-06,
+   "max_err_over_bound": 0.015685670748588225,
+   "inside_bound": true
+  },
+  {
+   "op": "cudapp::swiglu",
+   "n": 65536,
+   "max_abs_err": 3.6893320967124055e-06,
+   "max_err_over_bound": 0.02078471047596202,
+   "inside_bound": true
+  },
+  {
+   "op": "cudapp::mm",
+   "m": 3,
+   "k": 257,
+   "n": 129,
+   "dtype": "float32",
+   "mutant": 1,
+   "route": 3,
+   "route_expected": 3,
+   "max_abs_err": 5.5826134483306085,
+   "max_err_over_bound": 256.6837092618614,
+   "inside_bound": false,
+   "negative_control": true,
+   "caught": true
+  }
+ ]
+}
\ No newline at end of file
diff --git a/evidence/attach-gb10-20261027T0726Z/torch.log b/evidence/attach-gb10-20261027T0726Z/torch.log
new file mode 100644
index 0000000..98d7f47
--- /dev/null
+++ b/evidence/attach-gb10-20261027T0726Z/torch.log
@@ -0,0 +1,15 @@
+{"op": "cudapp::mm", "m": 1, "k": 1, "n": 1, "dtype": "float32", "mutant": 0, "route": 3, "route_expected": 3, "max_abs_err": 1.4553855010035477e-08, "max_err_over_bound": 0.2094172903959941, "inside_bound": true}
+{"op": "cudapp::mm", "m": 3, "k": 257, "n": 129, "dtype": "float32", "mutant": 0, "route": 3, "route_expected": 3, "max_abs_err": 1.4199952246940484e-05, "max_err_over_bound": 0.0006810386003039764, "inside_bound": true}
+{"op": "cudapp::mm", "m": 17, "k": 2048, "n": 96, "dtype": "float32", "mutant": 0, "route": 3, "route_expected": 3, "max_abs_err": 0.00031148626860044715, "max_err_over_bound": 0.00022958310801540795, "inside_bound": true}
+{"op": "cudapp::mm", "m": 64, "k": 64, "n": 64, "dtype": "float32", "mutant": 0, "route": 3, "route_expected": 3, "max_abs_err": 4.476430376598728e-06, "max_err_over_bound": 0.002678575901699341, "inside_bound": true}
+{"op": "cudapp::mm", "m": 5, "k": 1809, "n": 33, "dtype": "float32", "mutant": 0, "route": 3, "route_expected": 3, "max_abs_err": 0.00028849767313943175, "max_err_over_bound": 0.0002479941293363415, "inside_bound": true}
+{"op": "cudapp::mm", "m": 5, "k": 300, "n": 7, "dtype": "bfloat16", "mutant": 0, "route": 1, "route_expected": 1, "max_abs_err": 2.4061650037765503e-05, "max_err_over_bound": 0.006565537468473077, "inside_bound": true}
+{"op": "cudapp::mm", "m": 32, "k": 128, "n": 64, "dtype": "bfloat16", "mutant": 0, "route": 1, "route_expected": 1, "max_abs_err": 8.58306884765625e-06, "max_err_over_bound": 0.013155373834931455, "inside_bound": true}
+{"op": "cudapp::mm", "m": 5, "k": 300, "n": 7, "dtype": "float16", "mutant": 0, "route": 1, "route_expected": 1, "max_abs_err": 1.6046687960624695e-05, "max_err_over_bound": 0.004848975923834368, "inside_bound": true}
+{"op": "cudapp::mm", "m": 32, "k": 128, "n": 64, "dtype": "float16", "mutant": 0, "route": 1, "route_expected": 1, "max_abs_err": 1.1332333087921143e-05, "max_err_over_bound": 0.018825492524675278, "inside_bound": true}
+{"op": "cudapp::swiglu", "n": 1, "max_abs_err": 8.461514294788586e-09, "max_err_over_bound": 0.0034650273184958064, "inside_bound": true}
+{"op": "cudapp::swiglu", "n": 1000, "max_abs_err": 1.3221445520628095e-06, "max_err_over_bound": 0.015685670748588225, "inside_bound": true}
+{"op": "cudapp::swiglu", "n": 65536, "max_abs_err": 3.6893320967124055e-06, "max_err_over_bound": 0.02078471047596202, "inside_bound": true}
+{"op": "cudapp::mm", "m": 3, "k": 257, "n": 129, "dtype": "float32", "mutant": 1, "route": 3, "route_expected": 3, "max_abs_err": 5.5826134483306085, "max_err_over_bound": 256.6837092618614, "inside_bound": false, "negative_control": true, "caught": true}
+PASS
+torch rc=0
diff --git a/tests/native/kinds.sh b/tests/native/kinds.sh
index 055e2e0..3e14319 100755
--- a/tests/native/kinds.sh
+++ b/tests/native/kinds.sh
@@ -18,6 +18,11 @@ frame() {  # frame <dir> <fsum source>
   { cat "$2"; printf '\0'; printf '%08d' "$(wc -c < "$1/fsum.bin")"; cat "$1/fsum.bin"
     cat "$T/halve.om"; printf '\0'; printf '%08d' "$(wc -c < "$1/halve.bin")"; cat "$1/halve.bin"; }
 }
+pylib() {  # pylib <dir> <fsum source>: the python word's binding and its library, side by side
+  mkdir -p "$1/py"; frame "$1" "$2" | "$O/native" python > "$1/py/omega_native.py"
+  frame "$1" "$2" | "$O/native" c > "$1/py/omega_native.c"
+  cc -std=gnu11 -O2 -Wall -Wextra -Werror -fPIC -shared -o "$1/py/libomega_native.so" "$1/py/omega_native.c"
+}
 build() {  # build <dir> <fsum source>
   frame "$1" "$2" | "$O/native" c > "$1/omega_native.c"
   cc -std=gnu11 -O2 -Wall -Wextra -Werror -o "$1/kinds" "$T/kinds.c" "$1/omega_native.c"
@@ -32,6 +37,10 @@ grep -q '_a10 = ctypes.POINTER(ctypes.c_uint16)' "$O/omega_native.py"
 grep -q 'omega_fsum.argtypes = \[_res, _a8, _u64, _a10, _u64, _a7, _u64\]' "$O/omega_native.py"
 frame "$O" "$T/fsum.om" | "$O/native" rust > "$O/omega_native.rs"
 grep -q 'o_a: \*const u8, o_a_len: u64, o_h: \*const u8, o_h_len: u64, o_d: \*mut u8, o_d_len: u64' "$O/omega_native.rs"
+# The f32/ushort kinds called through the generated Python binding, with refusal controls.
+pylib "$O" "$T/fsum.om"
+if python3 -I "$T/pykinds.py" "$O/py" > "$O/py.log" 2>&1; then echo "PASS python binding: f32/ushort calls and refusals ($(grep -c '^PASS' "$O/py.log") checks)"
+else echo "FAIL python binding"; cat "$O/py.log"; exit 1; fi
 # A uint array is still outside the subset: exit 110, and the previous C file is untouched.
 cp "$O/omega_native.c" "$O/keep.c"
 printf 'fn bad a view uint 1 to ulong\nret 0\nend\n' > "$O/bad.om"
@@ -48,4 +57,7 @@ grep -q '^put d i sub' "$O/mut/fsum.om" || { echo "FAIL mutant not applied"; exi
 build "$O/mut" "$O/mut/fsum.om"
 if "$O/mut/kinds" > "$O/mut/log" 2>&1; then echo "FAIL mutant fsum (add -> sub) not caught"; exit 1; fi
 echo "PASS mutant fsum (add -> sub) caught ($(grep -c '^FAIL' "$O/mut/log") failing checks)"
+pylib "$O/mut" "$O/mut/fsum.om"
+if python3 -I "$T/pykinds.py" "$O/mut/py" > "$O/mut/py.log" 2>&1; then echo "FAIL mutant fsum not caught through the python binding"; exit 1; fi
+echo "PASS mutant fsum (add -> sub) caught through the python binding ($(grep -c '^FAIL' "$O/mut/py.log") failing checks)"
 echo "NATIVE-KINDS PASS"
diff --git a/tests/native/pykinds.py b/tests/native/pykinds.py
new file mode 100644
index 0000000..57b18a3
--- /dev/null
+++ b/tests/native/pykinds.py
@@ -0,0 +1,46 @@
+# Python caller for the f32 and ushort array kinds through the binding tools' `python` word generates
+# (ctypes, standard library only). argv: the folder holding omega_native.py and libomega_native.so.
+# Every expected value is computed here in Python (struct), independently of the Omega code.
+import ctypes, struct, sys
+sys.path.insert(0, sys.argv[1])
+import omega_native as om
+fails = 0
+def check(name, ok):
+    global fails
+    print(("PASS " if ok else "FAIL ") + name)
+    fails += not ok
+def f32(x):
+    return struct.unpack("<f", struct.pack("<f", x))[0]
+def f32bits(x):
+    return struct.unpack("<I", struct.pack("<f", x))[0]
+def f16bits(x):
+    return struct.unpack("<H", struct.pack("<e", x))[0]
+def refused(f):
+    try:
+        f()
+    except ctypes.ArgumentError:
+        return True
+    return False
+F, H, SENT = ctypes.c_float, ctypes.c_uint16, 6148914691236517205
+av = [1.5, 2.25, -3.0, 0.125]; hv = [1.0, 0.5, 2.0, -0.25]
+a = (F * 4)(*av); h = (H * 4)(*[f16bits(x) for x in hv]); o = (F * 4)()
+want = [f32(x + y) for x, y in zip(av, hv)]
+r = ctypes.c_uint64(SENT)
+check("fsum f32 view + ushort view -> f32 edit == Python",
+      om.omega_fsum(ctypes.byref(r), a, 4, h, 4, o, 4) == 0 and list(o) == want)
+check("fsum result bits == Python", r.value == f32bits(f32(want[0] + want[3])))
+g = (H * 3)(*[f16bits(x) for x in (3.0, -0.75, 1024.0)])
+check("halve ushort edit written in place == Python",
+      om.omega_halve(ctypes.byref(r), g, 3) == 0 and list(g) == [f16bits(x) for x in (1.5, -0.375, 512.0)])
+# Negative controls: what the ABI cannot carry is refused before the Omega code runs.
+r = ctypes.c_uint64(SENT); o2 = (F * 4)()
+check("fsum wrong length 3 refused (status 32), output and result untouched",
+      om.omega_fsum(ctypes.byref(r), a, 3, h, 4, o2, 4) == 32 and list(o2) == [0.0] * 4 and r.value == SENT)
+check("halve wrong length 4 refused (status 32), array untouched",
+      om.omega_halve(ctypes.byref(r), g, 4) == 32 and list(g) == [f16bits(x) for x in (1.5, -0.375, 512.0)])
+check("f64 array for an f32 view refused", refused(lambda: om.omega_fsum(ctypes.byref(r), (ctypes.c_double * 4)(), 4, h, 4, o, 4)))
+check("int32 array for an f32 view refused", refused(lambda: om.omega_fsum(ctypes.byref(r), (ctypes.c_int32 * 4)(), 4, h, 4, o, 4)))
+check("bytes for an edit ushort array refused", refused(lambda: om.omega_halve(ctypes.byref(r), bytes(6), 3)))
+check("length 2**64 refused", refused(lambda: om.omega_halve(ctypes.byref(r), g, 2**64)))
+print(("FAIL " if fails else "PASS ") + "%d failure(s)" % fails)
+sys.exit(fails != 0)