omega-bridge
Omega-first language interoperability: checked conversion backends and native language bindings
Brought by drakestapleton
omega-bridge / evidence / freest-runtime-views / README.md
| 1 | # Freestanding checked borrowed views |
| 2 | |
| 3 | IMPLEMENTED and EXERCISED on branch `feat/freestanding-runtime-views`, based on |
| 4 | omega-bridge #76 at `741c1ebb2b0fbae311a77ad2118b13d5ec7a17ee`. |
| 5 | Not MERGED, DEPLOYED or hardware QUALIFIED. GPU/device execution: NOT_RUN. |
| 6 | |
| 7 | ## Source and execution boundary |
| 8 | |
| 9 | All conversion logic is seeded Omega in `src/toc.om`; the shell driver only |
| 10 | validates the pinned compiler fingerprints, snapshots source, selects a profile |
| 11 | and publishes completed output. The hosted runtime and public ABI are unchanged. |
| 12 | The new runtime passes a call-local status/depth pointer through private C |
| 13 | functions. It uses checked 64-bit operations rather than int128, and has no |
| 14 | TLS, libc/POSIX, longjmp, abort or printf imports. Scalar-only input continues |
| 15 | to use the original conservative `src/freest.om` profile. A view-bearing unit |
| 16 | never retries that profile after conversion refusal. |
| 17 | |
| 18 | Every compiler, test and mutant invocation used this outer isolation: |
| 19 | |
| 20 | ```sh |
| 21 | bwrap --dev-bind / / --dev /dev --proc /proc -- \ |
| 22 | taskset -c 10-14 nice -n 10 <command> |
| 23 | ``` |
| 24 | |
| 25 | No GPU nodes, live service, module, chip lock or PID 68451 was touched. No parallel |
| 26 | builds or `make -j` were used. The C compiler/linker, Python ctypes, nm, readelf, |
| 27 | and user-mode QEMU are verification/conversion infrastructure, not generated |
| 28 | runtime dependencies. The source/frontend pins remain unchanged: |
| 29 | |
| 30 | - Baseline seed: `191b776ef98821597c3e30655da6d680a9b66edbc9ceaca3c39c61ea6df098e9`. |
| 31 | - Seeded validator: omega-mv `e5b32567`, |
| 32 | `2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f`. |
| 33 | |
| 34 | `commands.tsv` records exact environments, commands, rc and final lines. Each |
| 35 | command ran serially under `env -i` plus the outer isolation above. Logs replace |
| 36 | `/home/drakestapleton` with `~`; no other output normalization was applied. |
| 37 | `build.log` is empty because `tools/build.sh` succeeded silently. |
| 38 | |
| 39 | ## Red before green |
| 40 | |
| 41 | The initial new fixture-conversion test was run before the emitter/driver changes: |
| 42 | `python3 tests/freest_views.py` exited 1 because `bridge-freest c attn_set.om` |
| 43 | returned 24 with empty stdout and `toc: line 4: error 24` / |
| 44 | `unsupported freest scalar capability`. `red-baseline.log` additionally records |
| 45 | both exact fixture conversions against the read-only #76 driver after the change; |
| 46 | both still return 24 and empty stdout. This pinned baseline reproduction is |
| 47 | separate from the initial test-first observation, not a claim of rerunning an |
| 48 | unchanged historical test log. |
| 49 | |
| 50 | The fixtures are byte-for-byte copies of CUDApp |
| 51 | `0d38145a697290f2cd00578fbaa168b824a38015` under |
| 52 | `~/work/cudastack/lanes/IntegStage3/om/api/`: |
| 53 | |
| 54 | - `attn_set.om`: `b2e166c457dc42905f41c7ea473598ba35cf60cd4d0893ea2f03b8da258827f5`. |
| 55 | - `attn_fill.om`: `72fdc8200f248bbfd64854435b8f0533507e6a20a28f192c1f7f1329c40ead42`. |
| 56 | |
| 57 | ## Acceptance results |
| 58 | |
| 59 | All following commands returned **0**: |
| 60 | |
| 61 | | Command | Final line | |
| 62 | | --- | --- | |
| 63 | | `sh tools/build.sh` | silent success | |
| 64 | | `python3 tests/freest_views.py` | `FREEST-VIEWS PASS` | |
| 65 | | `FREEST_CUDAPP_ROOT=... python3 tests/freest.py` | `PASS direct structural converter refusals independently of frontend, including recursive call graph` | |
| 66 | | `CC=x86_64-linux-gnu-gcc FREEST_RUNNER='qemu-x86_64 -L /usr/x86_64-linux-gnu' FREEST_CUDAPP_ROOT=... python3 tests/freest.py` | same final line; x86 EMULATED | |
| 67 | | `python3 tests/seeded.py` | `SEEDED CONVERTER differential C/Python/native/x86 and pin/arithmetic/ABI controls PASS; device NOT_RUN` | |
| 68 | | `python3 tests/seeded_float.py` | `PASS seeded binary32/binary64 byte differential (native/C/x86, 132 constants vs exact oracle, one-ulp mutant detected); baseline/Python/f64-array/converter refusals` | |
| 69 | | `python3 tests/seeded_views.py` | `SEEDED-VIEWS PASS` | |
| 70 | | `python3 tests/seeded_runtime_views.py` | `SEEDED-RUNTIME-VIEWS PASS` | |
| 71 | | `sh tools/test.sh` | `ALL SUITES RC=0` | |
| 72 | |
| 73 | The new test compares hosted and freestanding results, refusal statuses and buffer |
| 74 | bytes for deterministic randomized and boundary inputs. It covers empty/NULL, |
| 75 | length 1, fixed capacity and capacity+1, out-of-bounds indexes, maximum address |
| 76 | extents, wrap/misalignment, canonical integer min/max, partial writes, nested |
| 77 | unwinding and result storage remaining unchanged on refusal. It reuses the |
| 78 | independent runtime-view C oracle for all five element kinds on host and x86 |
| 79 | EMULATED. O0/O2 objects are inspected, separately from the hosted oracle link. |
| 80 | |
| 81 | **Allowed `nm -u` set: `{}` (empty)**. This includes no compiler-helper exception. |
| 82 | O0/O2 freestanding objects have no undefined symbols and no TLS sections. |
| 83 | Consumer objects additionally pass a combined `-r -nostdlib` link with the same |
| 84 | empty set. The checked path emits no int128 and code/header bytes are stable |
| 85 | across repeated conversion. |
| 86 | |
| 87 | Six source mutations in the new Omega emitter are killed: get bound, put bound, |
| 88 | narrowing check, nested-call unwind, exported status and loop status. A |
| 89 | seeded-valid view unit using unsupported `part` is refused by both `c` and `h` |
| 90 | with no stdout. These are in `freest-views.log`. |
| 91 | |
| 92 | `consumers.log` records all attention borrowed-view source compositions from |
| 93 | IntegStage3 `om/units.sh` lines 140–172, their actual exported symbols and C |
| 94 | hashes. Each compiled import-free at O2. Their hosted C **and headers** were |
| 95 | also compared byte-for-byte with the #76 converter: unchanged. This is converter |
| 96 | and object/link evidence, not execution of CUDApp's native runtime target. |
| 97 | Integrator6B owns that consumer adoption and final integration run. |
| 98 | |
| 99 | ## Numeric source |
| 100 | |
| 101 | The deterministic canonical-boundary constants come from: |
| 102 | |
| 103 | `WolframLanguageEvaluator: Table[{w,2^(w-1),2^(w-1)-1,2^w-1},{w,{8,16,32,64}}]` |
| 104 | |
| 105 | Result: |
| 106 | `{{8,128,127,255},{16,32768,32767,65535},` |
| 107 | `{32,2147483648,2147483647,4294967295},` |
| 108 | `{64,9223372036854775808,9223372036854775807,18446744073709551615}}`. |
| 109 | |
| 110 | Expected runtime arithmetic/float results are measured from the unchanged hosted |
| 111 | converter, not computed by the test in Python. The independent pointer-range |
| 112 | oracle and its Wolfram constants are inherited from |
| 113 | `tests/seeded_runtime_views.py`. |
| 114 | |
| 115 | ## Guide scope |
| 116 | |
| 117 | This assignment authorizes omega-bridge, not edits in omega-harness. The matching |
| 118 | pending skill/guide update is recorded in |
| 119 | [aien-dev/omega-harness#196](https://github.com/aien-dev/omega-harness/issues/196). |
| 120 | No guide or implementation pin has been promoted to merged/deployed status. |