Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-bridge/blob/main/docs/GPU-ADAPTER.md # omega-bridge Omega-first language interoperability: checked conversion backends and native language bindings Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-bridge / docs / GPU-ADAPTER.md` 176 lines ยท 6913 bytes Raw Blame History Rendered 1 # Omega Bridge GPU adapter protocol v1 2 3 Status: implemented and host-qualified (`src/gpu_adapter.om`, 47 checks). No 4 device is opened by the adapter. Hardware load/execution is **NOT_RUN** until a 5 coordinated Spark window; see [GPU-SUPPORT-MATRIX.md](GPU-SUPPORT-MATRIX.md). 6 7 ## 1. What this is, and what it is not 8 9 Bridge is the attachment and translation/interop owner. This adapter decides 10 whether a named consumer may attach to a named GPU adapter under declared 11 capabilities. It is a pure boundary: 12 13 - it does not encode instructions, load a cubin, allocate device memory, submit 14 work or synchronize a device; 15 - it never returns a device pointer, virtual address, DMA handle or capability; 16 - it never falls back to CPU, to another backend, or to a less capable adapter; 17 - it has no network, telemetry or install path. 18 19 Native ownership follows ARCH-0042 (Omega owns computation, CUDA++ owns GPU 20 execution, Omega Bridge owns compatibility). CUDA++ (aien-dev/CUDApp) owns the 21 sm_121 encoder, GPU code generator, QMD template, driver client, kernel runtime, 22 artifact exporter and cubin verifier. Omega (aien-dev/omega-mv) owns the language, 23 the compiler and the declared kernel contract. MAX/Mojo extensions, if any, remain 24 isolated third-party artifacts. 25 26 ## 2. Activation 27 28 The adapter is **disabled by default** because nothing invokes it unless a 29 caller runs the binary. There is no daemon, no environment hook, no automatic 30 attachment and no write outside the caller's own files. A caller must read the 31 verdict and may only proceed on `ACCEPT`. `REFUSE` is final for that request. 32 33 Build (source-only, pinned seed): 34 35 ```sh 36 sh tools/build-gpu-adapter.sh # uses build/omc or $OMEGA_SEED 37 python3 tests/gpu/test_gpu_adapter.py # 47 checks, no device 38 # With --artifact PREFIX (a CUDApp exported manifest) the test adds one ACCEPT 39 # verdict worth 2 checks: 49, as recorded in evidence/MAX-INTEROP/3/tests.log. 40 ``` 41 42 ## 3. Wire format 43 44 One request on stdin, one response on stdout. UTF-8/ASCII, one `key=value` per 45 line, LF line endings. The first line is the protocol identifier. Key order is 46 part of the contract: unknown, duplicate or out-of-order keys are refused. 47 48 ### 3.1 Negotiation (14 lines) 49 50 ``` 51 omega-bridge-gpu-adapter/1 52 mode=negotiate 53 adapter=gb10-native-cubin|fake-gpu 54 consumer=omega|max 55 backend=nvidia|fake 56 isa=sm_121|fake-1 57 driver=MAJOR.MINOR.PATCH 58 abi=omega-gpu-platform/1.2 59 dtypes=bf16,f32 60 capabilities=cubin-load,launch-template,memory-handoff 61 rights=read,execute 62 sync=explicit 63 telemetry=off 64 contract_id=<64 lowercase hex> 65 ``` 66 67 `gb10-native-cubin` requires `backend=nvidia`, `isa=sm_121` and a driver at 68 least `580.173.02`. `fake-gpu` requires `backend=fake` and `isa=fake-1`; it is 69 nonexecuting and exists for deterministic round-trip fixtures. The capability, 70 dtype, rights, sync and telemetry strings are exact sets: a request for a subset 71 or a superset is refused, never silently downgraded. `telemetry=off` means the 72 adapter itself initiates nothing; a consumer's own telemetry remains the 73 consumer's declared policy. 74 75 ### 3.2 Artifact admission (20 lines) 76 77 Same 14 lines, then: 78 79 ``` 80 artifact_id=<64 lowercase hex> 81 kernel_format=nvidia-cubin-elf64 82 qmd_template=zero-va-v1 83 receipt=valid 84 ownership=producer 85 alias=none 86 ``` 87 88 `adapter=fake-gpu` cannot admit a native artifact (`E_ADAPTER`). `receipt` must 89 be `valid`; `stale` and `missing` are refused. `ownership=producer` means the 90 artifact producer (Omega/CUDApp) owns the realization and the consumer receives 91 only the declared rights. `alias=none` declares no overlapping inputs/outputs. 92 The QMD template must carry zero device addresses; a live-address QMD is 93 refused. Text, cubin, QMD and cbank digests are bound by the artifact manifest 94 and checked by the admitting loader (CUDApp `omega_native_artifact_admit`), not 95 re-derived here. 96 97 ### 3.3 Response 98 99 `ACCEPT` (exit 0): 100 101 ``` 102 omega-bridge-gpu-adapter/1 103 verdict=ACCEPT 104 adapter= 105 consumer= 106 isa= 107 contract_id=<64 hex> 108 request_sha256=<64 hex> 109 ``` 110 111 `REFUSE` (exit 3): 112 113 ``` 114 omega-bridge-gpu-adapter/1 115 verdict=REFUSE 116 code=E_ 117 request_sha256=<64 hex> 118 ``` 119 120 `request_sha256` is SHA-256 over the exact request bytes. It binds the verdict 121 to the request and makes replay/round-trip tests deterministic. 122 123 ## 4. Named refusals 124 125 | code | meaning | 126 |---|---| 127 | `E_VERSION` | reserved | 128 | `E_ORDER` | wrong line count/order, duplicate or unknown key, bad header | 129 | `E_MODE` | unknown mode | 130 | `E_ADAPTER` | unknown adapter, or a nonexecuting adapter asked to admit | 131 | `E_BACKEND` | backend does not match the adapter | 132 | `E_ISA` | ISA/profile does not match the adapter | 133 | `E_DRIVER` | driver malformed or older than the adapter's minimum | 134 | `E_ABI` | platform ABI mismatch | 135 | `E_DTYPES` | tensor dtype set mismatch | 136 | `E_CAPABILITY` | requested capability set not supported (includes unknown consumer) | 137 | `E_RIGHTS` | rights set mismatch | 138 | `E_SYNC` | implicit ordering requested | 139 | `E_TELEMETRY` | telemetry policy not `off` | 140 | `E_CONTRACT` | contract id malformed | 141 | `E_ARTIFACT` | artifact id malformed | 142 | `E_FORMAT` | kernel format other than the cubin container | 143 | `E_RELOC` | QMD template declares a live device address | 144 | `E_RECEIPT` | receipt stale, missing or not `valid` | 145 | `E_OWNERSHIP` | ownership declaration not `producer` | 146 | `E_ALIAS` | alias declaration not `none` | 147 | `E_LIMIT` | input too large / hash failure | 148 | `E_IO` | stdin read failure | 149 150 A refusal carries no partial acceptance and no fallback target. 151 152 ## 5. Memory, streams and lifetime (contract, not implementation) 153 154 - **Address spaces are not shared.** Omega's device VAs and a consumer's 155 context VAs are distinct. Nothing in this protocol licenses reuse of a raw 156 pointer, DMA handle or allocation across contexts. 157 - **Ownership is explicit.** The producer owns the realization and its 158 resources; the consumer holds only `read,execute` for the admitted artifact. 159 Transfer of a buffer requires a separate, explicit handoff with its own 160 identity and lifetime; this protocol carries no buffers. 161 - **Synchronization is explicit.** `sync=explicit` means the consumer must 162 complete the producer's declared ordering before reading results. The adapter 163 does not create events or fences. 164 - **Failure is terminal for the request.** The adapter never retries, never 165 substitutes a backend and never reports success for an unqualified device. 166 167 ## 6. Reproducibility and evidence 168 169 `tools/build-gpu-adapter.sh` enforces the seed fingerprint 170 ``191b776ef98821597c3e30655da6d680a9b66edbc9ceaca3c39c61ea6df098e9`` and records the 171 source and binary hashes. `tests/gpu/test_gpu_adapter.py` covers acceptance, 172 determinism, request binding, every named refusal, structural corruption and the 173 no-fallback rule. Raw logs live in `evidence/MAX-INTEROP/3/`. 174 175 No universal compatibility, no cross-vendor execution and no performance claim 176 is made. Host tests are not hardware evidence.