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 / GPU-ADAPTER.md

176 lines · 6913 bytes Raw Blame History Source

Omega Bridge GPU adapter protocol v1

Status: implemented and host-qualified (src/gpu_adapter.om, 47 checks). No device is opened by the adapter. Hardware load/execution is NOT_RUN until a coordinated Spark window; see GPU-SUPPORT-MATRIX.md.

1. What this is, and what it is not

Bridge is the attachment and translation/interop owner. This adapter decides whether a named consumer may attach to a named GPU adapter under declared capabilities. It is a pure boundary:

Native ownership follows ARCH-0042 (Omega owns computation, CUDA++ owns GPU execution, Omega Bridge owns compatibility). CUDA++ (aien-dev/CUDApp) owns the sm_121 encoder, GPU code generator, QMD template, driver client, kernel runtime, artifact exporter and cubin verifier. Omega (aien-dev/omega-mv) owns the language, the compiler and the declared kernel contract. MAX/Mojo extensions, if any, remain isolated third-party artifacts.

2. Activation

The adapter is disabled by default because nothing invokes it unless a caller runs the binary. There is no daemon, no environment hook, no automatic attachment and no write outside the caller's own files. A caller must read the verdict and may only proceed on ACCEPT. REFUSE is final for that request.

Build (source-only, pinned seed):

sh tools/build-gpu-adapter.sh          # uses build/omc or $OMEGA_SEED
python3 tests/gpu/test_gpu_adapter.py  # 47 checks, no device
# With --artifact PREFIX (a CUDApp exported manifest) the test adds one ACCEPT
# verdict worth 2 checks: 49, as recorded in evidence/MAX-INTEROP/3/tests.log.

3. Wire format

One request on stdin, one response on stdout. UTF-8/ASCII, one key=value per line, LF line endings. The first line is the protocol identifier. Key order is part of the contract: unknown, duplicate or out-of-order keys are refused.

3.1 Negotiation (14 lines)

omega-bridge-gpu-adapter/1
mode=negotiate
adapter=gb10-native-cubin|fake-gpu
consumer=omega|max
backend=nvidia|fake
isa=sm_121|fake-1
driver=MAJOR.MINOR.PATCH
abi=omega-gpu-platform/1.2
dtypes=bf16,f32
capabilities=cubin-load,launch-template,memory-handoff
rights=read,execute
sync=explicit
telemetry=off
contract_id=<64 lowercase hex>

gb10-native-cubin requires backend=nvidia, isa=sm_121 and a driver at least 580.173.02. fake-gpu requires backend=fake and isa=fake-1; it is nonexecuting and exists for deterministic round-trip fixtures. The capability, dtype, rights, sync and telemetry strings are exact sets: a request for a subset or a superset is refused, never silently downgraded. telemetry=off means the adapter itself initiates nothing; a consumer's own telemetry remains the consumer's declared policy.

3.2 Artifact admission (20 lines)

Same 14 lines, then:

artifact_id=<64 lowercase hex>
kernel_format=nvidia-cubin-elf64
qmd_template=zero-va-v1
receipt=valid
ownership=producer
alias=none

adapter=fake-gpu cannot admit a native artifact (E_ADAPTER). receipt must be valid; stale and missing are refused. ownership=producer means the artifact producer (Omega/CUDApp) owns the realization and the consumer receives only the declared rights. alias=none declares no overlapping inputs/outputs. The QMD template must carry zero device addresses; a live-address QMD is refused. Text, cubin, QMD and cbank digests are bound by the artifact manifest and checked by the admitting loader (CUDApp omega_native_artifact_admit), not re-derived here.

3.3 Response

ACCEPT (exit 0):

omega-bridge-gpu-adapter/1
verdict=ACCEPT
adapter=<value>
consumer=<value>
isa=<value>
contract_id=<64 hex>
request_sha256=<64 hex>

REFUSE (exit 3):

omega-bridge-gpu-adapter/1
verdict=REFUSE
code=E_<NAME>
request_sha256=<64 hex>

request_sha256 is SHA-256 over the exact request bytes. It binds the verdict to the request and makes replay/round-trip tests deterministic.

4. Named refusals

codemeaning
E_VERSIONreserved
E_ORDERwrong line count/order, duplicate or unknown key, bad header
E_MODEunknown mode
E_ADAPTERunknown adapter, or a nonexecuting adapter asked to admit
E_BACKENDbackend does not match the adapter
E_ISAISA/profile does not match the adapter
E_DRIVERdriver malformed or older than the adapter's minimum
E_ABIplatform ABI mismatch
E_DTYPEStensor dtype set mismatch
E_CAPABILITYrequested capability set not supported (includes unknown consumer)
E_RIGHTSrights set mismatch
E_SYNCimplicit ordering requested
E_TELEMETRYtelemetry policy not off
E_CONTRACTcontract id malformed
E_ARTIFACTartifact id malformed
E_FORMATkernel format other than the cubin container
E_RELOCQMD template declares a live device address
E_RECEIPTreceipt stale, missing or not valid
E_OWNERSHIPownership declaration not producer
E_ALIASalias declaration not none
E_LIMITinput too large / hash failure
E_IOstdin read failure

A refusal carries no partial acceptance and no fallback target.

5. Memory, streams and lifetime (contract, not implementation)

6. Reproducibility and evidence

tools/build-gpu-adapter.sh enforces the seed fingerprint 191b776ef98821597c3e30655da6d680a9b66edbc9ceaca3c39c61ea6df098e9 and records the source and binary hashes. tests/gpu/test_gpu_adapter.py covers acceptance, determinism, request binding, every named refusal, structural corruption and the no-fallback rule. Raw logs live in evidence/MAX-INTEROP/3/.

No universal compatibility, no cross-vendor execution and no performance claim is made. Host tests are not hardware evidence.