omega-bridge
Omega-first language interoperability: checked conversion backends and native language bindings
Brought by drakestapleton
omega-bridge / evidence / runtime-views / REPORT.md
| 1 | # Runtime-extent hosted typed views |
| 2 | |
| 3 | IMPLEMENTED and CPU-EXERCISED on `feat/typed-views-runtime-extent`, stacked on |
| 4 | `feat/portable-typed-views` at `758d74aadf465ed5d4b3c80d798615c8ed4e18f8` (#71). |
| 5 | The parent PR was freshly checked OPEN/DRAFT at that exact head before publishing. |
| 6 | `git fetch origin main feat/portable-typed-views` returned0. No rebase, merge, |
| 7 | deployment, native compiler repin or GPU access was performed. |
| 8 | |
| 9 | ## Boundary policy and exact source pins |
| 10 | |
| 11 | - `src/toc.om`: `d84fd6ebd258170a023ed5235880cd3e1ca8664703a2542542a7f8d103120538`. |
| 12 | - `tools/bridge-seeded`: `a3a455bd77381e132215924295763e8728889d7d578278ae376de78324be8629`. |
| 13 | - `tests/seeded_runtime_views.py`: `e1ddb4d725e89ca2a1bbba8d1b5f6044f6ca0b9c600022f345964e06da9ee1ac`. |
| 14 | - Unchanged `tests/seeded_views.py`: `e7682d4820888c0df2a22600c34641b4d50b2e0ef64f15713439bbea51831058`. |
| 15 | - Unchanged input validator: omega-mv `e5b32567a7aff3ce594e3254a622a846a6cd190b`, |
| 16 | compiler `2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f`, |
| 17 | source `seed/omc/omc.om` `7703da00055fc0c7a91fcae43071df76a3f277dbe867cb284a3bdff3bedb7e1b`. |
| 18 | |
| 19 | Use `tools/bridge-seeded --runtime-views c|h unit.om`. Numeric OM1 view lengths |
| 20 | are capacities. The explicit profile also supports the existing seeded bare |
| 21 | `om2` header plus unsized `view T *` / `edit T *`; this does not add arbitrary |
| 22 | OM2 features. Both modes use caller pointer/count pairs, live `len/get/put`, |
| 23 | byte-size/address overflow checks, empty-null admission and actual-range alias |
| 24 | checks. The result pointer remains exact and nonnull. The original fixed profile |
| 25 | and the #71 fixed-width load/store helpers are unchanged. |
| 26 | |
| 27 | The exact seed source at lines214-218 and6539-6608 distinguishes physical slots: |
| 28 | numeric views take one slot, unsized views two, with six slots total. Five bounded |
| 29 | views have been exercised without narrowing their live counts to declared sizes. |
| 30 | The seed still validates the original snapshot before conversion. Its unchanged |
| 31 | iteration guard remains a separate limit from buffer admission. |
| 32 | |
| 33 | The ABI was sent to BwMatmulRealize, ApiViewsAttn and ApiViewsElem before freeze. |
| 34 | Their required uint/ushort/f32/uchar/ulong cases, bounded windows, large unsized |
| 35 | extents, empty nulls, adjacent buffers and readonly alias policy are covered. |
| 36 | `docs/NATIVE-ABI.md` adds a disjoint final hosted section with BridgeHost's explicit |
| 37 | permission; existing native sections and implementation were not changed. |
| 38 | Guide update requested in https://github.com/aien-dev/omega-harness/issues/194, |
| 39 | because this assignment permits omega-bridge edits only. |
| 40 | |
| 41 | ## Tests and controls |
| 42 | |
| 43 | Every executed test/binary/mutant is contained in: |
| 44 | |
| 45 | ```sh |
| 46 | bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 COMMAND |
| 47 | ``` |
| 48 | |
| 49 | `commands.json` records argv, environment, rc and final lines. Adjacent logs replace |
| 50 | only the home-directory prefix with `~`. The final oracle log identifies QEMU10.0.14 |
| 51 | and native/cross GCC13.3.0. The first seeded/float run used the system QEMU8.2.2; |
| 52 | they were rerun with the required QEMU10 directory first on PATH. Typed views and |
| 53 | runtime views use the explicit QEMU10 path from `QEMU_X86_64`. No historical receipt |
| 54 | was edited to turn a prior result into a PASS. |
| 55 | |
| 56 | | Command after wrapper | rc | Final line | Log | |
| 57 | |---|---|---|---| |
| 58 | | `sh tools/test.sh` | 0 | `ALL SUITES RC=0` | baseline.log | |
| 59 | | `python3 tests/seeded.py` | 0 | `SEEDED CONVERTER differential C/Python/native/x86 and pin/arithmetic/ABI controls PASS; device NOT_RUN` | seeded-oracle10.log | |
| 60 | | `python3 tests/seeded_float.py` | 0 | `PASS seeded binary32/binary64 byte differential (native/C/x86, 132 constants vs exact oracle, one-ulp mutant detected); baseline/Python/f64-array/converter refusals` | float-oracle10.log | |
| 61 | | `python3 tests/seeded_views.py` | 0 | `SEEDED-VIEWS PASS` | views.log | |
| 62 | | `python3 tests/seeded_runtime_views.py` | 0 | `SEEDED-RUNTIME-VIEWS PASS` | runtime-final.log | |
| 63 | | `python3 tests/seeded_next.py` | 0 | `SEEDED-NEXT PASS` | next.log | |
| 64 | | `python3 tests/freest.py` (host) | 0 | `PASS direct structural converter refusals independently of frontend, including recursive call graph` | freest.log | |
| 65 | | `env CC=x86_64-linux-gnu-gcc FREEST_RUNNER='.../qemu-x86_64 -L /usr/x86_64-linux-gnu' python3 tests/freest.py` | 0 | same final line | freest-x86.log | |
| 66 | |
| 67 | Plain `env OMEGA_SEED=~/work/cudastack/omega-bridge/build/bootstrap/omc sh tools/build.sh` |
| 68 | returned0 with no output (run before acceptance). The converter remains seeded Omega; |
| 69 | Python and C in this test are verification oracles, not a production implementation. |
| 70 | `crumb compile . && crumb verify .` under the same device-free wrapper returned0, |
| 71 | final line `crumb verify: OK: 4 crumbs current`. |
| 72 | |
| 73 | The new independent checked C reference covers all five element types, bounded |
| 74 | and unsized, on host and emulated x86. It exercises n=0/1/capacity, all counts0..256, |
| 75 | literal and dynamic accesses, actual read/write bounds with the other bound valid, |
| 76 | maximum nonwrapping synthetic address ranges without dereferencing them, overflow, |
| 77 | empty/misaligned/null pointers, result overlap, writable overlap and adjacency. |
| 78 | A no-op copy cannot pass: input and output bytes begin different. Helper forwarding, |
| 79 | readonly aliases, fixed-profile exact counts and five-view declarations have |
| 80 | additional executable controls. Header and C output both refuse unsupported syntax, |
| 81 | unsized-to-fixed calls, readonly-to-edit calls and over-slot signatures without output. |
| 82 | |
| 83 | Six independently killed mutants are in the final log: |
| 84 | |
| 85 | 1. read bounds removed; |
| 86 | 2. write bounds removed; |
| 87 | 3. actual overlap range replaced by declared capacity; |
| 88 | 4. nonempty null check removed; |
| 89 | 5. count-times-width overflow check removed; |
| 90 | 6. #71 byte-loop load regression restored and caught by GCC AArch64 instruction shape. |
| 91 | |
| 92 | The unchanged #71 wide-load/store assembly check and original mutants still pass |
| 93 | in `views.log`. Existing native-only generators/suites were not changed or rerun. |
| 94 | The historical #71 native-v2 FAIL1 is not silently reclassified as green here. |
| 95 | This report's regression PASS scope is the complete portable converter suite that |
| 96 | #71's final storage amendment exercised, plus the new runtime suite and x86 freest. |
| 97 | Physical x86, GPU/chip qualification, MERGED and DEPLOYED are NOT_RUN. |
| 98 | |
| 99 | ## Development failures retained as observations |
| 100 | |
| 101 | Before final acceptance, an initial new fixture exposed GCC `-Wclobbered` for a |
| 102 | live runtime-count parameter. Runtime wrapper count definitions now use volatile, |
| 103 | matching existing scalar setjmp handling without changing the public ABI. A |
| 104 | synthetic max-range fixture originally overlapped real result storage and was |
| 105 | correctly refused; it now starts after that result storage. A bounds mutant |
| 106 | initially survived when both bounds were identical; independent short-read and |
| 107 | short-write fixtures now kill each check separately. Those exploratory commands |
| 108 | returned1 and were not claimed as PASS. The final logs above are the post-repair |
| 109 | runs; no refusal gate was weakened. |
| 110 | |
| 111 | The overflow constants and quotient boundary table in the new test were obtained |
| 112 | with WolframLanguageEvaluator: |
| 113 | `{2^64-1,Table[{z,Quotient[2^64-1,z],Quotient[2^64-1,z]+1},{z,{1,2,4,8}}]}` |
| 114 | returned `{18446744073709551615,{{1,18446744073709551615,18446744073709551616},{2,9223372036854775807,9223372036854775808},{4,4611686018427387903,4611686018427387904},{8,2305843009213693951,2305843009213693952}}}`. |
| 115 | |
| 116 | ## Additional bounded NUL-path acceptance |
| 117 | |
| 118 | Main requested a borrowed-byte case for FreestLeftovers. The exact `pathlen` |
| 119 | example is appended to NATIVE-ABI: it scans `uchar *` only within caller `a_n`, |
| 120 | returns the first NUL index or `a_n` if absent, and accepts NULL only when empty. |
| 121 | The final suite compares it to `memchr` for every count0..256 and each terminator |
| 122 | position, including a terminator at (outside) the count. Host and QEMU10 x86 both |
| 123 | returned0 and printed |
| 124 | `PASS bounded NUL scan reference, including absent/outside-bound terminators`. |
| 125 | The complete suite command still returned0, final line `SEEDED-RUNTIME-VIEWS PASS`; |
| 126 | the immutable post-addition receipt is `runtime-nul-final.log` with matching |
| 127 | `commands.json` row. Earlier logs describe earlier test fixtures, not this addition. |
| 128 | The converter and wrapper hashes above remain unchanged. |
| 129 | |
| 130 | This is the hosted checked converter profile, not an implementation of borrowed |
| 131 | views for `tools/native --freestanding` or an import-free runtime. Those consumers |
| 132 | must choose that boundary explicitly. CUDApp's path traversal is not ported by this |
| 133 | omega-bridge-only contribution. |
| 134 | |
| 135 | BwMatmulRealize clarified one unresolved consumer signature: three unsized matrix |
| 136 | views plus independent runtime m/k/n metadata require more than the six physical |
| 137 | slots available in the frozen seed. This change admits large extents but does not |
| 138 | claim to solve that general signature. No output capacity restriction, descriptor |
| 139 | suffix requirement, source-validation bypass or C-chunk shim was substituted. |
| 140 | That case needs a concrete, qualified compiler slot/descriptor extension; Main |
| 141 | was notified and BwMatmulRealize retains Main's verification-only C oracle exception. |