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 Source

MAX integration: measured state and the exact blocker

Pinned MAX: max/v26.7.0 = 527d069ee11a41ac5320af1f9402db0a66b2b868 (mojo/v1.2.0). Full source analysis: MAX-26.7-FEASIBILITY.md.

What is proven

  1. Container. A CUDApp-generated sm_121 kernel is packaged as a cubin ELF and read back by nvdisasm/cuobjdump; the text section equals the generated bytes and the parameter metadata targets the CUDA constant-bank ABI (0x380). This is offline evidence, not a device load.
  2. Admission. The Bridge GPU adapter accepts the exported artifact under nvidia-cubin-elf64, zero-VA QMD, fresh receipt and producer ownership, and refuses wrong ISA/driver/ABI/capability/rights/sync/format/reloc/receipt/ ownership/alias. 49 checks, no device.
  3. Numeric equivalence (host). MAX 26.7 on CPU and the CUDApp host path produce bit-identical f32 output for the frozen matmul fixture (sha256 60a7f7d4…); MAX causal GQA matches the fp64 oracle within 2.7e-7, far inside the contract tolerance. This validates the harness and the mathematical embedding, not GB10 execution.
  4. Evidence binding. The envelope binds artifact/cubin/QMD/input/output/ contract/ISA and a 416-byte TEST-class C2 receipt; tampering, stale epochs and wrong ids are refused.

CPU route: Omega kernel as a MAX custom op — EXERCISED(host CPU)

On the Spark's Grace aarch64 host, MAX 26.7.0 runs the seeded Omega unit max-cpu/omatmul.om (bf16 → f32 matmul) inside a MAX graph as the CPU custom op omega_matmul. The library comes from the unchanged tools/native path; the only non-Omega code is one Mojo glue file (max-cpu/kernels/__init__.mojo, OwnedDLHandle + dlsym) and the Python harness. max-cpu/run.sh reproduces it: 15 numeric cases PASS within the Wolfram-derived f32 bound and bit-identical to ops.matmul; wrong-symbol, plain-external_call, shape-refusal (Omega results 1/2/3, plus a graph-construction refusal) and index-mutant negatives all fail as required. At 256x256x256 the scalar Omega op is 112x slower than ops.matmul (warm p50 49.4 ms vs 0.44 ms). This is a host-CPU result only; it says nothing about GB10 and is not a hardware qualification. Evidence, pins, the six Omega gaps and a MAX 26.7.0 kernel-cache observation: evidence/MAX-CPU/README.md.

What is not proven, and why

Upstream request (draft; not submitted)

A byte-safe native-module entry point in the pinned release, with MAX retaining device, context, stream, allocation and error ownership. Minimum shape:

// Proposed, not existing API.
M_driver_status M_driver_bundle_load_bytes(
    M_driver_context *ctx, const uint8_t *data, size_t size,
    const char *file_type /* "cubin" */, M_driver_bundle **out);
M_driver_status M_driver_function_load(
    M_driver_bundle *b, const char *entry, M_driver_function **out);
M_driver_status M_driver_queue_execute(
    M_driver_queue *q, M_driver_function *f,
    const void *const *kernel_params, uint32_t grid[3], uint32_t block[3],
    uint32_t shared_bytes, M_driver_completion **done);

Acceptance requested: (a) cubin ELF accepted as bytes, not a UTF-8 string; (b) primary-context identity documented so an external producer knows which context the module lands in; (c) deterministic error for a wrong arch/entry; (d) no cross-context pointer sharing implied; (e) a qualification test that loads a cubin, not only PTX.

Until that exists or the release exposes the main HAL path, this repository does not claim in-graph native GPU execution (the CPU route above is a separate, host-only result). The separate-process harness is the supported demonstration, and it is ready to run the moment a GPU window is authorized.

Next probes (all NOT_RUN)

G1 load the exported cubin through cuModuleLoadData and launch with cuLaunchKernel on GB10; G2 load a PTX string through load_function on the pin; G3 attempt the same with cubin bytes through an unsafe String only if the licence and safety review permit; G4 repeat Stage A through MAX's public graph/engine on GB10; G5 compare numeric output to the independent oracle and record receipts. Details: MAX-26.7-PROBE-PLAN.md.