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 / AGENTS.md

108 lines · 12784 bytes Raw Blame History Source

Omega Bridge (Omega's compatibility gateway: a checked Omega subset converted to C and Python, native call bindings and GPU artifact negotiation)

src/toc.om is an Omega program, built by the pinned seeded Omega compiler, that emits executable C and Python from a checked, bounded Omega subset (ABI v0). src/native.om generates a C binding so C, C++, Python, Rust, Zig and Go call the machine code the seeded compiler produced (native call ABI v1/v2). src/gpu_adapter.om is an opt-in GPU adapter boundary that negotiates and admits artifacts; it converts no host program. The bootstrap and generators require Linux AArch64; emitted C is portable to Linux x86-64, and hosted native output also has explicit x86-64 SysV Linux selection, exercised under QEMU 10.0.14 (physical x86 NOT_RUN). Independent review remains required before release; no universal conversion or speedup is claimed.

Ownership rule (ARCH-0042, aien-dev/aien-architecture-mv#342, Accepted (Drake, 2026-10-30)): Omega owns computation, CUDA++ owns GPU execution, Omega Bridge owns compatibility. This repository is not a second Omega compiler, encoder or GPU runtime: it builds with omega-mv's pinned compiler and runs Omega GPU work only through aien-dev/CUDApp. Remaining overlaps: omega-mv#870 (own seed bootstrap), omega-mv#871 (own front end in src/toc.om).

Shared rules: read https://www.aienos.com/agents/RULES.md first. This file adds what is specific to this repository; where the two differ, this file wins here.

Scope

Installation

Needs a Linux AArch64 build host, git, sh, file, sha256sum, gcc and python3. The bootstrap uses no C compiler, assembler or linker. Cross-building hosted x86 native libraries additionally needs an x86-targeting CC; it does not make the bootstrap or generator runnable on x86.

git clone https://github.com/aien-dev/omega-bridge.git
cd omega-bridge
sh tools/bootstrap.sh   # fetches the pinned Omega source commit, grows omc from the seed, checks the fixpoint
tools/build.sh          # builds build/bridge from src/toc.om with the pinned seed

The bootstrap fetches the Omega source commit recorded in docs/PROVENANCE.md (29b12760f4c962606411d6bf25032aedef063301), so it needs access to the upstream repository. It ends with bootstrap fixpoint RC=0 and leaves the seed at build/bootstrap/omc (sha256 191b776ef98821597c3e30655da6d680a9b66edbc9ceaca3c39c61ea6df098e9).

Configuration

Usage

# Full local suite: build, differential (native vs C vs Python), refusals, callers, controls, robustness
tools/test.sh

# Convert and run an example
tools/bridge c tests/fixtures/fib.om > build/fib.c
gcc -std=gnu11 -O2 build/fib.c -o build/fib
build/fib
tools/bridge python tests/fixtures/fib.om > build/fib.py
python3 build/fib.py

# Real C and Python application callers of a generated library
python3 tests/attachments.py

# Native call ABI v1: one compiled Omega function called from C, C++, Python, Rust, Zig, Go
OMEGA_NATIVE_OMC=/path/to/omega-mv/seed/out/omc sh tests/native/run.sh

# f32 and ushort array kinds (C oracle, refusals, add->sub mutant)
OMEGA_NATIVE_OMC=/path/to/omega-mv/seed/out/omc sh tests/native/kinds.sh

# Hosted x86 native output (cross-build only; this command does not execute callers)
OMEGA_NATIVE_OMC=/path/to/baseline/omc OMEGA_NATIVE_X86_OMC=/path/to/x86/omc \
  CC=x86_64-linux-gnu-gcc tools/native --target x86linux build/native-x86 tests/native/madd.om

# GPU adapter protocol (no device is opened)
OMEGA_SEED=build/bootstrap/omc sh tools/build-gpu-adapter.sh
python3 tests/gpu/test_gpu_adapter.py

tools/test.sh ends with ALL SUITES RC=0. tests/native/run.sh emits NATIVE-CALL PASS only after all seven required callers (including C with BTI) have built and executed successfully. Missing language toolchains emit NOT_RUN and exit nonzero; present toolchains whose builds fail emit FAIL and exit nonzero. tests/native/test_build_failures.sh exercises both refusal paths with failing-toolchain controls, then runs the real Zig and Go callers. tools/bridge writes to stdout only after the whole conversion succeeds and refuses to run if build/compiler.sha256 no longer matches (rebuild with tools/build.sh).

conformance/run.sh needs MAXPY (a Modular MAX 26.7 venv); without --device it runs on CPU only. conformance/run.sh --device, tools/run-device-window.sh --ledger <ID> and build/run-device-window --ledger <ID> need the NVIDIA GB10 on a DGX Spark inside an authorized spark-window, plus a sibling CUDApp build. Do not run them anywhere else.

Conventions

Safety and approvals

Further reading