interplane.Get Omega
Read in your language

omega-bridge

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

Brought by drakestapleton

branch main Branches Tags History

omega-bridge / docs / MAX-INTEGRATION.md

95 lines · 5285 bytes Raw Blame History Rendered
1# MAX integration: measured state and the exact blocker
2
3Pinned MAX: `max/v26.7.0` = `527d069ee11a41ac5320af1f9402db0a66b2b868`
4(`mojo/v1.2.0`). Full source analysis: [MAX-26.7-FEASIBILITY.md](max/MAX-26.7-FEASIBILITY.md).
5
6## What is proven
7
81. **Container.** A CUDApp-generated sm_121 kernel is packaged as a cubin ELF and
9 read back by `nvdisasm`/`cuobjdump`; the text section equals the generated
10 bytes and the parameter metadata targets the CUDA constant-bank ABI
11 (`0x380`). This is offline evidence, not a device load.
122. **Admission.** The Bridge GPU adapter accepts the exported artifact under
13 `nvidia-cubin-elf64`, zero-VA QMD, fresh receipt and producer ownership, and
14 refuses wrong ISA/driver/ABI/capability/rights/sync/format/reloc/receipt/
15 ownership/alias. 49 checks, no device.
163. **Numeric equivalence (host).** MAX 26.7 on CPU and the CUDApp host path
17 produce **bit-identical** f32 output for the frozen matmul fixture
18 (`sha256 60a7f7d4…`); MAX causal GQA matches the fp64 oracle within
19 `2.7e-7`, far inside the contract tolerance. This validates the harness and
20 the mathematical embedding, not GB10 execution.
214. **Evidence binding.** The envelope binds artifact/cubin/QMD/input/output/
22 contract/ISA and a 416-byte TEST-class C2 receipt; tampering, stale epochs
23 and wrong ids are refused.
24
25## CPU route: Omega kernel as a MAX custom op — EXERCISED(host CPU)
26
27On the Spark's Grace aarch64 host, MAX 26.7.0 runs the seeded Omega unit
28`max-cpu/omatmul.om` (bf16 → f32 matmul) **inside a MAX graph** as the CPU custom
29op `omega_matmul`. The library comes from the unchanged `tools/native` path; the
30only non-Omega code is one Mojo glue file (`max-cpu/kernels/__init__.mojo`,
31`OwnedDLHandle` + dlsym) and the Python harness. `max-cpu/run.sh` reproduces it:
3215 numeric cases PASS within the Wolfram-derived f32 bound and bit-identical to
33`ops.matmul`; wrong-symbol, plain-`external_call`, shape-refusal (Omega results
341/2/3, plus a graph-construction refusal) and index-mutant negatives all fail as
35required. At 256x256x256 the scalar Omega op is 112x slower than `ops.matmul`
36(warm p50 49.4 ms vs 0.44 ms). This is a host-CPU result only; it says nothing
37about GB10 and is not a hardware qualification. Evidence, pins, the six Omega
38gaps and a MAX 26.7.0 kernel-cache observation:
39[evidence/MAX-CPU/README.md](../evidence/MAX-CPU/README.md).
40
41## What is not proven, and why
42
43- **No GB10 run exists.** The chip is reserved by the coordinator
44 (`CHIP-RESERVED` lists L332 L424 L401 …), so `spark-window open` refuses. Every
45 device row is `NOT_RUN`; no simulation is substituted.
46- **Pinned 26.7.0 does not ship the HAL bundle path.** `SDK/`, `Target/`,
47 `MLRT/`, `max/driver/` are main-only. At the pin the only source-visible
48 external-code entry is Mojo `DeviceContext.load_function(function_name, asm:
49 String)`; its docstring says PTX/SASS, but only PTX is tested and `String`
50 requires valid UTF-8, so raw cubin transport is **UNKNOWN**.
51- **Main's HAL path accepts cubin structurally** (`M_driver_static_bundle` →
52 `M_driver_bundle_load` → `cuModuleLoadDataEx` → `cuModuleGetFunction` →
53 `cuModuleLaunch`), and NeoDriver sets `file_type="cubin"`. But it is not in
54 the pinned release, is not the production path, and is not reachable from
55 public Python `max.driver`.
56- MAX on NVIDIA is **not CUDA-free**: the CUDA backend loads `libcuda.so.1`.
57
58## Upstream request (draft; not submitted)
59
60A byte-safe native-module entry point in the pinned release, with MAX retaining
61device, context, stream, allocation and error ownership. Minimum shape:
62
63```c
64// Proposed, not existing API.
65M_driver_status M_driver_bundle_load_bytes(
66 M_driver_context *ctx, const uint8_t *data, size_t size,
67 const char *file_type /* "cubin" */, M_driver_bundle **out);
68M_driver_status M_driver_function_load(
69 M_driver_bundle *b, const char *entry, M_driver_function **out);
70M_driver_status M_driver_queue_execute(
71 M_driver_queue *q, M_driver_function *f,
72 const void *const *kernel_params, uint32_t grid[3], uint32_t block[3],
73 uint32_t shared_bytes, M_driver_completion **done);
74```
75
76Acceptance requested: (a) cubin ELF accepted as bytes, not a UTF-8 string;
77(b) primary-context identity documented so an external producer knows which
78context the module lands in; (c) deterministic error for a wrong arch/entry;
79(d) no cross-context pointer sharing implied; (e) a qualification test that
80loads a cubin, not only PTX.
81
82Until that exists or the release exposes the main HAL path, this repository
83does **not** claim in-graph native GPU execution (the CPU route above is a separate,
84host-only result). The separate-process harness is the
85supported demonstration, and it is ready to run the moment a GPU window is
86authorized.
87
88## Next probes (all NOT_RUN)
89
90G1 load the exported cubin through `cuModuleLoadData` and launch with
91`cuLaunchKernel` on GB10; G2 load a PTX string through `load_function` on the
92pin; G3 attempt the same with cubin bytes through an unsafe `String` only if the
93licence and safety review permit; G4 repeat Stage A through MAX's public
94graph/engine on GB10; G5 compare numeric output to the independent oracle and
95record receipts. Details: [MAX-26.7-PROBE-PLAN.md](max/MAX-26.7-PROBE-PLAN.md).