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/CAPABILITIES.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 / CAPABILITIES.md` 369 lines · 28121 bytes Raw Blame History Rendered 1 # Bridge v0 capability contract 2 3 Input is the pinned seed's Omega program/function language, further bounded below. The shell entry point snapshots the source, asks the pinned Omega compiler to check the entire unit, then sends the same bytes to the Omega target compiler. Both targets consume the same typed nodes. The private build/bridge executable is an internal emitter, not a standalone validation API. Use tools/bridge. 4 5 | Feature | C output | Python output | 6 |---|---|---| 7 | bool; unsigned/signed 8, 16, 32, 64-bit scalars | supported | supported using canonical 64-bit bits | 8 | explicit checked numeric conversions | supported | supported | 9 | unsigned arithmetic | wraps at declared width | same | 10 | signed add/sub/mul/neg/shl overflow | trap 1 | same | 11 | div/rem | truncation toward zero, zero divisor trap 2; min/-1 division trap 1; remainder zero | same | 12 | shifts | arithmetic signed right shift; invalid amount trap 7 | same | 13 | eager left-to-right operands/call arguments | sequenced GNU statement expressions | Python argument order | 14 | if/else, bounded while, for | supported | supported | 15 | forward/mutual calls and recursion in programs | supported within resource budget | same | 16 | new arrays, global pools, view/edit parameters, get/put/len | checked; actual element widths; readonly views are `const void *` | bytearray for uchar (immutable `bytes` also accepted for a readonly uchar view), list for other widths | 17 | read/write/exit in programs | POSIX, negative errno returned in long bits | os read/write, same errno mapping | 18 | callable function units without main | generated checked C ABI wrappers | generated checked module functions | 19 | text constants (`text NAME "..."`), baseline `tools/bridge` only | exact decoded bytes as `static const uint8_t` plus a separate length; get/len/write and readonly view arguments | immutable `bytes`; same | 20 | inline text literals in expressions | refused by the seed, error 16 | same | 21 | floating point, heap, free, own, reflection, concurrency, GPU, external calls | refused by seed or bridge | same | 22 | arbitrary C/Python input | no frontend | no frontend | 23 24 Capacity limits: input including the target selector is below 1,048,576 bytes, output at most 4,194,304 bytes, 32 functions, four parameters per function (arrays expand to address/length), eight globals (texts and global arrays share this table), 32,768 decoded text bytes per unit, 32 live locals, 32 block levels including the function, 1,024 expression nodes per statement, eight-character names. Global arrays have at most 524,288 elements. Local arrays total at most 32,768 bytes per function. Capacity exhaustion is a compile refusal (14, 23 or 24), never a partial generated file. The seed has further checked register and grammar limits. 25 26 Text (docs/TEXT-CONVERSION.md): the bridge decodes exactly the seed's four escapes (`\n`, `\t`, `\\`, `\"`) and keeps every other byte inside the quotes, including raw NUL, CR, tab and bytes 128-255; empty text has length zero and no terminator. Output contains only decimal byte initializers, never source bytes. Writes, reads and edit arguments into a text are refused by the seed (error 20) and again by the bridge. Note bodies are skipped untokenized outside cabi library modes, so note bytes the seed ignores no longer cause a bridge error 16. The seeded frontends (`tools/bridge-seeded`) still refuse text. 27 28 Resource boundary: generated execution has a 128-active-call limit, reported as trap 6. Native Omega instead checks its eight-MiB machine stack. Their exhaustion thresholds differ. Only executions within the bridge budget are claimed equivalent; t_stack verifies the eventual trap code only. C hosts must provide an eight-MiB stack. Resource consumption, allocation failure and OS signal/restart behavior are not cross-runtime equivalence claims. Python uses its host heap for fixed-size arrays and interpreter state; the Omega source language has no heap operations. This is not a no-allocation Python runtime. 29 30 For loops evaluate a compound count once; a variable count is read each iteration. Variable-count for loops and while loops have a default one-million-iteration guard. Explicit while bounds retain the seed's allowed range. Arrays are never returned, transferred or stored as references. View writes, shape mismatches and overlapping array arguments inside Omega are refused by the shared frontend. Runtime bounds are always enabled. 31 32 Full-program results are compared byte-for-byte on stdout/stderr and process status. Trap exits are 100 + code; explicit exit and main return use the low eight bits. I/O tests use ordinary pipes/files with no asynchronous signals. Neither backend optimizes away checks. 33 34 Other conversion targets need a real emitter, capability checks, reference executor, differential corpus and an attachment gate; no language other than C and Python has a converter. Calling a compiled Omega function in place from C, C++, Python, Rust, Zig or Go is the native call adapter (docs/NATIVE-ABI.md): `tools/native` builds the library and writes each language's declarations from the Omega signatures. That is a call into Omega's machine code, a separate claim from conversion. JavaScript, Java, C#, Fortran and other languages have no implemented or tested adapter here. 35 36 The seed's optional grouped-expression syntax and explicit `view A` argument prefix are not lowered by this bridge; use ordinary prefix expressions and view-typed parameters. Source constructs beyond the table may be accepted by the seed and then refused by the target compiler. Error 24 includes an unsupported-capability diagnostic; errors 13/14/23 identify name, table/output or storage limits. No target output is published on these failures. 37 38 ## Additive seeded frontend 39 40 `tools/bridge-seeded c|python|h SOURCE.om` is an explicit frontend mode for 41 omega-mv ``e5b32567``, requiring `OMEGA_SEEDED_OMC` with sha256 42 ``2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f``. 43 The source snapshot is checked by that exact compiler before conversion. A 44 different compiler fingerprint refuses with status 65 and no target output. 45 This mode keeps `tools/bridge`'s baseline seed 46 ``191b776ef98821597c3e30655da6d680a9b66edbc9ceaca3c39c61ea6df098e9`` and the 47 required `tools/test.sh` suite, but the shared `src/toc.om` emitter changes 48 baseline `tools/bridge c|python` output text: exported scalar parameters of 49 narrowing functions become `volatile`, the `o_get`/`o_io`/`o_buf` helpers take 50 `const void *`, and unused loop counters are no longer emitted. The behavior 51 suites (`tools/test.sh`, seeded, seeded-float, freestanding) are unchanged and 52 pass; byte-identical output to the previous `tools/bridge` is not claimed. 53 54 The additive mode accepts at most 1024 numeric constants (integer, `f32` or `f64`; error 14 beyond), 512 functions, 55 six parameters per function, function names up to the frontend's 63-byte limit 56 (other names retain its limits), fixed view/edit shapes up to 57 16,777,216 elements, explicit `view`/`edit` call prefixes and bounded-loop 58 `break`. Seeded C also supports `continue` within a checked enclosing loop. 59 Default variable-loop and while guards match omc's 1,000,000-pass trap 4. Source and 60 emission storage are bounded at 1 MiB and 4 MiB; seeded local array storage is 61 bounded at 16 MiB, while the baseline local-storage refusal remains 32 KiB. 62 Checked arithmetic, bounds, alias refusals, call budget and no-heap restrictions 63 remain enforced. Text constants (refused, error 24) and external calls remain unsupported in this mode. 64 These are implementation bounds, not performance measurements. 65 66 Seeded C permits binary32 (`f32`) and binary64 (`f64`) scalars, including typed public parameters/results: 67 float constants (`const K f64 0.1`; a suffixed literal is error 16 and an integer literal error 16, 68 as in omc), typed or suffixed float literals in expressions, `add`/`sub`/`mul`/`div`, `neg`, 69 `fabs`, `fsqrt`, ordered comparisons and `eq`/`ne`, int<->float and f32<->f64 conversions (an integer 70 literal under a float conversion is typed `long`, as in omc), and same-width bitcasts 71 between `f32` and `uint` and between `f64` and `ulong`/`long`. Operations go through `o_fp`/`o_fcv` 72 with explicit ARM (AArch64) NaN propagation and FCVTZS/FCVTZU saturation, so results match the 73 seeded omc's AArch64 bits. Decimal conversion reuses the pinned Omega `e5b32567` implementation, 74 including its limits: at most 2^63-1 significant digits (error 8) and overflow to infinity 75 refused (error 8). That conversion is not always correctly rounded (aien-dev/omega-mv#1024); 76 the converter reproduces omc's bits, and `tests/seeded_float.py` pins the two known misrounded 77 literals. Storage is canonical IEEE-754 bits. Fast-math and incompatible binary32/binary64 78 implementations are refused at C compilation. The `fsqrt` compatibility lowering uses the host's 79 AArch64 FSQRT or x86-64 SSE scalar square-root instruction and normalizes NaN propagation to AArch64; 80 it adds no libm dependency. Other host architectures are refused at C compilation. 81 Where omc refuses a float program the converter reports omc's error code. Accepted but unlowered 82 features (`f64` arrays, float shift counts, untyped float literals as a left operand, 83 `int`/`long`-with-`f32` bitcasts) are refused with error 24, as are all Python and 84 baseline float inputs. No approximate integer substitute is emitted. 85 86 Seeded C views/edit arrays additionally admit `ushort`, `uint` and `f32`. 87 Local and global `f32` arrays use fixed-width `uint32_t` raw IEEE bits; unsigned 88 arrays use `uint16_t` and `uint32_t`. Loads/stores use alias-safe fixed-width 89 builtin copies on the required little-endian host, retaining NaN payloads and 90 signed zero without per-element byte loops. Unsigned operators still wrap at the declared width. Public 91 arrays remain borrowed `void *`/`const void *` plus an exact element count. 92 Alignment, wrap, result overlap and mutable-view alias checks use the declared 93 element size (2, 4 or 8 bytes), not the old uchar/ulong-only assumption. 94 Public scalar `f32`/`f64` parameters and result pointers are C `float`/`double`; 95 integer scalars retain canonical uint64_t bits. Only success writes the result. 96 Global arrays are standalone-program features: the pinned compiler refuses its 97 global pool in function mode with error 9, before the converter emits anything. 98 `tests/seeded_views.py` executes the pinned omc and emitted C on exhaustive u16 99 values, edge cases and 2^20 deterministic random u32/f32 patterns (host and 100 qemu-x86_64), and checks out-of-range refusals, runtime boundary errors and 101 per-feature killed mutants. 102 The same test checks GCC `-O2` AArch64 assembly for one scalar 16/32/64-bit 103 load/store at constant-width calls and kills a restored-byte-loop mutant. 104 The checked borrowed-view profile of `bridge-freest` shares this typed C lowering 105 and ABI, but uses an import-free explicit status context instead of hosted traps. 106 107 Function units export only their final function, using `omega_NAME`. 108 `h` validates every function body through the same emitter before emitting the 109 C declaration from checked signature metadata. Exported scalar value parameters 110 are volatile inside the checked setjmp wrapper; the public ABI is unchanged. 111 The result pointer comes first; integer scalars use canonical uint64_t bits; arrays 112 use address and element-count pairs. Counts must equal the declared fixed 113 shape. ABI statuses are 0 for completion, 1 through 14 for Omega traps, 32 for 114 invalid host arguments or overlapping arrays, and 33 for reentry. Views are 115 not written by Omega and use const-qualified C pointers. Generated C contains the implementation and checked 116 runtime, not a call into AArch64 machine code, and can be compiled on Linux 117 x86-64 with GNU C. Native call adapters remain a separate AArch64 path. 118 Literal-count loops do not emit an unused runtime guard counter. Seeded C 119 marks source scalar declarations as possibly unused, preserving evaluation of 120 their initializers, including calls with side effects. This is declaration 121 metadata, not a repository warning-flag change. The seeded strict-host test 122 compiles with `-Wall -Wextra -Werror` and includes an annotation-removal mutant. 123 124 Qualification is separate from implementation. Run the unchanged baseline 125 `tools/test.sh` first, then `python3 tests/seeded.py` with both pinned compilers 126 configured. The latter compares native Omega, generated C and Python, 127 executes generated x86-64 machine code through qemu-x86_64, checks the header 128 ABI, and includes wrong-seed and arithmetic-emitter negative controls. 129 No device qualification is implied. 130 131 `python3 tests/seeded_float.py` compares the seeded executable and generated C 132 byte-for-byte (host and x86-64 under qemu) over zero, subnormal, normal, overflow, infinity 133 and NaN inputs for f32 and f64, 132 constants against an exact round-to-nearest-even oracle 134 (one-ulp mutant detected), and converter refusal codes cross-checked against omc. 135 It includes baseline/Python, f64-array, numeric-cast, unsupported-op, 136 header-validation and fast-math refusal controls. These are host/emulator results only. 137 138 ### Explicit runtime-extent hosted views 139 140 `tools/bridge-seeded --runtime-views c|h unit.om` keeps the `e5b32567` source 141 validator and explicitly changes only the hosted view boundary policy. Numeric 142 view/edit lengths are capacities: callers pass `0 <= n <= CAP`, and `len`, 143 `get`, `put` and helper-call counts use the actual `n`. The default profile 144 still requires exact declared counts; it is not a runtime-view alias. 145 146 The runtime profile also lowers the pinned compiler's bare `om2` header and 147 unsized `view T *` / `edit T *` parameters, without the numeric capacity ceiling. 148 Only this narrow OM2 subset is added: layouts, `part`, exports, contracts and 149 `om2 diag`/`om2 fmt` are not lowered. Unsupported constructs refuse without 150 output. Six source parameters remain the maximum. The seed counts each numeric 151 view as one machine slot and each unsized view as two; at most six native slots 152 are available. Thus five bounded views are supported, but five unsized views 153 are not. Numeric declarations still obey the seed's fixed-capacity limit. 154 155 Kinds are `uchar`, `ushort` (halfword), `uint`, `ulong` and `f32`. Every 156 nonempty view must be nonnull, naturally aligned and have a nonwrapping byte 157 range. Empty views may have null or misaligned addresses and have no overlap 158 range. Writable/view and writable/writable overlaps refuse; readonly aliases 159 and adjacent disjoint actual ranges are accepted. Result storage remains 160 nonnull, aligned and disjoint. Admission errors return 32; access outside 161 the live count is trap 3. Writes completed before a trap are not rolled back. 162 Generated headers and C identify the runtime profile. Count arguments in 163 the checked wrapper are volatile for setjmp correctness, without changing 164 the C calling ABI. Compile floating operations with `-ffp-contract=off`. 165 The existing iteration/call guards are unchanged: accepting a large extent 166 does not promise traversal beyond those guards. 167 168 `tests/seeded_runtime_views.py` compares the generated C against independent 169 checked reference semantics on the host and under x86 QEMU, across empty, 170 one-element, capacity and maximum-address envelopes. It kills removed read/ 171 write bounds, declared-range overlap, null-check, byte-size overflow and 172 byte-loop code-generation mutants. It also covers fixed-profile exact counts, 173 helper count forwarding, readonly aliases and five-bounded-view signatures. 174 See the appended hosted runtime-view ABI in `docs/NATIVE-ABI.md`. 175 176 ### Explicit draft-1049 float profile (not a default pin refresh) 177 178 `OMEGA_SEEDED_NEXT_OMC=/path/to/candidate tools/bridge-seeded --float-next c|h unit.om` 179 selects omega-mv draft #1049 at ``7e93ca8e29b3fe81314a88c9f1cb70666fca27f5``, 180 candidate compiler sha256 181 ``d89bdc08ca21ea9726f1117adc791f683287d3698ea112a9db5519df2e79aeec``. 182 Source sha256 is ``0a0f4bbc361e555de223d93e774ed5c8d96da401ab574983897ecc82539e0549``. 183 It adds `fma a b c` with equal explicit f32/f64 operands and one hardware FMADD 184 rounding, plus #1024's exact decimal-to-binary rounding. The compatibility emitter 185 preserves left-to-right operand evaluation and copies the candidate compiler's 186 bounded integer limb conversion into its separately selected literal path. 187 The new FMA profile is AArch64-only, as is this compiler keyword; other C 188 architectures refuse at compilation rather than silently emitting mul+add. 189 The default e5 profile retains its exact historical literal bits and rejects 190 the candidate compiler digest. No baseline/native compiler pin is replaced. 191 `tests/seeded_next.py` compares edge triples and 2^20 random triples per float 192 width against the candidate machine code, kills FMA and literal mutants, and 193 checks all 512 literal/oracle rows copied from that exact compiler revision 194 (including both filed #1024 counterexamples). The fixture's Wolfram provenance 195 and compiler-side fixpoint, seed/host gate and exact-oracle mutants are recorded 196 in omega-mv #1049. Neither PR is merged or deployed. 197 198 ### C ABI library mode (cabi-1, omega-bridge#83) 199 200 `OMEGA_SEEDED_OMC=/path/to/`e5b32567`/omc tools/bridge-seeded lib-c|lib-h|lib-map unit.om` 201 lowers one seeded Omega unit into a C shared library: `lib-c` emits the library C 202 (the unit's functions, the runtime and one exported wrapper per declared symbol), 203 `lib-h` the public header and `lib-map` the GNU ld version script (declared exports 204 global, everything else local). Library modes use the frozen e5 profile only; 205 `--float-next` and `--runtime-views` with a library mode exit 24. The pinned seed 206 compiler checks the whole unit first, as in the other modes. 207 208 The C surface is declared in `note cabi ...` lines, so the unit stays plain seeded 209 Omega. Directives (fixture: `tests/cabi/fixture.om`; production user: CUDApp 210 `native/nvml/api.om`): 211 212 - `library SONAME header HEADER`; `lock NAME process mutex` (one process-wide pthread mutex). 213 - `status TYPE ENUMTAG int32 trap CODE`, `value TYPE NAME N`, `enum TYPE TAG uint32`, 214 `define NAME TEXT`, `alias OLD NEW` under `aliasguard MACRO`. 215 - `handle TYPE STRUCT pool STATE count N lock L`: opaque handles are tagged slot 216 addresses; a forged, foreign or never-issued handle decodes as invalid. 217 - `record TYPE STRUCT size S align A [alias NAME]` and `field TYPE NAME KIND OFFSET`: 218 offsets and sizes are checked against the C layout rules. 219 - `state NAME ELEM N process lock L`: library state lives in fixed C arrays owned by 220 the wrapper and passed to Omega as views; an Omega `global` in a library unit is 221 refused (error 51). 222 - `cstr STATE slots N width W fallback "TEXT" lock L`: stable string storage for a 223 `const char *` result. 224 - `export SYMBOL FN status TYPE lock L` (or `cstr STATE`), `bind SYMBOL PARAM STATE`, 225 `arg SYMBOL NAME [nullable] in|out|inout TYPE [length ARG|count ARG] [commit BIT] 226 [data STATE OFFSET]`. 227 - `import FN SYMBOL result R (value P | span P OFFSET LENGTH)...` on a body-less 228 stub: calls an external C symbol (for example a unit emitted by `tools/bridge-seeded c`). 229 230 Each export calls `FN fr edit ulong N ...` with a frame: slot 0 the status, slot 1 231 the commit mask, one slot per argument (pointer arguments carry their non-null flag; 232 length/count outputs add a slot). The wrapper takes the lock, runs the Omega 233 function, and publishes nothing unless the call returned without a trap, the status 234 is a declared value, the commit mask names only declared outputs and every committed 235 output is in bounds: a record array must fit the caller's count, a string output must 236 fit the caller's length and end in its NUL, a `data` copy must lie inside its state. 237 Any violation returns the declared trap status (`NVML_ERROR_UNKNOWN`, 999, in the 238 fixture) with no output written. A `cstr` result always points into its stable 239 storage or at the fallback text. 240 241 Refusals, all with nothing on stdout: 40 malformed lock kind, 41 duplicate export 242 symbol, 42 unknown lock/state/function/alias target, 43 wrong nullability, 44 bad 243 record offset or size, 45 bind to state of the wrong extent or a record array 244 without a count, 46 raw pointer result or argument, 47 out span without length, 245 48 non-stable or out-of-storage string, 49 import stub with a body, 50 `main` in a 246 library unit, 51 Omega global, 52 provenance mismatch. 247 248 Provenance: every artifact's first line names the SHA-256 of `src/toc.om` and of the 249 source. `tools/bridge-seeded` appends both digests as a trailer and opens 250 `src/toc.om` on descriptor 3; `build/bridge` recomputes both with its own SHA-256 251 (in Omega) and refuses any mismatch, a missing trailer or a withheld descriptor 3 252 with error 52. 253 254 Gate (seeded Omega; cc, nm, readelf, sha256sum and `tests/cabi/caller.c` are 255 test-only ORACLE tools and never shipped), from the checkout root after 256 `tools/build.sh`: 257 258 ```sh 259 cat tests/cabi/proc.om tests/cabi/gate.om | "$OMEGA_SEEDED_OMC" > build/cabi-gate 260 chmod +x build/cabi-gate 261 OMEGA_SEEDED_OMC=/path/to/omc build/cabi-gate 262 ``` 263 264 It checks deterministic generation and golden bytes, exactly 8 exports and the 265 soname, a 57-check caller (null and out-parameters, handles, forged handles, stable 266 strings, 8 threads x 2000 calls with no lost update), cc refusing an import 267 declaration that disagrees with the external header, 18 refusal cases (errors 40-50), eight 268 direct `build/bridge` provenance cases, and four mutants the caller must catch 269 (null-out commit, publication, lock removal and a ulong import span moved from 270 element 3 to element 2). It prints `OMEGA-BRIDGE CABI GATE PASS`, exits 77 when 271 unconfigured and 1 on any failure. Evidence: `evidence/cabi-1/`. 272 273 ## Portable import-free scalar and checked borrowed-view profiles 274 275 `tools/bridge-freest c|h SOURCE.om` selects one of two fail-closed import-free 276 profiles before body conversion. Borrowed-view signatures select the checked 277 profile in `src/toc.om`; units without borrowed signatures select the original 278 scalar parser/emitter in `src/freest.om`. A view-bearing unit never retries the 279 scalar profile after a refusal. This does not replace the hosted 280 `tools/bridge-seeded c|python|h` roots or change their ABI. 281 The shell entrypoint only snapshots, checks compiler fingerprints, validates 282 with the seeded frontend, compiles the Omega converter and publishes its output 283 after success. It implements no source parser. 284 285 Use the same `OMEGA_SEED` baseline fingerprint and `OMEGA_SEEDED_OMC` frontend 286 fingerprint documented above. The wrapper validates and converts the identical 287 snapshot. No native x86 Omega compiler is required: portable C is compiled by the 288 consumer's C compiler. Both `c` and `h` traverse the complete source before 289 publishing bytes, including every unused helper. Headers cannot bypass profile 290 refusal. The input bounds and scalar type/name limits remain those of the 291 seeded frontend and converter tables. 292 293 The original scalar subset remains integer-only, stateless and nontrapping: scalar 294 signatures, literal constants, scalar locals, `if`/`else`, `ret`, and acyclic 295 function calls. Unsigned non-bool addition, subtraction, multiplication and 296 negation wrap at the declared width. Integer comparisons and bitwise operations 297 are supported, as are identity and same-signedness widening conversions 298 (including bool to a wider unsigned type). Signed arithmetic, division, 299 remainder, every shift, narrowing and signedness-changing conversions are 300 refused conservatively, even when a particular constant or path could be safe. 301 Loops, arrays, mutable globals, text, I/O, host words, `main`, recursion, floats, 302 explicit traps, contracts and OM-2 are outside this profile. Refusal applies to 303 the complete unit, not merely the exported root or reachable helpers. No 304 function-name whitelist is used. 305 Spell scalar types as `bool`, `uchar`, `ushort`, `uint`, `ulong`, `byte`, 306 `short`, `int` or `long`; short type aliases are outside this profile. 307 308 The final function is exported as `uint32_t omega_NAME(uint64_t *result, ...)`. 309 The result pointer is first. Arguments and results use canonical uint64_t 310 integer bits, including sign extension for signed values. Status 0 stores the 311 result; status 32 refuses null, misaligned or wrapping result addresses and 312 noncanonical scalar arguments before any store. As with other native pointer 313 ABIs, callers remain responsible for supplying valid writable storage; the 314 profile does not probe mapped-memory permissions. There are no runtime traps, 315 reentry state, TLS, setjmp/longjmp, libc calls or host imports in generated code. 316 The output includes only the standard integer type header and pure local 317 helpers; it is not a call into AArch64 machine code. 318 319 The checked borrowed-view subset accepts the hosted view element kinds 320 (`uchar`, `ushort`, `uint`, `ulong`, `f32`). Units without an `om2` header retain 321 the default hosted exact-count contract: a declared extent of 32 requires a 322 caller count of 32, not 31. A seed-validated `om2` header explicitly selects 323 the runtime-view contract, where numeric extents are capacities and `*` is 324 unsized. This selection applies to both C and header output and needs no 325 command-line flag. The subset includes local arrays, checked arithmetic/conversions, floats, bounded 326 loops and internal calls accepted by the seeded C converter. It retains the 327 hosted result-first ABI, scalar canonical bits/float types, capacity/count, 328 NULL/zero, alignment, address-overflow and alias checks. It does not add globals, 329 text, host words, I/O, `main`, `part`, ownership/out arrays or unsupported 330 converter capabilities. The whole unit is checked in both `c` and `h` modes. 331 Each exported call uses a stack-local status/depth context threaded through 332 private functions: bounds and arithmetic refusals return the same statuses 333 1–7; foreign-argument refusal is 32. Result storage changes only on success; 334 earlier buffer writes remain visible after refusal. Internal calls and primitive 335 checks unwind before later expressions or writes. There is no TLS, global 336 reentry state, libc/POSIX call, abort, printf, setjmp/longjmp or int128 helper. 337 The allowed undefined-symbol set is empty. Generated C is byte-stable and 338 targets GNU C11 on the same little-endian AArch64/x86 floating environment as 339 the hosted seeded converter; the caller enables FP and supplies valid storage. 340 Host/compiler/header dependencies are unchanged verification/conversion tools, 341 not runtime imports into the generated object. 342 343 `tests/freest_views.py` copies the CUDApp attention-set/fill, fixed launch-record 344 and runtime-copy source shapes. It compares hosted and freestanding output on 345 deterministic randomized and boundary inputs, checks partial-write/refusal 346 behavior, exact-count and capacity/unsized views, pointer/result aliases and 347 unchanged storage on admission refusal. It compiles O0/O2 objects with an empty 348 `nm -u` set and no TLS, and kills seven mutations in the new Omega emitter 349 path, including removal of the fixed-extent check. It also checks a seeded-valid unsupported `part` 350 unit refuses without output. Run on the host after `tools/build.sh` with 351 `OMEGA_SEED` and `OMEGA_SEEDED_OMC` configured; ctypes is test infrastructure, 352 not an emitted-code dependency. 353 354 355 For independent integration, dispatch a future `bridge-seeded freest|freest-h` 356 mode directly to `tools/bridge-freest c|h` before its hosted-mode case. Keep 357 the hosted roots unchanged. `tests/freest.py` exercises both hosted and freest 358 revision/epoch roots, the result-first ABI and exhausted-generation boundaries, 359 arbitrary helpers, structural refusal controls and a wrong-result control. 360 It inspects O0/O2 freestanding objects and a `-r -nostdlib` link with `nm -u` 361 (requiring an empty set, not an import allowlist) and `readelf` (no TLS sections). 362 Run it after `tools/build.sh` with both pinned compilers configured. Set 363 `FREEST_CUDAPP_ROOT` to use a consumer checkout's actual revision/epoch sources 364 instead of the checked-in source-shape fixtures. For x86-64 execution from an 365 AArch64 host, set `CC=x86_64-linux-gnu-gcc` and 366 `FREEST_RUNNER='qemu-x86_64 -L /usr/x86_64-linux-gnu'`. 367 The default hosted optimization is O2; `HOSTED_OPT` selects an explicit 368 comparison build and is printed in the result. These are targeted host checks, 369 not device qualification.