interplane.Get Omega
Read in your language

sovereign-intelligence

Front door to Drake Stapleton's sovereign stack.

Brought by drakestapleton

branch main Branches Tags History

sovereign-intelligence / harness / skills / omega-encoding / SKILL.md

2280 lines · 184530 bytes Raw Blame History Rendered
1---
2name: omega-encoding
3description: "Write .om that the seeded Omega compiler actually accepts: syntax, types, traps, bounds, register limits, host I/O, byte encoding, compiler errors, verified examples. Use before writing, reviewing or explaining any Omega program."
4---
5
6# Omega encoding: writing `.om` that the seeded compiler actually accepts
7
8Use this before writing, reviewing or explaining any `.om` program, before claiming what Omega can or
9cannot express, and before encoding bytes, integers or host I/O in Omega.
10
11## 0. Pin and how to re-check it
12
13Merge status, 2026-10-29: compiler batch #904 merged at `e2662fffbce1c21ef09da71c0d8808133a6af8ab`;
14x86 integration #923 merged at `bf54b19fa590e8ae925c0e80815516dbf41e7326`.
15Earlier pending labels describe the recorded pre-merge tests. Native x86
16execution remains NOT_RUN; merging is not hardware qualification.
17
18The quantity and diagnostic audit is merged through omega-mv #914 at main
19`d94a503f7aae57d09697046405da2e9a5895be6d`. The older candidate observations
20below remain dated history, not claims about the newer integration.
21
22### Current main pin (checked 2026-11-05)
23
24| Item | Value |
25|---|---|
26| Repository | `github.com/aien-dev/omega-mv`, branch `main` |
27| Commit | `f4df82394e35893dcf1354dda69a2fe028d94bc1` (merge commit of [#1022](https://github.com/aien-dev/omega-mv/pull/1022), `efi 14` machine identity, head `81c5cb25`, merged 2026-11-05T23:48:11Z) |
28| Compiler source `seed/omc/omc.om` | 18,224 lines, 511 `^fn ` lines, sha256 `0effe37afc4ddd0507151c9f2afa34b3e6774eae7006cbecd8c59f11bc386db7` |
29| Compiler `seed/out/omc` | sha256 `3ad9f10f64309e7acf8a725082b28e23a2a4aeb07e98322fb4dc0fcd8fc93194`, 625,676 bytes (equals `seed/out/omc.sha256`; last `seed/omc/size-history.tsv` row `x86efi-ident-1022`) |
30| Seed loader `seed/rung0/seed0.hex` | sha256 `baaf081fe6055a768485c5d25d7435681ce00b04cfa80b26c48169f78944e14d` (unchanged) |
31
32#1022 is the only merge after `d3d1b1bc7` that changes `seed/out/omc.sha256` (`git log
33d3d1b1bc..f4df8239 -- seed/out/omc.sha256`). It adds x86efi OP 14 (machine identity: CPUID brand,
34firmware vendor/revision, SMBIOS copy). `omc.om` went from 510 to 511 `^fn ` lines, so the om4 cap
35(section 8) has 1 free entry at this pin. Still current at main `2a1e6d29` (2026-11-05).
36
37Observed 2026-11-05 on a Linux AArch64 host in a clean detached worktree at main `2a1e6d29`:
38`sh seed/omega-from-seed.sh` printed `RC=0` and left `seed/out/omc` at exactly `3ad9f10f…3194`.
39The example gate result is in the "Rerun at omega-mv `f4df8239`" section.
40
41### Previous pin `d3d1b1bc` (checked 2026-11-04, history)
42
43Commit `d3d1b1bc7e3b970016a2176435f78c8f0251bad1` (merge commit of #1015, `target x86efi`, head
44`19ee7e99`); `omc.om` 18,056 lines, 510 `^fn ` lines, sha256 `16b4ca40…c749`; `seed/out/omc`
45sha256 `b4f45121f6c6d5d8a6ed0f5c4f3934b7cc4bec369bfa89523699bd33928f9b55`, 611,620 bytes.
46#1015 was the only merge after `9920aab14` that changed `seed/out/omc`. It added the x86efi
47backend; AArch64 and x86linux output of the 1305 tracked `.om` files was unchanged except the
484 x86efi test programs (#1015's corpus TSVs).
49
50Observed 2026-11-04 on a Linux AArch64 host in a clean detached worktree at `d3d1b1bc7`:
51`sh seed/omega-from-seed.sh` exited 0 and left `seed/out/omc` at exactly `b4f45121…9b55`.
52`fnv1a32.om` and `trap_narrow.om` compiled to binaries byte-identical to the ones `be8c5130`
53emits; `abc` gave `0b e9 47 1a`, exit 0; `trap_narrow` exited 105. The example gate result is in
54the "Rerun at omega-mv `d3d1b1bc`" section.
55
56### Previous pin `9920aab1` (checked 2026-10-31, history)
57
58| Item | Value |
59|---|---|
60| Repository | `github.com/aien-dev/omega-mv`, branch `main` |
61| Commit | `9920aab1413983c2867d02d75b2276341595adb8` (squash of [#994](https://github.com/aien-dev/omega-mv/pull/994), `scrub` keeps live float registers, merged 2026-10-31T10:48:56Z) |
62| Compiler source `seed/omc/omc.om` | 16,432 lines, 495 `^fn ` lines, sha256 `d4b4b89d8a58cc90d30d15a525b417e4b31e5bfe5288d21d665f1c7958a330f6` |
63| Compiler `seed/out/omc` | sha256 `be8c51301307555254fc59e351d281aae1aa096d91521777e33a41c8b446448a`, 517,856 bytes (equals `seed/out/omc.sha256`; last `seed/omc/size-history.tsv` row `scrub-flive`) |
64| Seed loader `seed/rung0/seed0.hex` | sha256 `baaf081fe6055a768485c5d25d7435681ce00b04cfa80b26c48169f78944e14d` |
65
66Merges after `91c83438d` (omc `2aec185d…d8d5`) that change the compiler, oldest first: #967
67(`96ea448ad`, IR-mode `TYPE` casts read the operand at its own type, section 4), #948 (`dc0d06e95`,
68B/BL imm26 displacements checked by the shared `bdisp`, section 4 error 24 entry), #875
69(`236787439`, OM-2 words `dit` 225 / `scrub` 226, section 6), #918 (`2d848d939`, host word
70`peername` 224, section 9), #853 (`4722cba58`, floats in V registers, codegen only; see the `scrub`
71entry in section 6), #848 (`157bab57c`, `while ... bound N` up to 2^63-1, section 8), #857
72(`3a163bc5e`, `for ... bound N`, IR loop ranges, section 8) and #994 (`9920aab14`, `scrub` no longer
73zeroes the V16+j twin of a live float slot, section 6; the only merge after `3a163bc5e`). #990, #992
74and #989 touch tests and docs only. `seed/rung0`, `seed/rung4/om4.s`, `seed/rung4/om4.bin` (sha256
75`d0da40e4…19efab`), `seed/omega-from-seed.sh` and `seed/omc/gate12.sh` are unchanged between
76`91c83438d` and `9920aab14`. `omc.om` went from 512 to 495 `^fn ` lines with #853 (#994 adds none),
77so the om4 cap (section 8) has 17 free entries at this pin.
78
79Observed 2026-10-31 on a Linux AArch64 host in a clean detached worktree at `9920aab14`:
80`sh seed/omega-from-seed.sh` exited 0 (`RC=0`) and left `seed/out/omc` at exactly `be8c5130…448a`
81with a clean `git status`. Both guide examples were rerun with that omc and gave the same results
82as at the previous pin: `fnv1a32.om` and `trap_narrow.om` compiled with exit 0 to binaries
83byte-identical to the ones `24caacf4` emits; `abc`, `a` and empty input gave `0b e9 47 1a`,
84`2c 29 0c e4`, `c5 9d 1c 81`, exit 0; 65536 zero bytes gave no output, exit 2; `trap_narrow.om` ran
85with exit 105. The same `fnv1a32.om` prefixed with `target x86linux` printed `0b e9 47 1a` for
86`abc` with exit 0 under `qemu-x86_64` 8.2.2: EMULATED, not native x86.
87
88The omega MCP tools (`compile`, `run`, `lookup`) use the guide pin since omega-mcp
89[#6](https://github.com/aien-dev/omega-mcp/pull/6): omega-mv `f4df8239`, omc `3ad9f10f…3194`.
90Before that they used omega-mv `e5b32567`, omc `2c824805…029f` (history): that omc predated #848,
91so `while ... bound 1000000` was `error 8` there (1..999999), and it still had the #775 empty-text
92defect (`len` of a `text e ""` passed as `view uchar *` returned a stale register value, exit 36 in
93the program recorded under "Empty text" below). Both are gone at the MCP pin. A server process
94started before the repin still runs the old binary: check `compiler_sha256` in a `compile` result.
95At this pin `execprog` closes every descriptor at or above 3 (omega-mv #970); omega-mcp #6 moved its
96bwrap control pipes to fds 0..2 for that reason.
97
98### Previous pin `3a163bc5` (2026-10-31, history)
99
100| Item | Value |
101|---|---|
102| Commit | `3a163bc5eafa5be4b9ca97b7f17046c33f0d9032` (squash of [#857](https://github.com/aien-dev/omega-mv/pull/857), `for ... bound N` and the IR loop ranges, 2026-10-31) |
103| Compiler source `seed/omc/omc.om` | 16,422 lines, 495 `^fn ` lines, sha256 `0ed35c70437d498cbce3deb661bb24ba4753ec16a8890450a482aaea147bca2a` |
104| Compiler `seed/out/omc` | sha256 `24caacf463cc29c5413d5b2565ef8f88c76e60a585bbad44d2388cb1ac29abb7`, 517,768 bytes (equals `seed/out/omc.sha256`; last `seed/omc/size-history.tsv` row `forbound-857-main`) |
105
106This pin had #967, #948, #875, #918, #853, #848 and #857 but not #994, so its `scrub` zeroed live
107float locals (section 6). #990, #992 and #989 touched tests and docs only, and the seed files listed
108above were unchanged between `91c83438d` and `3a163bc5e`.
109
110Observed 2026-10-31 on a Linux AArch64 host in a clean detached worktree at `3a163bc5e`:
111`sh seed/omega-from-seed.sh` exited 0 (`RC=0`) and left `seed/out/omc` at exactly `24caacf4…abb7`
112with a clean `git status`. Both guide examples were rerun with that omc: `fnv1a32.om` compiled with
113exit 0 and empty stderr to a binary byte-identical to the one `2aec185d` emits; `abc`, `a` and empty
114input gave `0b e9 47 1a`, `2c 29 0c e4`, `c5 9d 1c 81`, exit 0; 65536 zero bytes gave no output,
115exit 2; the wrong-prime control (`16777617`) gave `55 be dc f5` for `abc`. `trap_narrow.om`
116compiled with exit 0 and empty stderr and ran with exit 105; deleting only its unmasked store
117(negative control) changed the run exit to 44. The same `fnv1a32.om` prefixed with
118`target x86linux` printed `0b e9 47 1a` with exit 0 under `qemu-x86_64` 8.2.2: EMULATED, not
119native x86.
120
121### Previous pin `91c83438` (2026-10-31, history)
122
123| Item | Value |
124|---|---|
125| Commit | `91c83438daec0bdb88bf5c077cae10f3d15d365d` (squash of [#965](https://github.com/aien-dev/omega-mv/pull/965), error-code registry and IR error 30, 2026-10-31) |
126| Compiler source `seed/omc/omc.om` | 15,952 lines, 512 `^fn ` lines, sha256 `92eb49f35715147ccb6c6b00a96b9cb38d7f7383de14d4f6521d2e07eaad465c` |
127| Compiler `seed/out/omc` | sha256 `2aec185d4ed6d7a6a5779ed656b4e56904742bde5551b02893fb5f73916ad8d5`, 495,668 bytes (last `seed/omc/size-history.tsv` row `error-registry-965`) |
128
129Three merges after `4376c2112` (omc `62775d2a…712b`) changed the compiler: #946 (`d94617177`, host
130words `cpufence` 199 / `cpurelax` 200), #970 (`1db941627`, `execpure` word 198 and `close_range`
131before `exec`; omc `7a8b84fcc07808a52e6cbb65aa7450c754b3ad62eeddf9ec64cc0edd0938b2de`) and #965
132(`91c83438d`: error-code registry and IR error 30, section 11; float literal scans and the untyped
133long float literal miscompile, section 4). The `omc.om` line links in this file are permalinks to the
134commit they name; on main the line numbers have moved.
135
136Observed 2026-10-31 on a Linux AArch64 host in a fresh clone at `91c83438d`: the committed
137`seed/out/omc` hashed to `2aec185d…d8d5`; `seed/rung4/om4.bin` alone compiled that `omc.om` with exit 0
138to a 495,668-byte binary with the same sha256; `sh seed/omega-from-seed.sh` exited 0 (`RC=0`) and
139left `seed/out/omc` at exactly `2aec185d…d8d5`. Both guide examples were rerun with that omc, with
140the same results as with the previous main omc `7a8b84fc…` (both compilers emit byte-identical
141`fnv1a32.om` binaries): `fnv1a32.om` compiled with exit 0 and empty stderr; `abc`, `a` and empty
142input gave `0b e9 47 1a`, `2c 29 0c e4`, `c5 9d 1c 81`, exit 0; 65536 zero bytes gave no output,
143exit 2; the wrong-prime control (`16777617`) gave `55 be dc f5` for `abc`. `trap_narrow.om`
144compiled with exit 0 and ran with exit 105; deleting only its unmasked store (negative control)
145changed the run exit to 44. The same `fnv1a32.om` prefixed with `target x86linux` compiled with
146exit 0 to an x86-64 ELF that printed `0b e9 47 1a` with exit 0 under `qemu-x86_64` 8.2.2:
147EMULATED, not native x86.
148
149### x86 integration as tested before merge (observed 2026-10-28)
150
151Then-draft [#923](https://github.com/aien-dev/omega-mv/pull/923), source
152`7ab5fdd067884fd3044155084b39163da1be5c8a`, integrated main and batch 3
153(#904). Its `seed/omc/omc.om` and `seed/out/omc` hashes equal the main pin `bf54b19fa`
154(omc `62775d2a…712b`, main until #946). The seed gate passed, including GATE5. Both guide examples compiled with empty
155stderr: `fnv1a32.om` on `abc` exited 0 with bytes `0b e9 47 1a`;
156`trap_narrow.om` exited 105, while removing its unmasked store exited 44.
157
158The exact first line `target x86linux` selects the x86 backend. Quantity
159negation and complement refuse with error 7 on both targets. Empty text remains
160sized with length zero and emits no literal bytes; bounds checks still apply.
161Target-specific diagnostic contracts preserve the extra x86 stack-check records
162and exact growth-refusal records. See the source's `docs/X86-LINUX.md` and
163`seed/omc/x86-diagnostic-contracts.json`. Historical failed experiments and
164frozen compatibility rows remain separate from current acceptance.
165At main `bf54b19f`, `docs/X86-LINUX.md` is headed "Status: DRAFT; native x86
166qualification NOT_RUN". Its last complete differential (section "Current acceptance
167contracts", source `7ab5fdd0`, QEMU, EMULATED) reported 15179 PASS, 4 NOT_RUN,
168222 EXCLUDED and no FAIL cases, aggregate verdict FAIL because NOT_RUN is not PASS;
169`00ebdee8` then passed the two text-write cases (5 PASS), leaving two invalid-fd ioctl
170cases unrun. Merged in source; not native x86 qualification.
171
172**Error 25 on x86 at main `62d1d0d66` (observed 2026-10-30, compile only; rechecked 2026-10-31 at `4376c2112`).** `docs/X86-LINUX.md`
173([#L201-L202](https://github.com/aien-dev/omega-mv/blob/62d1d0d668f897386a0e311374f8dbcc5c32dde8/docs/X86-LINUX.md#L201-L202))
174defines error 25 as an unsupported target/emission path. In `seed/omc/omc.om` at that commit it is
175raised by the target-line parser for any `target` word other than `x86linux`
176([#L15549-L15550](https://github.com/aien-dev/omega-mv/blob/62d1d0d668f897386a0e311374f8dbcc5c32dde8/seed/omc/omc.om#L15549-L15550);
177`target x86efi` gives `omc: line 1: error 25`), by `emit` when a nondefault target reaches the
178AArch64 emitter ([#L571-L574](https://github.com/aien-dev/omega-mv/blob/62d1d0d668f897386a0e311374f8dbcc5c32dde8/seed/omc/omc.om#L571-L574)),
179by `hostval`, `xhost` and `xio` on a target mismatch
180([#L6807-L6809](https://github.com/aien-dev/omega-mv/blob/62d1d0d668f897386a0e311374f8dbcc5c32dde8/seed/omc/omc.om#L6807-L6809),
181[#L14663-L14665](https://github.com/aien-dev/omega-mv/blob/62d1d0d668f897386a0e311374f8dbcc5c32dde8/seed/omc/omc.om#L14663-L14665),
182[#L15398-L15400](https://github.com/aien-dev/omega-mv/blob/62d1d0d668f897386a0e311374f8dbcc5c32dde8/seed/omc/omc.om#L15398-L15400)),
183and by the `xcc` condition-code fallthrough ([#L14841](https://github.com/aien-dev/omega-mv/blob/62d1d0d668f897386a0e311374f8dbcc5c32dde8/seed/omc/omc.om#L14841)).
184The device and mapping words 166..177 are **not** refused on x86: `xhost` dispatches them to x86
185helpers (`xhdev`, `xhmnew`, `xhmbind`, `xhmdrop`, `xhmcopy`, `xhmmio`;
186[#L14679-L14707](https://github.com/aien-dev/omega-mv/blob/62d1d0d668f897386a0e311374f8dbcc5c32dde8/seed/omc/omc.om#L14679-L14707)).
187`seed/host/tests/device.om`, `mapping.om` and `devcall.om`, each prefixed with `target x86linux`,
188compiled with exit 0 to x86-64 ELF files with main's omc, at `62d1d0d66` and again at `4376c2112`
189(where `target x86efi` still gave `omc: line 1: error 25`, exit 25). They were not run, so no x86
190execution of device words is claimed. The VFIO words `vfioctl`/`vfiomap` are not on main (pending
191draft [omega-mv#878](https://github.com/aien-dev/omega-mv/pull/878), open on 2026-10-31).
192At main `91c83438d` (omc `2aec185d…`, 2026-10-31), at main `3a163bc5e` (omc `24caacf4…`,
1932026-10-31) and again at main `9920aab14` (omc `be8c5130…`, 2026-10-31) `target x86efi` still gives
194`omc: line 1: error 25`, exit 25 (observed); `vfioctl` is still absent from `omc.om` at `9920aab14`
195and #878 is still an open draft. Since #970, `docs/X86-LINUX.md`
196also lists `execpure` (word 198) among the `xhost` error-25 refusals on x86 (source text, not run
197here). These are observations of the omc before #1015; since #1015 merged (`d3d1b1bc7`, omc
198`b4f45121…`) error 25 on `target x86efi` covers only the refusals listed in the next section.
199
200### `target x86efi`: omega-mv#1015 (merged `d3d1b1bc7`, the current pin; observed 2026-11-01 to 2026-11-04)
201
202[omega-mv#1015](https://github.com/aien-dev/omega-mv/pull/1015), branch `feat/x86efi-main`,
203head `19ee7e99fafaa6a509e0fd166126a16226e414f7`, merged 2026-11-04 with the merge commit
204`d3d1b1bc7e3b970016a2176435f78c8f0251bad1`, so the commits cited below stay reachable. First observed at
205`5ce9ecaa7b2034d5a7b4502403591d5c2489c06d` on main `ba5559d9b` (2026-11-01); the omc is the same
206at both: sha256 `b4f45121f6c6d5d8a6ed0f5c4f3934b7cc4bec369bfa89523699bd33928f9b55` (committed
207`seed/out/omc`, reproduced by `seed/omega-from-seed.sh`). An omc built before the merge, such as
208the previous pin's `be8c5130…`, refuses every `target x86efi` unit with error 25 (section above).
209Observed 2026-11-04 at `d3d1b1bc7`: `target x86efi` with `fn main to int` / `ret 0` / `end` compiles
210with exit 0 to a file starting `MZ`; the same unit with `be8c5130` gives `omc: line 1: error 25`.
211
212- The exact first line `target x86efi` emits a PE32+ EFI application for x86-64 UEFI firmware.
213 Only whole programs (`fn main`) are accepted. Error 25 there means one of three refusals: a bare
214 unit (`omc: line 1: error 25`), a Linux host word such as `read` or `write` (error 25 at its
215 line), or an `efi` OP literal outside 0..13 (0..14 with omega-mv#1022, open on
216 2026-11-04). An OP that is not a literal, such as a name, is error 16. `efi` under
217 `target x86linux` is an ordinary unknown name, error 3 (`docs/one_layer/OMEGESE.md` lines
218 441-451 at `19ee7e99`). Observed 2026-11-04 with omc `b4f45121`: `efi 13` compiles, `efi 14` and
219 `efi 15` give `omc: line 4: error 25`, `k = ulong 13` then `efi k …` gives `omc: line 5: error
220 16`, a unit without `fn main` gives `omc: line 1: error 25`, `write` gives `omc: line 4: error
221 25`; under `target x86linux` `efi` gives `omc: line 4: error 3`. With the #1022 omc `3ad9f10f`
222 `efi 14` compiles and `efi 15` is error 25.
223- Keyword 178 `efi`: `st = efi OP ARG BUF OFF N`. `efi 12` is files: ARG bits 0-7 are the sub-op
224 (0 OPEN-READ, 1 OPEN-WRITE, 2 READ, 3 WRITE, 4 CLOSE, 5 OPEN-UPDATE), bits 8-15 the volume
225 (255 = the boot volume), bits 16-63 the position; one open file at a time; an error returns
226 bit 63 | code. `efi 13` is the console: it accepts bytes 9, 10, 13 and 32..126 and writes LF as
227 CR LF; with a NULL ConOut it returns error 43 without calling firmware (source; NOT_RUN, OVMF
228 always installs ConOut). Ops 0..11 ship but are NOT_RUN (`docs/X86-EFI.md` ops table at `19ee7e99`).
229- Exit closes the open file: on `return`, `exit` or any trap, a still-open file is flushed (if
230 opened for writing) and closed with its volume root. Without this, a refusal path that exits
231 between OPEN-WRITE and CLOSE loses the data: `tests/x86efi/run.sh` at `5ce9ecaa` gave
232 `SUMMARY pass=11 fail=0` with `b4f45121` and `pass=9 fail=2` with the previous candidate
233 `d0f756d9…` (both exit checks: `X.TXT` left at 0 bytes). The runner prints NOT_RUN for each
234 check it cannot run (OVMF missing) and exits 77 when nothing ran; since review commit
235 `e6d14505` it no longer reports a false `PASS exit e1`.
236- At entry the program calibrates the TSC with a 100 ms `Stall(100000)` when CPUID reports an
237 invariant TSC.
238- `efi 14` machine identity: [omega-mv#1022](https://github.com/aien-dev/omega-mv/pull/1022)
239 (branch `feat/x86efi-ident`, stacked on #1015, observed at `fbcf08826` and at head `9bf67eff`;
240 omc sha256 `3ad9f10f64309e7acf8a725082b28e23a2a4aeb07e98322fb4dc0fcd8fc93194` at `9bf67eff`;
241 open, not merged, on 2026-11-04 at head `d07974da`). ARG
242 `L << 16` = CPUID leaf L (16 bytes EAX..EDX; N < 16 is error 5), 1 = FirmwareVendor UCS-2 units,
243 2 = FirmwareRevision as the result (nothing written), `3 + (P << 16)` = SMBIOS structure table from
244 byte P (SMBIOS 3 entry point first, else 2; none is error 44, NOT_RUN); anything else is error 32.
245 Structures are left to the program: read only the fields you print (`tests/x86efi/ident/id.om`
246 never reads type 1 serial or UUID). Gates at `fbcf08826`: `tests/x86efi/run.sh` pass=18 fail=0,
247 AArch64/x86linux sweep 2594 same, 0 differ; all EMULATED (QEMU q35 + OVMF). `seed/omc/omc.om` has
248 511 `fn` definitions with #1022 (510 with #1015 alone; the om4 cap is 512) and the seed bootstrap
249 still builds it. aien-train [#55](https://github.com/aien-dev/aien-train/pull/55) uses it for the
250 `M` line of `OUT.TXT`.
251- Gates at `19ee7e99` (`docs/X86-EFI.md`, committed TSVs): the 1305 tracked `.om` files compiled
252 by `b4f45121` against main's `be8c5130` with `tools/x86efi/corpus_diff.sh`: AArch64 663
253 identical, 638 same-refusal, 4 differ (`evidence/x86efi/corpus_b4f45121_vs_be8c5130.tsv`, sha256
254 `e07c912b…`); x86linux 647, 654, 4 (`…_x86linux.tsv`, sha256 `04604a9d…`). The 4 are the
255 `target x86efi` test programs, which only `b4f45121` accepts. Both TSVs were reproduced natively
256 on AArch64 on 2026-11-04. Since `e6d14505`, `corpus_diff.sh` prints NOT_RUN (exit 3) without
257 file(1) and reports the verdict `signal` for an exit above 128. The compiler uses 510 of the om4
258 cap of 512 functions (511 with #1022; #1013, the 4096 raise, is parked).
259- Evidence class: QEMU q35 + OVMF results are EMULATED; #1015 itself is IMPLEMENTED and EXERCISED
260 under emulation, not QUALIFIED. First physical run: EXERCISED on physical hardware (one
261 machine), aien-train `ollm.efi` on Drake's iMac (2026-11-01; `evidence/OMEGALLM/imac/` on
262 aien-train [#53](https://github.com/aien-dev/aien-train/pull/53) at `df1fd9a`, merged `19c952b6`).
263 The run records no machine identity; iMac18,3 and Core i5-7500 come from earlier aienux
264 evidence. The OUT.TXT body equals the AArch64 reference under `tests/omegallm/efi-check.sh` (next
265 bullet), and the written files TR.BIN, HE.BIN and S.CK match their recorded sha256. Reading the
266 stick back: macOS 26 refused to mount the partition the firmware wrote (fsck clean), so copy it
267 with `sudo dd if=/dev/rdiskNs1` and extract with mtools.
268- Pitfall met while porting: `le` is a keyword (comparison), so a local named `le` is error 16;
269 rename it (`lend`).
270- First application: aien-train's Omega LLM `ollm` (aien-train#52, #53 at `df1fd9a`) builds with
271 `TARGET=x86efi sh tests/omegallm/build.sh` (platform unit `native/omegallm/eio.om`, which reads
272 `\OLLM\JOB.TXT` and writes `\OLLM\OUT.TXT`). `tests/omegallm/efi-receipts.sh` boots it under OVMF
273 and requires `EV=` to name a new or empty directory, so it never overwrites receipts.
274 `tests/omegallm/efi-check.sh OUT.TXT REF JOBS BYTES` checks positions as well as content: the
275 first line must be exactly `OLLM efi BYTES`, each reference job must be followed by exactly one
276 `J <ms>` line (an extra one is refused), and the last line must be `OLLM DONE JOBS <ms>`.
277 J-shaped and DONE-shaped lines inside a job's output stay in the comparison. A `> ` job line
278 holding only spaces or tabs runs nothing, gets no J line and is not counted in JOBS. It prints
279 `EQUAL` (exit 0) or `DIFFERENT` (exit 1); exit 2 is a usage error.
280
281### Historical quantity/check/next candidate (observed 2026-10-28)
282
283| Item | Value |
284|---|---|
285| Repository | `github.com/aien-dev/omega-mv`, PR #911 head |
286| Commit | `1fe5976d398646b17acabbf6d9dfae96b017e439` |
287| Compiler source `seed/omc/omc.om` | 12,520 lines, sha256 `3f937160c823d3a90a6b4cc296f00f517f36ede7fd27a06505c998985ec62240` |
288| Compiler `seed/out/omc` | sha256 `d6290c7663c2b4bafb59eb3fdf812476e977f4c144def71095c6248ef9b96b84` |
289| Seed loader `seed/rung0/seed0.hex` | sha256 `baaf081fe6055a768485c5d25d7435681ce00b04cfa80b26c48169f78944e14d` |
290
291Host-only observations below used a fresh clone checked out detached at this commit.
292Hash and count commands: `sha256sum seed/omc/omc.om seed/out/omc seed/rung0/seed0.hex`
293and `wc -l seed/omc/omc.om`; their observed values are in this table.
294The fresh-clone `sh seed/omega-from-seed.sh` run exited 0 and printed:
295
296```text
297PASS seed0 408 bytes, rebuilds itself
298PASS hex1 776 bytes, born from seed0
299PASS asm2 2464 bytes, born from hex1
300PASS om4 om4.bin 14224 bytes
301PASS omc fixpoint d6290c7663c2b4bafb59eb3fdf812476e977f4c144def71095c6248ef9b96b84
302PASS fwd exit 0
303PASS fwd runs, exit 7
304PASS mut exit 0
305PASS mut runs, exit 0
306PASS cycle exit 9
307PASS assign exit 7
308RC=0
309```
310This reproduces the independently recorded binary digest, not an independent
311correctness proof or a full gate5/host qualification.
312
313
314### Pending optional kernel-leaf experiment (2026-10-28; not an active pin)
315
316Compiler [draft #925](https://github.com/aien-dev/omega-mv/pull/925) and bridge
317[draft #38](https://github.com/aien-dev/omega-bridge/pull/38) describe an optional
318restricted ABI experiment, not a prerequisite for Linux-hosted Omega policy.
319Function-mode continuations/effect records can use the existing policy language;
320kernel adapter, lifetime and non-leaf hardening requirements remain separate.
321
322The host-tested compiler source is
323`c4b4500d172690c8a72ae2df7124c1bf70c39173` (isolated base
324`6999fa9e6dae4847c155ef4eacaece74f491d3ca`, distinct from FR9).
325`seed/omc/omc.om` SHA256 is
326`545e630349b45b826d49f8e75ed1fbc0e5d76c90410650f9945e0d89829441c8`;
327experimental executable SHA256 is
328`e7e95a8305fe0bf8331f579533b1fca69101eaf351fc5cea8208e3892a8733b8`.
329The untouched seed remains
330`d6290c7663c2b4bafb59eb3fdf812476e977f4c144def71095c6248ef9b96b84`.
331Bridge source `9a4e5102a82c913699fb7c3dd99a2736cab2b3d6`,
332`src/kernel_leaf.om`, has SHA256
333`3f599cd22bc636084e81d4d3118a352da5ed1c42ce93624c88d7394ebed044cb`.
334None replaces the current candidate/general-language/native-command pin.
335
336The experimental `kleaf` directive permits one bounded unsigned scalar function,
337normal x0 value/x1 status returns and allocated volatile-register clearing.
338It rejects stack/calls/views/loops/host/OM-2 rather than claiming a general kernel
339backend. Its `.om` bridge envelope matches only inspected
340Linux `7.0.0-1019-nvidia` leaf tracing/PAC metadata; GNU binutils 2.42
341performs assembly/object packaging. Native ET_REL generation is not added.
342The compiler-side `seed/omc/kernel-leaf-experiment.py` requires clean compiler
343and bridge commits and produced immutable host receipt SHA256
344`254e2f3ea3acc3f9578e0854c6bd4664df234b3d8c9a9cf970a8c0c3ef8504d7`,
345filed in #925. Self-rebuild, ABI/status/trap/register, refusal/mutant and explicit
346single-kbuild-object comparisons passed. No module link/modpost/sign/load,
347kernel execution, tracing exercise, DMA/IRQ or GPU qualification occurred.
348The broader Linux effect contract is proposed only. Existing examples and
349active pins are unchanged.
350
351### Historical general-language pin (2026-10-25)
352
353| Item | Value |
354|---|---|
355| Repository | `github.com/aien-dev/omega-mv`, branch `main` |
356| Commit | `55f9b0af47de70a3d06357985cf99ae3e45c016f` (2026-10-25, merge of PR #766) |
357| Compiler source `seed/omc/omc.om` | 7,838 lines, sha256 `2e35db7d6c2066fb4a20d19b8a9579c44caca9c9937b0594a89422010b673637` |
358| Committed compiler `seed/out/omc` | sha256 `734f0a39319fbfa930bcc62cb30dbf06d47d78e126372b74f5baf478e6126b61` |
359| Seed loader input `seed/rung0/seed0.hex` | sha256 `baaf081fe6055a768485c5d25d7435681ce00b04cfa80b26c48169f78944e14d` |
360| Language document `docs/one_layer/OMEGESE.md` | blob `89a27d2e68519eb45c103abb23dfe05a68d8ad69` |
361
362Every citation links to that commit: `https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/<path>#L<n>`.
363
364### Rerun at omega-mv `f4df8239` (2026-11-05)
365
366The example gate pins `f4df82394e35893dcf1354dda69a2fe028d94bc1` (#1022), `seed/out/omc` sha256
367`3ad9f10f64309e7acf8a725082b28e23a2a4aeb07e98322fb4dc0fcd8fc93194`, built from seed at main
368`2a1e6d29`. With only the pin moved and no expectation changed, `bash examples/gate.sh` against that
369binary printed
370`GATE PASS examples=110 pass=110 fail=0 omc=3ad9f10f64309e7acf8a725082b28e23a2a4aeb07e98322fb4dc0fcd8fc93194`
371(exit 0) on 2026-11-05, Linux AArch64. Negative control: the gate pointed at the previous omc
372`b4f45121…9b55` was refused with exit 2 (`GATE FAIL omc sha256 b4f45121…, pinned 3ad9f10f…
373(omega-mv f4df8239…)`). The section below is the previous pin.
374
375### Rerun at omega-mv `d3d1b1bc` (2026-11-04, previous pin)
376
377The example gate pins main `d3d1b1bc7e3b970016a2176435f78c8f0251bad1` (#1015), `seed/out/omc`
378sha256 `b4f45121f6c6d5d8a6ed0f5c4f3934b7cc4bec369bfa89523699bd33928f9b55`. #1015 adds the x86efi
379target and leaves AArch64 output unchanged; with only the pin moved and no expectation changed,
380`bash examples/gate.sh` against that binary printed
381`GATE PASS examples=101 pass=101 fail=0 omc=b4f45121f6c6d5d8a6ed0f5c4f3934b7cc4bec369bfa89523699bd33928f9b55`
382(exit 0) on 2026-11-04, Linux AArch64. Negative control: the gate pointed at the previous omc
383`be8c5130…448a` was refused with exit 2 (`GATE FAIL omc sha256 be8c5130…, pinned b4f45121…
384(omega-mv d3d1b1bc…)`). The section below is the previous pin.
385
386### Rerun at omega-mv `9920aab1` (2026-10-31, previous pin)
387
388The example gate pins main `9920aab1413983c2867d02d75b2276341595adb8` (#994), `seed/out/omc`
389sha256 `be8c51301307555254fc59e351d281aae1aa096d91521777e33a41c8b446448a`. #994 changed only the
390`scrub` emitter, and no example uses `scrub`; with only the pin moved and no expectation changed,
391`bash examples/gate.sh` against that binary printed
392`GATE PASS examples=101 pass=101 fail=0 omc=be8c51301307555254fc59e351d281aae1aa096d91521777e33a41c8b446448a`
393(exit 0) on 2026-10-31, Linux AArch64. Negative controls: the gate pointed at the previous omc
394`24caacf4…abb7` was refused with exit 2 (`GATE FAIL omc sha256 24caacf4…, pinned be8c5130…
395(omega-mv 9920aab1…)`), and on a scratch copy `const N ulong 16` changed to 15 in
396`examples/consts.om` ended `GATE FAIL examples=101 pass=100 fail=1` with exit 1 (`stdout differs
397from consts.stdout`). The section below is the pin before.
398
399### Rerun at omega-mv `3a163bc5` (2026-10-31)
400
401The example gate then pinned main `3a163bc5eafa5be4b9ca97b7f17046c33f0d9032` (#857), `seed/out/omc`
402sha256 `24caacf463cc29c5413d5b2565ef8f88c76e60a585bbad44d2388cb1ac29abb7`. With the previous tree
403and only the pin moved, the gate against that binary ended `GATE FAIL examples=99 pass=97 fail=2`:
404`mistake_bound_range.om` (`while ... bound 1000000`, valid since #848) and `mistake_for_bound.om`
405(`for ... bound 10`, valid since #857) both compiled with exit 0 where error 8 and error 5 were
406expected. `mistake_bound_range.om` now uses `bound 9223372036854775808` (error 8, line 4);
407`mistake_for_bound.om` became `for_bound.om` (exit 10); `trap4_for_bound.om` (a value count 11 over
408`bound 10`, exit 104) and `mistake_ir_bound.om` (`ir`, `while ... bound 1000001`, error 8, line 5)
409are new. On 2026-10-31, Linux AArch64, `examples/gate.sh` against `24caacf4…abb7` printed
410`GATE PASS examples=101 pass=101 fail=0` (exit 0). Negative controls on a scratch copy each ended
411`GATE FAIL examples=101 pass=100 fail=1` with exit 1: `bound 9223372036854775807` in
412`mistake_bound_range.om` (`compile exit 0, expected 8`) and `bound 4` in `for_bound.om`
413(`exit 104, expected 10`). The gate pointed at the previous omc `2aec185d…d8d5` was refused with
414exit 2. The section below is the previous pin.
415
416### Rerun at omega-mv `91c83438` (2026-10-31)
417
418The example gate then pinned main `91c83438daec0bdb88bf5c077cae10f3d15d365d` (#965), `seed/out/omc`
419sha256 `2aec185d4ed6d7a6a5779ed656b4e56904742bde5551b02893fb5f73916ad8d5`. On 2026-10-31, Linux
420AArch64, `examples/gate.sh` against that binary printed `GATE PASS examples=98 pass=98 fail=0`
421(exit 0) with no expectation changed. The rerun also showed that code 25 is emitted (it has been
422since the x86 integration `bf54b19f`): `target foo` as the first line is `omc: line 1: error 25`
423under both `2aec185d` and the pre-#965 `7a8b84fc`. `examples/err25_target.om` now records it, and
424the gate printed `GATE PASS examples=99 pass=99 fail=0` (exit 0); with its first line changed to
425`target x86linux` (a known target) that example fails (`compile exit 0, expected 25`). Negative
426controls on a scratch copy of the 99-program tree each ended `GATE FAIL examples=99 pass=98 fail=1`
427with exit 1: `const N ulong 16` changed to 15 in `examples/consts.om` (stdout `15` instead of
428`16`), and one byte appended to `consts.stdout`. The gate pointed at the pre-#965 omc `7a8b84fc…`
429was refused with exit 2. The 2026-10-29 section below is the previous pin.
430
431### Rerun at omega-mv `bf54b19f` (2026-10-29)
432
433The example gate now pins this compiler. On 2026-10-29, Linux AArch64, `examples/gate.sh` against
434`seed/out/omc` sha256 `62775d2a391cfef7cde64e387655caa9809a267093112910ec76bfa568f3712b` printed
435`GATE PASS examples=98 pass=98 fail=0` after the keyword-prefix expectation was updated. The same
436gate pinned to `2c824805…029f` had passed 98/98 with the old expectation. A copy of the new gate
437pointed at `2c824805` was refused (exit 2).
438
439| Item | Value |
440|---|---|
441| Commit | `bf54b19fa590e8ae925c0e80815516dbf41e7326` (2026-10-28, merge of PR #923) |
442| `seed/omc/omc.om` | 15,624 lines, sha256 `96d51b63c8f451661ac715395078e04f39195e50c9e8fe37746cda121e4d7a1e` |
443| `seed/out/omc` | sha256 `62775d2a391cfef7cde64e387655caa9809a267093112910ec76bfa568f3712b` |
444| `seed/rung0/seed0.hex` | sha256 `baaf081fe6055a768485c5d25d7435681ce00b04cfa80b26c48169f78944e14d` (unchanged) |
445| `docs/one_layer/OMEGESE.md` | blob `90fa5d0c32757da6e7c271e96406b75105ba8008` |
446
447Two defects recorded at `e5b32567` are fixed in this compiler (the #904 integration, `e2662fff`):
448`fn continue_x` compiles and the program exits 7 (`examples/defect_keyword_prefix.om`); `bitcast int`
449of `uint 4294967295` compares equal to -1 and `add` 2 returns 1, and `bitcast uint` of `int -1`
450compares equal to 4294967295. At `2c824805` those three programs were error 16, exit 2 and exit 2,
451and `add` 2 trapped 1. `fn continue` is still error 16. The #775 empty-text defect was reproduced at
452`2c824805` (see the bullet below); it is fixed at the guide and MCP pin, so `part e 0 0` is only
453needed for an older vendored omc. Other "observed at e5b32567" lines below are dated history; the
454example suite still matches them.
455
456### Historical rerun at omega-mv `e5b32567` (2026-10-27)
457
458Every example and rule in this file that a program can show was rerun on 2026-10-27 with the
459compiler below, on a Linux AArch64 host only. The 2026-10-29 section above is current where it
460disagrees with this list.
461
462| Item | Value |
463|---|---|
464| Commit | `e5b32567a7aff3ce594e3254a622a846a6cd190b` (2026-10-26, merge of PR #868) |
465| `seed/omc/omc.om` | 12,040 lines, sha256 `7703da00055fc0c7a91fcae43071df76a3f277dbe867cb284a3bdff3bedb7e1b` |
466| `seed/out/omc` | sha256 `2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f` |
467| `seed/rung0/seed0.hex` | sha256 `baaf081fe6055a768485c5d25d7435681ce00b04cfa80b26c48169f78944e14d` (unchanged) |
468| `docs/one_layer/OMEGESE.md` | blob `119c559557e4f227dee348c0e0e1240c71a42df3` |
469
470The executable record is [`examples/gate.sh`](../../examples/gate.sh): it refuses any other compiler
471hash, then compiles and runs 98 programs (`examples/*.om` and this skill's `examples/*.om`) against
472exact expected stdout bytes, exit statuses and compiler stderr lines. Observed:
473`GATE PASS examples=98 pass=98 fail=0`. Negative controls on a copy each ended `GATE FAIL` with
474exit 1: one changed digit in an expected stdout, an expected exit 105 changed to 104, an expected
475stderr line number changed, a removed `.expect` file, and a changed program body; a compiler with one
476appended byte was refused with exit 2. Arithmetic expectations were checked with Wolfram
477(`examples/WOLFRAM.md`).
478
479Changes and confirmations against the rules below, each observed with a program:
480
481- **Hex literals are OM-2 only.** In an OM-1 unit `uint 0x10` is error 6. After an `om2` line it is
482 16; `0X10` (uppercase prefix) is error 6, and the value must fit the type: `int 0xffffffff` is
483 error 8 (`examples/om2_hex_rotr.om`, `mistake_om2_upper_hex.om`, `mistake_om2_int_hex.om`).
484- **`+` is refused.** `y = x + 1` is error 5 and a value starting with `+` is error 3
485 (`mistake_infix.om`). OMEGESE 9.9's "`+ - * /`" is still wrong at this pin.
486- **Float to integer truncates toward zero and saturates; it never traps.** `long 1.0e30f64` is
487 9223372036854775807, `long -1.0e30f64` is -9223372036854775808, `long -5.75f64` is -5,
488 `uint -5.5f64` is 0, `uchar 300.0f64` is 255, and a NaN converts to 0 (`float_to_int.om`). Integer
489 to integer conversion stays checked (trap 5).
490- **The `=` of an assignment is optional** (OMEGESE line 24), so `return x` compiles as an assignment
491 to a new name `return`. In a value function the missing `ret` then shows as error 18
492 (`mistake_return.om`).
493- **`for ... bound N` and the bound range** (since #848 and #857, in the pin since `3a163bc5`): `for i ulong
494 n bound 10` compiles (`for_bound.om`, exit 10) and a count past the bound traps 4
495 (`trap4_for_bound.om`); a bound is 1..9223372036854775807, so `bound 0` and `bound
496 9223372036854775808` are error 8 (`mistake_bound_range.om`), and in IR mode it is 1..1000000
497 (`mistake_ir_bound.om`). `trap` takes 1..14 (`trap 15` and `trap 0` are error 8; `trap 14` exits
498 114).
499- **Names:** an 8-character variable compiles and 9 is error 13; a 63-character function name
500 compiles and 64 is error 13. `len` or `stat` as a variable is error 16, `free` is error 9, and
501 `bits` is an ordinary name.
502- **Placement:** a `struct` line after the first `fn` is error 9; `new` inside a block is error 9; a
503 variable `new` length is error 16; `main` with a parameter is error 9. A `const` in function mode
504 compiles.
505- **Parameter slots, not parameter count.** Parameters fill x0..x5: an OM-2 unsized `view T *` /
506 `edit T *` takes two slots (pointer, count), every other parameter one, a sized array included
507 (OMEGESE 9.13 "Parameter slots"). Observed: 3 sized views plus 3 scalars compile and run; 2 unsized
508 views plus 2 scalars compile; 2 unsized views plus 3 scalars, or 7 scalars, are error 9 on the `fn`
509 line (`examples/om2_param_slots.om`, `mistake_om2_param_slots.om`, `mistake_seven_params.om`).
510- **Function names of 9..63 bytes are not keywords by their first 8 bytes** (fixed in the #904
511 integration, measured 2026-10-29 at omc `62775d2a`). `continue_x` compiles and returns 7
512 (`examples/defect_keyword_prefix.om`). At omc `2c824805` the same file was error 16. An exact
513 keyword name (`fn continue`) is still error 16.
514- **OM-2 slices:** `part A off n` is only an argument to an unsized `view T *` parameter. As a value
515 of its own it is error 9, to a sized parameter error 7, of a global error 19; `off + n` past the end
516 traps 3 at run time (`om2_views.om`, `om2_part_trap.om`).
517- **Errors 1 and 2 reproduce:** a directory as the compiler's stdin gives exit 1,
518 `omc: line 0: error 1`; stdout on `/dev/full` gives exit 2 with the line after the last input line
519 (`omc: line 5: error 2` for a 4-line unit). A 33rd `export fn` in an OM-2 unit is error 14; exports
520 are function mode, so an `export` beside `fn main` is error 9.
521- **The seeded C bridge accepts typed views at bridge main `29d9cff7`.** Rechecked 2026-11-06
522 with `OMEGA_SEEDED_OMC=<e5b32567-omc> sh tools/bridge-seeded c unit.om`: a unit
523 `fn first a view T 1 to T` / `ret get a 0` / `end` emits C with status 0 for each
524 `T` in `uchar ushort uint ulong f32`; omega MCP compile also accepts all five.
525 The earlier `uint`/`ushort`/`f32` error-24 refusal at bridge `bc11b30b` is obsolete
526 after typed views [#73](https://github.com/aien-dev/omega-bridge/pull/73).
527 The checked borrowed-view freestanding profile [#77](https://github.com/aien-dev/omega-bridge/pull/77)
528 also covers these element kinds; see `omega-harness` for its separate ABI and limits.
529- **A bool does not convert to a number at omc `e5b32567`.** Rechecked with MCP compile
530 on 2026-11-06 (omc `2c824805…029f`, not the section 0 compiler):
531 `x = ulong eq a 1` in a function is error 9 at that line; `ret ulong f u` when
532 `f` returns bool is likewise error 9. `fn f a ulong to ulong` / `if eq a 1` /
533 `ret 1` / `end` / `ret 0` / `end` compiles and emits seeded C successfully.
534 Use the explicit branch rather than a numeric conversion of bool.
535- **Error 24 needs more than 1 MiB of code inside one loop.** 40 functions of 4,000 checked `add`
536 lines each compiled and ran, because each function's branches stay short. One `while` loop with
537 270000 copies of `x = add x 1` was refused with `omc: line 270006: error 24` (the loop's `end`);
538 with 140000 copies it compiled. The check is `disp19` (omc.om line 2465 at `e5b32567`, line 2956
539 at `91c83438`): a conditional branch reaches at most 2^18 - 1 words forward. The recipe is in
540 `writing-omega` section 11. Rerun 2026-10-31 with omc `2c824805` and with the then pin omc
541 `2aec185d`: both give exit 24 and that line for 270000 copies, and exit 0 for 140000 copies (the
542 program then exits 0). At `e5b32567`, codes 25 and 26 are not emitted by any `fail` call. Since
543 #948 (`dc0d06e95`, in the pin since `3a163bc5`) every B.cond/CBZ/CBNZ imm19 and every B/BL imm26 site goes
544 through one checked `bdisp` ([omc.om#L2982-L2992](https://github.com/aien-dev/omega-mv/blob/3a163bc5eafa5be4b9ca97b7f17046c33f0d9032/seed/omc/omc.om#L2982-L2992));
545 the 8 MiB output ceiling (error 14) keeps every B/BL inside its 128 MiB reach, so imm26 error 24
546 is a defence no legal program reaches (`seed/qualification/security673/README.md`). Observed
547 2026-10-31 at `3a163bc5e`: that directory's `gate669.om`, built with omc `24caacf4…`, ended
548 `GATE669 PASS bounded Linux AArch64 execution and independent decoding only` (exit 0, host only);
549 rerun 2026-10-31 at `9920aab14` with omc `be8c5130…`: compile exit 0, the same PASS line, exit 0
550 (host only). `bdisp` is unchanged by #994.
551- **Narrow `bitcast`:** at omc `2c824805`, `bitcast int` of `uint 4294967295` was not -1 and `add` 2
552 trapped 1, and `bitcast uint` of `int -1` was not 4294967295. At omc `62775d2a` those two cases
553 are correct (exit 1 and exit 1; `add` 2 returns 1). `ushort`/`short`, `uchar`/`byte` and `f32` to
554 `int` were not retested on 2026-10-29. Do not assume they are fixed. Decode signed values
555 arithmetically when you have not measured the pair (`examples/wire_le.om`).
556- **`byte` is signed 8-bit** (`i8`, OMEGESE line 109); `char` is not a type (error 3).
557- **Empty text through `view uchar *` (omega-mv #775).** The stale `len` depends on layout, so one
558 passing two-text unit proves nothing (a 2026-10-29 two-text unit returned 0 on `2c824805` and
559 `62775d2a`). Reproduced 2026-11-04 on the MCP omc `2c824805…` (`omega_run`), with
560 `fn f t view uchar * to ulong` / `ret len t` under `om2`:
561 - `text ta "abc"`, `text te ""`, `text tb "xy"`, `main` `ret int f te`: exit 36 (expected 0);
562 `ret int f tb` exits 2 and `ret int f part tb 0 0` exits 0.
563 - only `text e ""`, `ret int f e`: exit 28; adding `text f "0123456789abcdef0123456789abcdef"`
564 makes it exit 60; `ret int f part e 0 0` exits 0.
565
566 With the guide pin all three exit 0 (`be8c5130…` 2026-11-04, `b4f45121…` 2026-11-05; fixed by the
567 #904 integration `e2662fff`). The MCP pin has carried the fix since omega-mcp #6. On an older
568 vendored omc (anything built before `e2662fff`) pass `part e 0 0` instead
569 (`examples/empty_text_part.om`). synapse-mcp hit it: every empty-text record arrived with len
570 28-60 and positional arguments were refused as too long.
571- **`and`/`or` are eager everywhere, not only in contracts.** `if and gt n 0 eq get a sub n 1 13`
572 traps 3 (exit 103) when `n` is 0, because `get a sub n 1` still runs (`2c824805`, `omega_run`,
573 2026-11-04). Guard an index with a nested `if`.
574- **Skill examples rerun:** `fnv1a32.om` compile exit 0, empty stderr; `abc`, `a`, empty and 65535
575 zero bytes gave `0be9471a`, `2c290ce4`, `c59d1c81`, `47dac371`, each exit 0; 65536 zero bytes gave
576 exit 2 and no output; the prime changed to `16777617` gave `55bedcf5` for `abc`.
577 `trap_narrow.om` compiled with exit 0 and ran with exit 105, and 44 without the unmasked store. The
578 section 13 inline refusal gave exit 7, `omc: line 3: error 7`.
579- **Section 11a contract fixtures rerun** from `seed/omc/contracts/`: `ok.om` exit 0, `requires.om`
580 exit 109, `release.om` exit 0 and byte-identical to `erased.om`; `diagproof.om` stderr
581 `omc-check 1 erased line=3 rule=constant-true kind=requires`, `diagrelease.om` stderr
582 `omc-check 1 erased line=3 rule=release kind=requires`, each compile exit 0.
583
584### Merged IR/wasm backend (2026-10-26)
585
586Source: omega-mv main `3364a1dfd0ca50c1b82bf19ba34932d8bc10a7a9`,
587[#787](https://github.com/aien-dev/omega-mv/pull/787), after the separate boolean IR
588fix [#786](https://github.com/aien-dev/omega-mv/pull/786), merge
589`87489da90a1a7a750fd4a7f9eeb005b1221721f6`. Source merge is not deployment.
590
591| Backend item | Verified value |
592|---|---|
593| `seed/omc/omc.om` | sha256 `bd64bb6f20952818e155328f429ab6cd36bba213e3e00b60d796336f9d0c9343` |
594| `seed/out/omc` | sha256 `befb8199db8c4bca188a494dfaac2a6f0ee5c36fcea11188c75666c55fce8a1d` |
595| Prior main compiler at `ec07d25d5506d33567adbd4d9b518177b7933bad` | sha256 `499236398aabc652e2dae27fe4bdc4c5db3d3726314356e0dbef23e3345803ec` |
596| `seed/wasm/irwasm.om` | sha256 `8dc7bf602eb882e26a18b9e2dc4cacdd3ad68827215e71874b14c4acb237ccf8` |
597
598The compiler corrects IR-mode boolean AND/OR/XOR typing: all three previously
599exited 7 and now compile to bytes identical to the C encoder, accepted by checker2.
600Boolean arithmetic and shifts remain refused. The om4-built compiler and two
601self-rebuilds are byte-identical; the full compiler referee/wrong-word-mutant gate
602ended `GATE5 PASS`. Retained evidence:
603`evidence/IR-BOOL-20261026/` from merged #786.
604
605`seed/wasm/irwasm.om` is a seeded Omega backend for **scalar OSC IR v1**, not an
606arbitrary foreign-source converter. It writes an import-free WebAssembly MVP module
607and exports each function under its ASCII IR name. ABI tags bool/u8/u16/u32/i8/i16/i32
608map to i32, u64/i64 to i64, void to no result. Internal canonical i64 locals preserve
609width and signedness; signed overflow, invalid shifts/casts/division, explicit traps
610and lowered loop guards become wasm runtime traps. Wasm does not expose Omega's
611numeric trap code. Supported instructions: CONST/MOV/BIN/UN/CMP/CAST/CALL/TRAP/BR/CBR/RET.
612Limits and exact mappings:
613[`OMEGESE.md` section 11.1](https://github.com/aien-dev/omega-mv/blob/3364a1dfd0ca50c1b82bf19ba34932d8bc10a7a9/docs/one_layer/OMEGESE.md#L914).
614Versions other than 1, memory/reference/arena/pool/slice tags and operations refuse.
615The module is buffered so parse/type/capacity refusals have empty stdout.
616
617Host command: `nice -n 19 sh seed/wasm/gate-irwasm.sh`.
618Observed on Linux AArch64, Node v24.21.0 used **only as a read-only oracle**:
619`PASS parity cases=129 units=13 traps=29; every export exercised`.
620The parity checker rejected an add-to-sub IR-byte mutant with exit 1; two translations
621of every unit were identical, and named refusal exits were pinned with empty stdout.
622Source-bound full logs/artifacts: `evidence/IRWASM-20261026/` from merged #787.
623Re-exercised at head `0e81d5a6f990000f1dca50f05f0c6050f7cdf9a5` before merge;
624the backend gate did not run browser integration or GPU qualification.
625
626Existing guide examples were rerun with this compiler: FNV `abc` emitted
627`0b e9 47 1a`, compile/run exit 0; `trap_narrow.om` compiled with exit 0 and ran with
628exit 105. Removing only the unmasked store (negative control) changed the run exit
629to 44. The historical examples and their old measured evidence below remain intact.
630
631Downstream browser integration is separately **merged**, not qualified as deployed here:
632[aienos.com #109](https://github.com/aien-dev/aienos.com/pull/109), merge
633`a6aec5e2628804abd27101ba184d7a319f95774e`; #108 closed as superseded.
634Its existing OM-1 compiler pin `734f0a39319fbfa930bcc62cb30dbf06d47d78e126372b74f5baf478e6126b61`
635compiled the same upstream `irwasm.om` to **identical** backend bytes
636`2d235a70c39ac1461a09c41e10e058d962b767ae83893cdcfc693ef6c47182e6`.
637No site compiler pin bump was necessary. `irwasm.provenance` records the source and build.
638The site unit `om/hive-page/fresh.om` accepts clock/timestamps, the caller's stale
639threshold and fetch status; `check.sh` uses an `ir` header and the pinned backend to
640produce `public/wasm/hive-fresh.wasm`, sha256
641`af9e1fb0d9e736949b2aa83c0bf978ac2d98f37428a8507176abaa1dd50b777b`.
642
643`freshness-js.om` emits the loader and explicit JS load-failure fallback.
644`data-fresh-engine="wasm|js"` discloses the engine; the four state codes are
6450 fresh, 1 stale (strictly past the supplied threshold), 2 backwards timestamp,
6463 interrupted fetch. Source-clock trust gating remains separate. Browser-supplied
647fractional elapsed age is rounded upward only at the integer wasm boundary,
648preserving a strict comparison against the validated integer threshold.
649`sh om/hive-page/gate-fresh.sh` compared ten boundary cases with actual native
650AArch64 execution and read-only Node wasm execution. Real Chromium poll fixtures
651exercised all four wasm states, incorrect-MIME arrayBuffer loading, and one-byte
652module corruption falling back to JS. Corrupting that byte on disk made the
653x86_64-compatible asset hash test fail with exit 101; original bytes were restored.
654Historical evidence/fixtures/results remain `om/hive-page/fresh-evidence.log` and sibling
655`fresh-*` files on closed #108, not in the #109 main tree. These were synthetic acceptance
656feeds, not production telemetry. The helper source and wasm artifact were carried over
657byte-identically. Production browser verification, deployment and GPU qualification
658remain NOT_RUN by this guide update.
659
660### Current main, OM-2 contract and the 1.0 roadmap (2026-10-26)
661
662omega-mv main `19f014f2178ca9cd3473728fe00a475a2398c409` (merge of
663[#801](https://github.com/aien-dev/omega-mv/pull/801)) changed no compiler file after `3364a1dfd`:
664`seed/out/omc` and its sidecar are still `befb8199...8a1d`, the backend pin above. Read only; not
665rebuilt for this note.
666
667- **OM-2 is merged.** The opt-in profile (first non-`note` line `om2`, `om2 diag` or `om2 fmt`)
668 landed through [#750](https://github.com/aien-dev/omega-mv/pull/750),
669 [#753](https://github.com/aien-dev/omega-mv/pull/753),
670 [#754](https://github.com/aien-dev/omega-mv/pull/754),
671 [#764](https://github.com/aien-dev/omega-mv/pull/764), the SHA-256 cutover
672 [#776](https://github.com/aien-dev/omega-mv/pull/776) and the qualification harness
673 [#752](https://github.com/aien-dev/omega-mv/pull/752). What `omc` implements is
674 [OMEGESE section 9.13](https://github.com/aien-dev/omega-mv/blob/19f014f2178ca9cd3473728fe00a475a2398c409/docs/one_layer/OMEGESE.md#L624).
675- **The normative OM-2 contract is on main since #801**, byte-identical to branch `om2/contract`
676 @ `23fc7f5c9`: `spec/omegese-om2.md` sha256 `245bb74e940c811ab325e6fabb33f0599ad46aaf6b9064fd2750c43980040881`,
677 `spec/omegese-om2-errata.md` (E1..E18) `7b8c1ea58738806cfc29a145a2d60ede5e1c399366a1665004859304bdd2d671`,
678 `spec/omegese-om2-measure.md` `507702d0e69ccc76cefb3675e2b22f7279497d362b42ee3043f3a1057aa17bad`.
679 Before #801 these files existed only on that branch; older notes that call the contract "missing"
680 or "draft only" are stale.
681- **OM-2 is frozen.** `spec/omegese-om2.md` says "A change after freeze needs `omegese-om3.md`", and its
682 sha256 `245bb74e…` is pinned by `evidence/OM2-COMPILER/*/PINS.txt` and
683 `seed/qualification/om2/oracle/s0s2/PROVENANCE.txt`. Never edit it to add a feature: write the
684 addition in `spec/omegese-om3.md` (first proposed in draft omega-mv#1008, not on main 2026-11-04).
685 The errata file only resolves conflicts inside the frozen text.
686- **Omega 1.0 roadmap:** [`docs/ROADMAP-1.0.md`](https://github.com/aien-dev/omega-mv/blob/19f014f2178ca9cd3473728fe00a475a2398c409/docs/ROADMAP-1.0.md),
687 milestones RM1..RM11 with acceptance gates, tracked in
688 [#790](https://github.com/aien-dev/omega-mv/issues/790) (gate coverage),
689 [#791](https://github.com/aien-dev/omega-mv/issues/791) (contracts),
690 [#792](https://github.com/aien-dev/omega-mv/issues/792) (efficiency),
691 [#793](https://github.com/aien-dev/omega-mv/issues/793) (memory model),
692 [#794](https://github.com/aien-dev/omega-mv/issues/794) (strings),
693 [#795](https://github.com/aien-dev/omega-mv/issues/795) (modules),
694 [#796](https://github.com/aien-dev/omega-mv/issues/796) (bridge FFI),
695 [#797](https://github.com/aien-dev/omega-mv/issues/797) (diagnostics),
696 [#798](https://github.com/aien-dev/omega-mv/issues/798) (targets),
697 [#799](https://github.com/aien-dev/omega-mv/issues/799) (compiler trust and C retirement),
698 [#800](https://github.com/aien-dev/omega-mv/issues/800) (stability). It is a plan, not a readiness
699 claim; a gap listed there is missing, not impossible.
700- **Gate coverage at main:** `seed/wasm/gate-irwasm.sh` and `seed/qualification/om2/gate.om` are
701 merged but no `tests/gates/*.gate` runs them (RM1, #790). `tests/gates/run.sh seed` passing says
702 nothing about OM-2 fixtures or irwasm; run those yourself and report them separately.
703- **OM-2 defect** [#775](https://github.com/aien-dev/omega-mv/issues/775), closed 2026-10-29: an
704 empty `text` passed to a `view uchar *` parameter was reported to see the next text's bytes
705 (`len` 32, not 0). Fixed by #897 inside the #904 merge `e2662fff`, an ancestor of main
706 `bf54b19f`: an empty `text` is now a sized array of length 0. On 2026-10-29, with main
707 `seed/out/omc` `62775d2a...712b` (AArch64 host), `seed/omc/om2/s4/v-text-empty.om` compiled
708 and ran with exit 0, and `v-bad-text-empty.om` refused with `omc: line 5: error 21`. Compiler
709 pins in this file older than the #904 batch predate the fix.
710- **Semantic tools, merged:** `seed/semhash` ([#830](https://github.com/aien-dev/omega-mv/pull/830),
711 train r4, main merge `f9a9a40b`, 2026-11-02) is a per-function meaning hash plus `diff` that ignores
712 local/parameter renames, notes, layout and function order; its oracle requires `omc(canon(x))` to be
713 byte-identical to `omc(x)` for every accepted unit. `seed/effects`
714 ([#820](https://github.com/aien-dev/omega-mv/pull/820), train r1, main squash `f56a372a`, 2026-10-30)
715 is described in section 9. Both build by concatenation and do not change the compiler. Observed
716 2026-11-04 at main `d3d1b1bc`, omc `b4f45121…`: `sh seed/semhash/check.sh` printed
717 `SEMHASH PASS cases=249 controls=13`, exit 0.
718
719### Merged compiler batch: contracts, capacity and f32 returns
720
721Omega main `91b3c9326919faf1491e29ae9276929e8349b8c7` merges #768, including executable
722contracts #807 and f32 return repair #812. Status: MERGED and EXERCISED on arm64 Linux;
723not GPU qualification. The batch receipt is `evidence/BATCH-189ada82/README.md` at that commit.
724Host qualification with C oracles, gate5, contract checks and mutants, float and capacity
725boundaries and IR-trap mutants passed. Frozen C2 retains three expected failures from the
726intentional capacity expansion; `manifest-c2-capacity.txt` records those three newly accepted
727units separately. Do not claim the frozen manifest itself passes or rewrite it.
728
729| Item | Value |
730|---|---|
731| `seed/omc/omc.om` | 11,555 lines, sha256 `de7f5c8035608c244fb612ed5bf7691ae22d3b64735a5e7122fe9d0c67853d2b` |
732| `seed/out/omc` | sha256 `189ada82e00bb440cb41351bd252cc68c54a1b1050051cc42a1df700081c3b54` |
733| Language text | `docs/one_layer/OMEGESE.md` section 12, "Executable native contracts, version 1" |
734| Fixtures | `seed/omc/contracts/contracts.cases` (44 rows), `mutant.cases` (2 mutants, both must FAIL) |
735| Size ledger | `seed/omc/size-history.tsv`, row `RM2-capacity-f32` with that sha256 |
736
737The capacity is 4096 functions, 8192 names and 524288 call sites per unit. Native `to f32`
738returns now work: internal void return code 12 is distinct from f32 value type 10 and f64 11.
739`gate8.sh` exercises f32 values and rejects void-as-value (7) and f32 fallthrough (18).
740Consumers must explicitly migrate and qualify their own pins; a main merge does not deploy them.
741
742### Compiler batch 3 (merged #904; superseded on main by #923)
743
744[omega-mv#904](https://github.com/aien-dev/omega-mv/pull/904) merged at
745`e2662fffbce1c21ef09da71c0d8808133a6af8ab`; that merge carries the same `omc.om` and
746`seed/out/omc` hashes as the tested source below. Tested on 2026-10-28 at
747`7bce2a4fddc43268ac2af09cddc4a5a67d78312d` over main `d94a503f7`, merges #896
748(integer `bitcast` re-extension), #897 (empty `text` sized `nm_len 0`, view count 0; closes the
749#775 defect above), #898 (function names that start with a keyword) and #903 (`pread`/`pwrite`
750destination writable check) and reseeds `seed/out/omc` to sha256
751`1811d4047f118440cc35e995261af6768b606148cb17e18c42158afd15fcad58` (12,577 source lines, 418
752functions, size-history row `RM-batch3-current`). Compiler source SHA-256:
753`d33ef5cab603f85a5cbcbdfdd55391f2ce0448bfcbc5fecbf0393599b636ef04`.
754Status when recorded: HOST_TESTED before merge; merged in source, not deployed. The targeted regression cases, seed/GATE5,
755OM-2 s1 through s4 and their mutants, current-language quantity cases, diagnostic experiment,
756bindings/parity, JSON/HTTP, WebAssembly, CPU OpenCL, IR-trap checks and local TLS suites pass.
757The frozen C2 corpus still fails its six historical assertions; its capacity and batch2
758replacement manifests pass. TLS live-internet parity and GPU gates are NOT_RUN.
759The earlier `397346de` receipt remains immutable history in `evidence/BATCH-397346de/`.
760At this new pin, the guide's FNV example with `abc` outputs `0be9471a` (exit 0), the narrowing
761example exits 105, and removing its unmasked store exits 44. All compile with empty stderr.
762Main has since moved to the x86 integration compiler `62775d2a...712b` and then to `2aec185d…d8d5` (section 0); cite
763`1811d404...ad58` only as the #904 merge pin, never as current main or as x86 qualification.
764
765
766Re-check recipe (read only, in a fresh clone, never in a shared working tree another agent may be using):
767
768```sh
769git clone rad://z6do9WDBhuSnvopDkgFdFr1yWA62 omega-src
770git -C omega-src checkout f4df82394e35893dcf1354dda69a2fe028d94bc1
771git -C omega-src rev-parse HEAD
772sha256sum omega-src/seed/omc/omc.om omega-src/seed/out/omc
773```
774
775If the hashes differ from the table, the rules below are unverified for that tree. Read the changed
776parts of `OMEGESE.md` and `omc.om` first.
777
778Status words used here: **implemented** (in `omc.om` at the pin), **gated** (a committed gate script
779or fixture checks it), **author-verified** (the repository records a run; not re-run for this note),
780**proposed** (described, not on `main`). Nothing here is hardware qualification, and nothing here is
781deployed anywhere.
782### `qty`: checked quantities, not modular words
783
784At the current candidate pin, `qty` is distinct from `ulong`. Do not silently mix
785quantity arithmetic with modular words. Save this as `qty-overflow.om`:
786
787```text
788fn main to int
789a = qty 18446744073709551615
790b = qty 1
791c = add a b
792ret int 0
793end
794```
795
796Use the section 1a compile/run recipe with `prog.om` replaced by `qty-overflow.om`.
797Observed: compile exit 0, empty stderr; run exit 101, empty stdout and stderr.
798The boundary literal is copied from the pinned `tests/quantity/qty_add_overflow.om`.
799
800Negative control: change only `a = qty 18446744073709551615` to `a = qty 0`
801and `ret int 0` to `ret int c`. Observed: compile exit 0, run exit 1,
802empty stdout/stderr. The trap is not an unconditional program exit.
803
804For the modular contrast, replace both `qty` spellings with `ulong` and return
805`int c`. Observed: compile exit 0, run exit 0, empty stdout/stderr: `ulong`
806still wraps. Mixed operands are refused, not coerced:
807
808```text
809fn main to int
810a = qty 1
811b = ulong 1
812c = add a b
813ret int 0
814end
815```
816
817Observed: compile exit 7, empty stdout, stderr:
818
819```text
820omc: line 4: error 7
821```
822
823### `check` and `next`: text diagnostics and prefix context
824
825These are leading input lines to the seeded compiler, not command-line flags
826and not the legacy C `omegese next` interface. At the current candidate pin:
827
828```sh
829printf 'check\nfn main to int\nret true\nend\n' | seed/out/omc
830```
831
832Observed stdout (exit 7):
833
834```text
835omega-diag v1
836om1 TYPE span=19-23 FINAL REPAIRABLE code=7 line=2 expect=value found=true
837```
838
839Observed stderr:
840
841```text
842omc: line 3: error 7
843```
844
845Negative control: replace `ret true` with `ret 0`. Observed exit 0, empty stderr,
846stdout exactly `omega-diag v1` followed by a newline. Check mode emits diagnostics,
847not an executable. Its record line is relative to the program after the leading
848mode line; the ordinary stderr line includes that mode line.
849
850```sh
851printf 'next\nfn main to int\na = ulong 3\nwhile lt a 9\n' | seed/out/omc
852```
853
854Observed exit 0, empty stderr, stdout:
855
856```text
857omega-query v1
858scope: function
859constructs: ret if while for trap exit put end note break continue
860names:
861a ulong local
862functions:
863fn main to int
864```
865
866This is prefix context (scope, constructs, visible names and signatures), not a
867promise of an exact next-token mask. The unfinished loop above is intentional.
868Negative control: compare the observed query with a copy whose name line is
869`a ulong param`. Observed comparison: unequal (`REJECTED`), so a local/parameter
870kind error is detectable.
871
872
873## 1. Which language is which
874
875| Thing | Where | Status |
876|---|---|---|
877| **Omegese**, the `.om` language | `docs/one_layer/OMEGESE.md`, sections 1-11 on main | current |
878| Profile **OM-2** (opt-in per unit) | contract `spec/omegese-om2.md` plus errata E1..E18 (normative, on main since #801); implemented subset in OMEGESE section 9.13 | current, merged; host evidence only |
879| WebAssembly MVP backend `seed/wasm/irwasm.om` | OMEGESE sections 11.1-11.2; scalar OSC IR v1, plus IR v7 (regions, f32/f64, RLOAD/RSTORE/BITCAST/RINIT) since #818 reached main in train r4 `f9a9a40b` (2026-11-01). omc IR mode still writes only v1; v7 test units come from `seed/wasm/v7/writer.js`. `seed/equiv/irequiv.om` keeps the v1 reader, and `seed/equiv/gate-irequiv.sh` checks irwasm's reader against it plus the edits recorded in `seed/equiv/irwasm-v7.sed` (omega-mv #1039) | merged; neither gate in any manifest (#790) |
880| Executable contracts (`requires`, `ensures`, `invariant`, `result`) | OMEGESE section 12; section 11a here | merged in #768, including #807; host-exercised |
881| The seeded compiler `omc`, written in `.om` | `seed/omc/omc.om`, built `seed0 -> hex1 -> asm2 -> om4 -> omc` by `sh seed/omega-from-seed.sh` | on `main` since PR #696 ([README.md#L27](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/README.md#L27)) |
882| Keyword table, the authority for reserved words | `fn kw` in `seed/omc/omc.om` ([#L375](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/seed/omc/omc.om#L375) at `55f9b0af`, [#L765](https://github.com/aien-dev/omega-mv/blob/e5b32567a7aff3ce594e3254a622a846a6cd190b/seed/omc/omc.om#L765) at `e5b32567`, [#L818](https://github.com/aien-dev/omega-mv/blob/91c83438daec0bdb88bf5c077cae10f3d15d365d/seed/omc/omc.om#L818) and `fn kw2` [#L1328](https://github.com/aien-dev/omega-mv/blob/91c83438daec0bdb88bf5c077cae10f3d15d365d/seed/omc/omc.om#L1328) at `91c83438`); same list in `seed/omc/genkw.awk` ([#L16](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/seed/omc/genkw.awk#L16) at `55f9b0af`; [#L16-L18](https://github.com/aien-dev/omega-mv/blob/e5b32567a7aff3ce594e3254a622a846a6cd190b/seed/omc/genkw.awk#L16-L18) at `e5b32567`, which adds `flock` 197 and a second list for `peercred`, `pollfds`, `sendmsg`; [#L17-L20](https://github.com/aien-dev/omega-mv/blob/91c83438daec0bdb88bf5c077cae10f3d15d365d/seed/omc/genkw.awk#L17-L20) at `91c83438`, whose second list adds `qty`, `cpufence`, `cpurelax`), parity checked by `seed/omc/gate18.sh` | gated |
883| C translator `tools/omegese/omegese.c` and `omegese next` | OMEGESE sections 1-8 | legacy referee and token-mask tool, not the compiler |
884| `spec/omega-language-v0.md` (`let x: u8 = ...`, `fn f(x: T) -> T { }`, `//` comments) | Visor console line language, lowered by C in `src/language/` ([#L1-L13](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/spec/omega-language-v0.md#L1-L13)) | history; never write `.om` in that syntax |
885| C under `src/`, including `src/compiler/` | `main` | unfinished migration ([README.md#L50](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/README.md#L50)) |
886
887OMEGESE sections 2-6 describe the C translator's rules; sections 9-12 describe `omc` at
888`91b3c932`. Where they
889disagree, `omc` is what compiles your program:
890
891- Calls: the C path allows calls to earlier functions only. `omc` reads every signature first, so a
892 call may name any function in the unit; recursion is allowed in program mode and refused (error 9)
893 in function mode ([OMEGESE#L409-L417](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L409-L417)). IR mode
894 (a leading `ir` line) again allows earlier functions only ([#L755-L763](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L755-L763)).
895- **IR-mode `TYPE value` casts** (merged on omega-mv main as [omega-mv#967](https://github.com/aien-dev/omega-mv/pull/967),
896 squash commit `96ea448add639f8448a4787ef36a2ade06a1a244`, 2026-10-31; harness issue #141). In IR mode a
897 cast reads its operand at the operand's own type, so it converts an operand of any scalar type; a bare
898 number is range-checked against the cast's type (error 8); bool to or from a number is refused (error 9),
899 a bool comes only from a comparison. Pinned by `seed/omc/gate-ir.sh`. Observed (host only) with omc
900 sha256 `e4d84bc3ff5c91b83ce9a156d262eb28c9563e43374537293129898da093b7a6` built from seed at omega-mv
901 main `d39450a23b5936a0aafd35cc23ca70e5468fd4c0`: `ret ulong sub c 48` and `ret long sub c -128`
902 compile; `ret uchar 256` and `ret ulong sub c 300` (c uchar) are error 8; `ret bool c` and
903 `ret ulong eq a b` are error 9. An earlier pin of this skill (omega-mv `91c83438`, omc `2aec185d…`)
904 predates #967: it gives error 7 for the two widening casts and for `ret ulong eq a b`, and compiles
905 `ret bool c`. The pins `9920aab1` and `d3d1b1bc` include #967 (since `3a163bc5`): observed 2026-10-31, the
906 IR unit `fn dig c uchar to ulong` / `ret ulong sub c 48` compiles with omc `24caacf4…` (124 bytes of
907 IR) and is `omc: line 3: error 7` with `2aec185d…`; with omc `be8c5130…` the `ir` unit
908 `ir` / `fn dig c uchar to ulong` / `ret ulong sub c 48` / `end` compiles with exit 0 to output
909 byte-identical to `24caacf4…`'s (sha256 `40b76639…6cba`).
910- `new` lengths: C path 1..64 ([#L85](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L85)); `omc` 1..16777216
911 per array and at most 4 MiB of local arrays per function ([#L460-L463](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L460-L463), gate12; "per function" observed
912 2026-11-04 with omc `be8c5130…` and `2c824805…`: `examples/local_arrays_per_fn.om` and
913 `mistake_local_arrays.om`).
914- Unread names: the C path refuses a name that is written and never read ([#L37-L38](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L37-L38)).
915 `omc` fixtures contain unread results (`w = write ...` in `seed/rung4/tests/bytecopy.om`). Do not
916 rely on either behaviour; check every result you write.
917
918Language rule: `.om` is the only forward first-party implementation language. C, Rust and shell that
919remain are unfinished migration, not exemptions ([README.md#L50](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/README.md#L50)).
920- **Tokenization is not a language rule:** Language design optimizes for verified programs produced
921 per unit of inference cost (measured on held-out tasks by first-attempt correctness, successful
922 compilation, verified behavior, latency, and total compute cost). Fitting words into single tokens
923 under particular tokenizers (e.g. Qwen3) is an empirical measurement and cost consideration, not a
924 binding rule of Omega or Omegese. The compiler-guided interface remains portable across models and
925 tokenizers.
926
927## 1a. Compile and run (Linux AArch64 host only)
928
929```sh
930OMC=omega-src/seed/out/omc # after checking its sha256 against section 0
931"$OMC" < prog.om > prog 2> prog.err
932compile_rc=$?
933printf 'compile rc=%s\n' "$compile_rc"
934cat prog.err
935if [ "$compile_rc" -eq 0 ]; then
936 chmod +x prog
937 ./prog
938 run_rc=$?
939 printf 'run rc=%s\n' "$run_rc"
940fi
941```
942
943Only compile status 0 permits running the new output. Check the runtime status
944separately: a program may intentionally return nonzero (modulo 256), and a trap
945has its own status. Empty compiler stderr alone is not a successful compile.
946To rebuild the compiler from the seed instead, run `sh seed/omega-from-seed.sh` from the root of a
947disposable clone (prints `PASS ...` lines and `RC=0`). It writes `build/seed/`, rewrites the tracked
948`seed/rung4/om4.s` size word and `seed/rung4/om4.bin` (`seed/rung4/mk4.sh`), and rewrites
949`seed/out/omc` and `seed/out/omc.sha256` with whatever fixpoint it reached, so check `git status`
950and compare the new hash with the pin yourself ([omega-from-seed.sh#L52-L60](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/seed/omega-from-seed.sh#L52-L60)).
951Full host qualification is `sh seed/host/check.sh` (author-verified on 2026-10-23 per
952`seed/host/README.md`); a host pass is never hardware qualification.
953
954## 2. Program shape
955
956```
957note any text to the end of the line
958const LIMIT ulong 64
959global buf uchar 4096
960text msg "hello\n"
961struct Pair a uint b long end
962fn helper x ulong y ulong to ulong
963ret add x y
964end
965fn main to int
966ret 0
967end
968```
969
970- One statement per line; words separated by spaces or tabs; no commas, semicolons, braces or
971 indentation. `note` is the only comment form; the rest of its line is not read
972 ([omc.om#L4873](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/seed/omc/omc.om#L4873)).
973- `fn NAME (PARAM TYPE)* to TYPE|void` ... `end`. At most 6 parameters (error 9). `main` takes none.
974 In an OM-2 unit the limit is 6 parameter *slots*: an unsized array (`view T *`, `edit T *`) takes 2,
975 so a 7th slot is error 9 on the `fn` line (observed with omc `befb8199`, 2026-10-26, building
976 omega-mv `om/tls`). Pack small fixed inputs into one array. A scalar or a sized array
977 (`view uchar 8`) takes one slot: `fn f a view uchar * b view uchar * c ulong d ulong to ulong`
978 (6 slots) compiles, adding `e ulong` is `line 2: error 9`, and two `view uchar 8` plus three `ulong`
979 (5 slots) compiles in both OM-2 and OM-1. `part B OFF LEN` (OM-2) is an argument form only:
980 binding it to a local (`r = part b 0 4`) is error 9; pass `part` directly in the call (exit 4 for a
981 4-byte part). In an OM-1 unit the same call is `error 3` (unknown name). First probed on omc `2c82480596bb…`
982 (omega-mv `audit/tls-integration` 9472e9615); all rechecked 2026-10-31 with main omc
983 `62775d2a…712b` at omega-mv `4376c2112`.
984- A unit with `fn main` is a static AArch64 Linux ELF (program mode). Without `fn main` the output is
985 bare function words (function mode): it compiles with exit 0 but is **not runnable**. Host words
986 and `global` are error 9 there, and `text` is program-mode only ([#L400-L407](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L400-L407), [#L454-L459](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L454-L459), [#L629](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L629)).
987 **PENDING exception, draft [omega-mv#1008](https://github.com/aien-dev/omega-mv/pull/1008)** (`2992a68b`,
988 omc `c000ec02…b911`, not on main, 2026-11-04): an OM-2 function unit (first line `om2`, no `fn main`)
989 may use `fopen fclose fstat stat lstat getuid geteuid getgid getegid` on AArch64; every other host
990 word, any host word in an OM-1 unit and any other target stay error 9 (gate
991 `seed/omc/om2/fnhost/fnhost.cases`; PROPOSED contract `spec/omegese-om3.md` section 1). The
992 omega-bridge binds such a unit only with `tools/native --host` (omega-bridge#54, merged 2026-11-05
993 as `d1124611`; the bridge side is on main, the compiler side is not). With main's compilers (the
994 harness pin omc `b4f45121…` at omega-mv `d3d1b1bc`, and the previous `be8c5130…`) these are still
995 error 9.
996- Program exit status = `main`'s value mod 256 (0 for void main). `exit v` (v `int`) ends at once.
997 A runtime trap exits **100 + code**. Keep your own exit codes below 100, or a result is
998 indistinguishable from a trap ([#L404-L407](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L404-L407), [#L484](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L484)).
999- A value-returning function used as a statement is error 7; a bare host word used as a statement
1000 (`write 1 m 0 3` on its own line) is error 16 (observed 2026-10-26, omc `befb8199...a1d` at omega-mv
1001 `19f014f2`; rechecked 2026-10-31 with main omc `62775d2a…712b` at omega-mv `4376c2112`: bare
1002 `write` gives `omc: line 3: error 16`, a bare call of a value-returning `fn` gives error 7, and the
1003 bound form prints and exits 0). Bind the result either way: `w = write 1 buf 0 n`.
1004- A function with a return type whose `end` is reachable is error 18. `ret`, `break`, `continue`,
1005 `trap` and `exit` end the path; a line after them in the same block is error 17.
1006
1007## 3. Values: prefix words, fixed arity
1008
1009Every operator is a prefix word with a fixed number of values, so nesting needs no brackets:
1010`add mul r r 4` = (r*r)+4; `eq rem n 2 0` = (n mod 2)=0 ([#L73-L75](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L73-L75)).
1011Evaluation is innermost first, left to right ([#L137-L141](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L137-L141)).
1012
1013| Words | Takes | Result |
1014|---|---|---|
1015| `add sub mul div rem and or xor shl shr` | 2 | same type as operands |
1016| `eq ne lt le gt ge` | 2 | `bool` |
1017| `neg not` | 1 | negate / bool not or bitwise not |
1018| `TYPE v` | 1 | typed number (`uint 5`) or checked conversion (`ulong x`) |
1019| `bitcast TYPE v` | 2 | same-width reinterpretation (section 5) |
1020| `get A i`, `get S f`, `get S f i` | 2-3 | load from array / struct field |
1021| `len A` | 1 | array length, `ulong` |
1022| `sizeof T`, `offsetof S f` | 1-2 | compile-time `ulong` ([#L591-L599](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L591-L599)) |
1023| `FUNCTION args` | its parameter count | call |
1024| `( v )` | 1 | grouping only; adds no code ([#L583-L588](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L583-L588)) |
1025
1026There are no infix operators. `+ - * /` are not keywords (they are absent from the keyword table);
1027OMEGESE 9.9 ([#L564](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L564)) writes "`+ - * /`" but its own
1028float fixtures use `add sub mul div` (`seed/omc/tests/float/arith.om`). Write the words. Observed at
1029`e5b32567`: `y = x + 1` is error 5 (`examples/mistake_infix.om`).
1030
1031`and` / `or` evaluate **both** sides; there is no short circuit ([#L104](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L104)).
1032`and lt i len a eq get a i 0` still loads `a[i]` when `i` is out of range and traps 3. Test the
1033bound in an outer `if`, then load inside it.
1034
1035## 4. Types, literals, typing
1036
1037- Types: `bool uchar ushort uint ulong byte short int long` = bool, u8, u16, u32, u64, i8, i16, i32,
1038 i64; aliases `u8 .. u64`, `i8 .. i64`; floats `f32 f64` ([#L109-L111](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L109-L111), [#L549](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L549)).
1039 `uchar` is an 8-bit number, never a character ([#L442](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L442)).
1040- **No implicit conversions** (decision 20): both values of an op, a value and the name it is written
1041 to, an argument and its parameter must have the same type, else error 7
1042 ([#L440-L442](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L440-L442)). `add get b 0 uint 1` with `b` a
1043 `uchar` array is error 7; write `add uint get b 0 1`.
1044- A bare number takes the type of the other value in its op, or the type its place needs
1045 (`ret 0`, an argument, an index). Two bare numbers in one op, or a bare number with no context
1046 (`x = 5` for a new `x`), is error 11: write `x = uint 5` ([#L94-L100](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L94-L100), gate15 `e11_ambiguous`).
1047- Integer literals: decimal only, optional leading `-`, at most 20 digits, and the value must fit the
1048 type it takes (error 8), e.g. `long` -2^63..2^63-1, `ulong` 0..2^64-1. A non-digit (`12a`,
1049 `0x10`) is error 6 ([#L443-L446](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L443-L446)). In an OM-1 unit: no hex, no octal,
1050 no character literals: write byte 65, not `'A'` (error 3). OM-2 units (first non-`note` line `om2`)
1051 also take lowercase hex, `0xdeadbeef`, which must still fit its type (`int 0xffffffff` is error 8,
1052 `0X10` is error 6; observed at `e5b32567`; full rule in the next item). An `om2` unit with
1053 `x = uint 0x10` compiled and the program exited 16; the same line without `om2` is error 6 (omc
1054 `befb8199...a1d`, 2026-10-26; same results 2026-10-31 with main omc `62775d2a…712b` at omega-mv
1055 `4376c2112`; see also **Hex** in section 8).
1056 `true` / `false` are the bools.
1057- Hex literals, OM-2 units only (`om2` first non-note line; `spec/omegese-om2.md` section 2): `0x`
1058 then 1..16 lowercase digits `0-9a-f`, value unsigned, typed by the place under the decimal range rule
1059 (`int 0xffffffff` is error 8: no two's-complement reinterpretation). Error 6: `-0x..`, `0X`, no
1060 digits, 17+ digits, uppercase, `_`, any other character. `0x2a` and `42` compile to identical bytes;
1061 signed minima need decimal. An OM-1 unit, IR mode included, has no hex literal (error 6). Fixtures:
1062 `seed/omc/om2/hex/` (gate PR #951, merged by train r3 #979 as `4376c2112`). Rerun 2026-10-31 at
1063 main `91c83438d` with omc `2aec185d…`: `hex.cases` gives `OM2GATE PASS cases=51 pass=51`, and
1064 `mutants.cases` gives the expected `OM2GATE FAIL cases=8 pass=3 fail=5` (each `tok_hex` mutant killed).
1065- Shift with a bare left operand takes the shift amount's type: `shl 1 sh` with `sh` a `uchar` shifts
1066 a `uchar`. Write `shl ulong 1 sh` when you mean 64 bits ([#L97-L99](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L97-L99)).
1067- Float literals: `digits.digits[e[+|-]digits][f32|f64]`, a digit on both sides of the dot; exact
1068 decimal-to-binary rounding; overflow to infinity is error 8 ([#L555-L563](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L555-L563)).
1069 Two compiler defects in float literals are fixed at main `91c83438d` (#965, omc `2aec185d…`;
1070 source [`fparse`/`fexp`/`fbits`](https://github.com/aien-dev/omega-mv/blob/91c83438daec0bdb88bf5c077cae10f3d15d365d/seed/omc/omc.om#L1908-L1913)
1071 and [`fspan`](https://github.com/aien-dev/omega-mv/blob/91c83438daec0bdb88bf5c077cae10f3d15d365d/seed/omc/omc.om#L2252-L2255)).
1072 Observed 2026-10-31 on the AArch64 host, with omc `7a8b84fc…` (main before #965) as the control:
1073 - **Miscompile: float literal of 64 or more characters without an `f32`/`f64` suffix.** Such a
1074 literal is converted late, once its type is known, from a stored span `pos*64+len`; a length of
1075 64 or more spilled into the position, so the wrong input text was read (the `fspan` note above).
1076 `x = f64 2.0` / `y = add <61 zeros>1.5 x` / `ret int y` (a 64-character literal) exits 2 with
1077 `7a8b84fc` and 3 with `2aec185d`; 70 zeros: 2 and 3; 60 zeros (63 characters) and plain `1.5`:
1078 3 with both. The type word does not avoid it: `add f64 <70 zeros>1.5 x` and
1079 `x = f64 <70 zeros>1.5` / `add x f64 2.0` also gave 2 with `7a8b84fc` and 3 with `2aec185d`.
1080 The suffixed `add <70 zeros>1.5f64 x` gave 3 with both. A binary built by an older omc from
1081 such a literal computed with the wrong value; recompile it.
1082 - **Literals longer than about 1000000 characters.** The digit scans ran under the 1000000-pass
1083 loop guard, so the compiler itself trapped 4 (exit 104, no diagnostic) on such a literal. Now
1084 they compile: `x = f64 <1000001 zeros>3.5` / `ret int x` exits 3, `1.5e<1000001 zeros>1` gives
1085 15, `add f64 0.<1000001 zeros>1 f64 7.0` gives 7 (each compile 104 with `7a8b84fc`). The
1086 mantissa limit below still applies: `7.<1000001 zeros>1` is error 8 with both compilers.
1087- Named constants: `const NAME TYPE LITERAL` at top level, visible only after their definition, also
1088 usable as array lengths, `trap` codes and `while` bounds ([#L602-L622](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L602-L622)).
1089
1090## 5. Arithmetic, conversions and traps
1091
1092From OMEGESE 9.3 ([#L429-L447](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L429-L447)), gate fixtures in
1093`seed/rung4/tests/t_*.om` with expected statuses in the matching `.want` files:
1094
1095| Behaviour | Result | Fixture |
1096|---|---|---|
1097| Unsigned `add sub mul shl neg not` | wrap mod 2^width | gate 3 |
1098| Signed `add sub mul neg div shl` out of range (incl. MIN div -1) | trap 1, exit 101 | `t_ovf.om` -> 101 |
1099| `div` / `rem` by zero | trap 2, exit 102 | `t_div0.om` -> 102 |
1100| Array index or I/O slice out of bounds (also a negative signed index) | trap 3, exit 103 | `t_bounds.om`, `t_rw.om`, `t_write_wrap.om` -> 103 |
1101| Loop past its bound | trap 4, exit 104 | `t_loop.om` -> 104 |
1102| Conversion whose value does not fit the new type | trap 5, exit 105 | `t_conv.om`, `t_conv_sign.om` -> 105 |
1103| Call or local array below the 8 MiB stack | trap 6, exit 106 | `t_stack.om` -> 106 |
1104| Shift amount outside 0..width-1 (every type) | trap 7, exit 107 | gate 4 s.5 |
1105| `trap N`, N 1..14 | exit 100+N | `seed/omc/tests/loop/t1.om` -> 105 |
1106
1107Signed `div` rounds toward zero; signed `rem` has the dividend's sign; signed `shr` keeps the sign.
1108Comparisons follow the operand type: with `ulong` x = 2^64-1 and y = 1, `lt x y` is false
1109(`t_cmp_unsigned.om` -> 0).
1110Floats never trap: IEEE results, NaN compares false except `ne` ([#L564-L567](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L564-L567)).
1111
1112Conversions are **checked**, not truncating. `uchar x` with x = 300 traps 5. Mask first:
1113`uchar and x 255` (see `examples/trap_narrow.om`). `long x` with x = 2^63 as `ulong` traps 5.
1114
1115`bitcast T v` reinterprets bits of the same width; `bool` and different widths are error 7, a bare
1116number is error 11 ([omc.om#L4640-L4662](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/seed/omc/omc.om#L4640-L4662)). Every fixture
1117uses it between floats and unsigned integers. The code also accepts integer-to-integer of equal
1118width. At omc `2c824805` results across signedness below 64 bits were wrong (section 0). At omc
1119`62775d2a` the two measured 32-bit pairs are correct; narrower pairs and `f32` to `int` were not
1120retested. Do not bitcast an unmeasured pair; decode signed values arithmetically (section 10).
1121
1122Float to integer conversion is the exception to "checked": it truncates toward zero and saturates at
1123the target's limits, and a NaN gives 0, with no trap (observed at `e5b32567`,
1124`examples/float_to_int.om`).
1125
1126## 6. Names, scope, registers
1127
1128- Function names: up to 63 characters. Every other name (variable, parameter, global, text, const,
1129 struct, field): **at most 8 characters**, else error 13 ([#L423](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L423), gate15 `e13_long_variable`).
1130 Rechecked 2026-11-04 (Linux AArch64): `counter_a = int 20` is `omc: line 2: error 13` with both the
1131 harness pin omc `be8c5130…` (omega-mv `9920aab1`) and omega-mv main `d3d1b1bc`'s omc `b4f45121…`.
1132- PENDING, not merged or pinned: draft [omega-mv #837](https://github.com/aien-dev/omega-mv/pull/837)
1133 (head `f1b9ecb5d13f3b7303c055a187fff06e802eb952`, base `integ/omc-batch3`, source-only: its committed
1134 `seed/out/omc` is still the old `2c824805…`) raises every such name to 63 bytes, compared in full.
1135 Rebuilt from that head with `sh seed/omega-from-seed.sh` on 2026-10-30 (`RC=0`, `PASS omc fixpoint
1136 21d34e12eb6516a2c5f3fc160ccb0feca5054786c57def055056c04270c302fa`); with that compiler
1137 `counter_a = int 20`, `counter_b = int 1`, `ret add counter_a counter_b` ran with exit 21, a 63-byte
1138 local compiled and ran, a 64-byte local is error 13, and an IR-mode parameter `counter_a` is still
1139 error 13. IR-mode locals and parameters, `abstract`/`layout` names and layout fields stay at 8, and so
1140 does om4. Until #837 lands and is pinned, keep names at 8.
1141- A new name may not equal a visible name, a function or a struct (error 10). A name first written
1142 inside `if` / `else` / `while` / `for` dies at its `end`; assign it before the block to carry it out.
1143- **Declaration order.** Only functions may be named before their line. A `text`, `const` or
1144 `global` named in a function above its own declaration line is error 3 at the use, so put them all
1145 above the first `fn` (`examples/decl_order.om` exit 8, `mistake_decl_order.om` error 3; observed
1146 2026-11-04 with omc `be8c5130…` and `2c824805…`, host only).
1147- A `global` is visible only to lines after its declaration: a function above it that reads it is
1148 **error 3** (unknown name). `global` needs program mode, so the unit must have `fn main` (without
1149 it `global` is error 9). Checked 2026-11-04 on omc `2c824805…` via the omega MCP: `fn f to ulong`
1150 / `ret get g 0` / `end` / `global g ulong 4` / `fn main to int` / `ret int f` / `end` gives
1151 `omc: line 2: error 3`; the same seven lines with the `global` line first compile and exit 0;
1152 the first four lines with the `global` first and no `fn main` give error 9 (`omc: line 5: error
1153 9` with a trailing newline). In multi-file units (`build.sh` concatenation) the file that
1154 declares a global must come before every file that uses it.
1155- Reserved words cannot be names. Besides the obvious ones, the table reserves `len read write text
1156 new free own view edit global note exit const bound` and every host word, including `stat link bind
1157 send recv random fork cwd chdir umask accept listen connect waitio memfd mapget mapset`. `bits min
1158 max abs sqrt` are deliberately **not** reserved (gate11), and they are not operators either: `ret
1159 min a b`, `max`, `abs` and `mod` are all error 3 (unknown name) with omc `be8c5130…`. Remainder is
1160 `rem` (`ret rem a b` with ints a=7, b=3 exits 1). Check the keyword table, not memory.
1161 A reserved word used as a name is **error 16** (unknown word), not error 10, so the message does
1162 not say "reserved". Observed on omc `2c824805…` (omega-mv `e5b32567`), host only: `fn f len ulong
1163 to ulong` gives `omc: line 1: error 16`, and a local `len = ulong 3` gives `omc: line 2: error 16`.
1164 The same program with the parameter renamed to `n` compiles (exit 0). Use `n`, `cnt` or `size`.
1165- **`dit` and `scrub`: merged in [omega-mv#875](https://github.com/aien-dev/omega-mv/pull/875) as
1166 `2367874399001efdc7f1ff345fb327469bc1a135` (2026-10-31), committed omc sha256
1167 `3862655902e3bb9f502ebca2e1e5e5edb6175bf512be731a63c700a6dce8d355`; included in the current pin
1168 `d3d1b1bc` (omc `b4f45121…`), in `9920aab1` (omc `be8c5130…`) and in `3a163bc5` (omc `24caacf4…`).** Keyword ids: `dit` 225, `scrub` 226 in `fn kw2`, the OM-2 table
1169 ([omc.om#L1329](https://github.com/aien-dev/omega-mv/blob/2367874399001efdc7f1ff345fb327469bc1a135/seed/omc/omc.om#L1329),
1170 [#L1384-L1388](https://github.com/aien-dev/omega-mv/blob/2367874399001efdc7f1ff345fb327469bc1a135/seed/omc/omc.om#L1384-L1388)).
1171 Both are emitted inline, not as helper functions, because om4 holds 512 functions and `omc.om` is at
1172 that limit ([#L7525-L7526](https://github.com/aien-dev/omega-mv/blob/2367874399001efdc7f1ff345fb327469bc1a135/seed/omc/omc.om#L7525-L7526));
1173 the merge commit has 512 `^fn ` lines. Two OM-2-only, program-mode-only, AArch64-only value
1174 words, reserved only in `om2` units. `dit v` (v int 0/1, else trap 3) writes PSTATE.DIT and gives the
1175 previous bit as a long. `scrub n` (n ulong, a multiple of 16, at most 1048576, else trap 3; trap 6 when
1176 SP - n is below the stack floor) zeroes `[SP - n, SP)`, the dead general registers (free pool
1177 registers, X16, X7, X18-X26, X29), V0-V15 and every dead float twin V16+j (since #994; up to
1178 `3a163bc5` all of V0-V31), and gives 0. Refusals: function mode error 9, a wrong
1179 operand type error 7, use as a name or as a bare statement (`scrub 16` on its own line) in an `om2`
1180 unit error 16, `target x86linux` error 25; `ir` with `om2` is already error 16. Observed with omc
1181 `38626559…` on 2026-10-31 (host only), each fixture of `seed/omc/om2/s5/` at `23678743` run directly:
1182 `dit-ok` exit 0, `dit-two`/`dit-neg`/`scrub-odd`/`scrub-big` trap 3 (exit 103), `scrub-floor` exit
1183 106, `scrub-ctl` exit 10 (its negative control), `scrub-mem`/`scrub-live`/`scrub-emit`/`om1-names`
1184 exit 0, the refusal fixtures 9/7/16 as above, `scrub-emit` output sha256 `5ba83eaf…` as in
1185 `s5.cases`, and `dit-ok` behind `target x86linux` error 25. The previous pin omc `2aec185d…` does not know
1186 the words: every fixture that uses them is error 3, while `dit-name`/`scrub-name` (the words as
1187 names) compile as in OM-1, and `scrub-ctl`/`om1-names` behave as with `38626559…`.
1188 Rerun 2026-10-31 with the then pinned omc `24caacf4…` (host only): every `s5` fixture gives the same exit
1189 as with `38626559…` above, `scrub-emit` output sha256 `5ba83eaf…` again, and `dit-ok` behind
1190 `target x86linux` is `omc: line 6: error 25`; the pin before it, `2aec185d…`, still gives error 3 for
1191 the fixtures that use the words.
1192 **Fixed by [omega-mv#994](https://github.com/aien-dev/omega-mv/pull/994) (`9920aab1`): `scrub`
1193 keeps live floats.** Up to `3a163bc5` (omc `24caacf4…`) the emitter zeroed all of V0-V31 although
1194 #853 keeps f32/f64 locals and held float values in the twin V16+j of their pool slot. Since #994 it
1195 emits `MOVI #0` only for V0-V15 and the dead twins, sparing the twin of each live slot whose value
1196 lives there; nothing is saved or restored
1197 ([omc.om#L7830-L7842](https://github.com/aien-dev/omega-mv/blob/9920aab1413983c2867d02d75b2276341595adb8/seed/omc/omc.om#L7830-L7842),
1198 [#L7873-L7884](https://github.com/aien-dev/omega-mv/blob/9920aab1413983c2867d02d75b2276341595adb8/seed/omc/omc.om#L7873-L7884);
1199 OMEGESE 9.13.1). Observed 2026-10-31, Linux AArch64 host: the unit `om2` / `fn main to int` /
1200 `f = f64 1.5` / `g = f64 2.5` / `k = scrub 16` / `h = add f g` / `if ne h f64 4.0` / `ret 50` /
1201 `end` / `ret int k` / `end` compiles with exit 0 under both compilers and exits 50 with omc
1202 `24caacf4…` (the defect) and 0 with omc `be8c5130…`; with `f64 4.5` in the comparison (negative
1203 control) the `be8c5130` build exits 50. At `9920aab1`, with omc `be8c5130…` run directly on each
1204 `seed/omc/om2/s5/` fixture: `dit-ok`/`om1-names`/`scrub-mem`/`scrub-live`/`scrub-emit`/
1205 `scrub-flive`/`scrub-femit` exit 0, `dit-two`/`dit-neg`/`scrub-odd`/`scrub-big` exit 103,
1206 `scrub-floor` exit 106, `scrub-ctl` exit 10, `dit-fm`/`scrub-fm` error 9, `dit-type`/`scrub-type`
1207 error 7, `dit-name`/`scrub-name` error 16, and `dit-ok` behind `target x86linux` is
1208 `omc: line 6: error 25`. The `scrub-emit` output sha256 is
1209 `5ba83eaff95e73bdca1584d1d8bcfd083b18af549c7da2777f7a5c03005a04cc` (unchanged: no live float
1210 there) and the new `scrub-femit` output is
1211 `3d33c8ebfeff422d2ad746952f32fedab01cc46238097bb64b4b9a0a068c20c8` (with `24caacf4` it is
1212 `c01cd0c5…7b76`, and `scrub-flive`/`scrub-femit` exit 1). `OM2GATE` on `s5.cases` printed
1213 `OM2GATE PASS cases=21 pass=21 fail=0 invalid=0 not_run=0`; on `s5-mutants.cases` all 7 `ctl-*`
1214 cases passed and all 9 `m-*` mutants (including `m-twinall` and `m-twinnone`) were detected
1215 (`OM2GATE FAIL cases=16 pass=7 fail=9`, the expected verdict).
1216- **16 registers per function** (pool x0-x6, x8-x15, x17; [omc.om#L82-L91](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/seed/omc/omc.om#L82-L91)).
1217 Parameters, every live name, the hidden counter of each open `while` / value-count `for`, and the
1218 temporaries of the current statement all draw from it; error 12 when the next one is not available
1219 ([omc.om#L1479-L1487](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/seed/omc/omc.om#L1479-L1487)). gate15 pins the 17th live name as
1220 error 12. In practice keep functions to about 10 live names and split deep nested expressions or
1221 helpers into smaller functions. A name first written inside a block gives its register back at the
1222 block's `end`: 10 names, 5 more inside `if true` ... `end`, then 5 after it compile
1223 (`examples/block_frees_registers.om`, exit 15), and the same 20 names without the block are error
1224 12 on the 17th. One name is enough to exhaust the pool through nesting: `ret add a add a ...` with
1225 16 `add`s compiles, 17 is error 12 (`mistake_deep_nest.om`); bind partial results on separate lines.
1226
1227## 7. Arrays, globals, structs
1228
1229From OMEGESE 9.4 and 9.7 ([#L449-L474](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L449-L474), [#L494-L516](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L494-L516)):
1230
1231- `global NAME T N`: zero-filled pool in the program image, N 1..16777216, at most 1 GiB of pools
1232 total (error 23), program mode only. Globals are visible in every function.
1233- **A global is never passed as an argument** (error 19). A function works on a global by naming it
1234 directly; parameters carry scalars and local arrays only. Two `part`s of one array, or an array and
1235 a part of it, in one call are also error 19 (omc `befb8199`). The arrays of one call must be distinct
1236 names (error 19).
1237- `NAME = new T N v`: local stack array, N elements each v, only in a function's outermost block
1238 (error 9 inside a block), at most 4 MiB of local arrays per function (error 23; another function's
1239 arrays do not count, see `local_arrays_per_fn.om`). **N must be a literal or an
1240 integer `const`**; a variable length is error 16 (gate16 `len_varname`), so there are no
1241 run-time-sized arrays. No heap and no `free` (decision 24; `free` is error 9).
1242- Array parameters state type and length exactly: `a view uchar 64` / `a edit uchar 64` (error 7 for
1243 any other length), so OM-1 has no length-generic array parameters; use fixed sizes, an integer
1244 `const`, or a global. OM-2 (`om2` first line) adds unsized views, `a view T *`: one function took
1245 arrays of 5 and 9 bytes and `len a` returned each length (exit 14; omc `befb8199...a1d`, 2026-10-26;
1246 also `examples/om2-tour.om` at omega-mv `19f014f2`; rechecked 2026-10-31 with main omc
1247 `62775d2a…712b` at omega-mv `4376c2112`: exit 14, and the OM-1 form is `line 1: error 16`). A view
1248 or a `text` is read-only (error 20 on `put`, `read` or `pread` into it; see section 9).
1249- `get A i`, `put A i v`, `len A`. A constant index outside the array is error 21; any other index is
1250 checked at run time (trap 3). No word yields an address or adds to one.
1251- `text NAME "bytes"`: read-only `uchar` array; escapes only `\n \t \\ \"` (error 22 otherwise).
1252 There is no `\r`: protocols that need CR LF (HTTP, SMTP) write the CR at run time
1253 (omega-mv `om/tls/test/tls/client.om` `cl_crlf`).
1254- Structs: fields are 8-byte cells, no padding, no packed layouts (a `uint` field still takes 8
1255 bytes). `read`/`write`/`len` of a struct are error 7. Never treat a struct as a wire layout.
1256
1257## 8. Loops and bounds
1258
1259From OMEGESE section 3 and 4 ([#L58-L60](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L58-L60), [#L131-L135](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L131-L135)) and [omc.om#L5493-L5494](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/seed/omc/omc.om#L5493-L5494);
1260the bound ranges below are those of the pin `3a163bc5`, and the cited lines are unchanged at the pin `9920aab1` (the `omc.om` ones moved down 10 lines) (OMEGESE [#L63-L69](https://github.com/aien-dev/omega-mv/blob/3a163bc5eafa5be4b9ca97b7f17046c33f0d9032/docs/one_layer/OMEGESE.md#L63-L69),
1261[#L140-L149](https://github.com/aien-dev/omega-mv/blob/3a163bc5eafa5be4b9ca97b7f17046c33f0d9032/docs/one_layer/OMEGESE.md#L140-L149);
1262`s_while` [omc.om#L8853-L8854](https://github.com/aien-dev/omega-mv/blob/3a163bc5eafa5be4b9ca97b7f17046c33f0d9032/seed/omc/omc.om#L8853-L8854),
1263`sf_num` [#L8912-L8915](https://github.com/aien-dev/omega-mv/blob/3a163bc5eafa5be4b9ca97b7f17046c33f0d9032/seed/omc/omc.om#L8912-L8915),
1264`ir_bound` [#L13162-L13163](https://github.com/aien-dev/omega-mv/blob/3a163bc5eafa5be4b9ca97b7f17046c33f0d9032/seed/omc/omc.om#L13162-L13163)):
1265
1266- `while COND bound N`: at most N body passes, N 1..9223372036854775807 (2^63-1), a number or an
1267 integer const; 0 and 9223372036854775808 are error 8 on the loop's line. Without `bound` the limit
1268 is 1000000 passes. One more pass traps 4. The condition is recomputed before every pass. Merged as
1269 omega-mv #848 (`157bab57`); before it (pins up to `91c83438`, omc `2aec185d`) the range was
1270 1..999999 and `bound 1000000` was error 8.
1271- `for i T K` runs i = 0..K-1. A literal K needs no hidden guard; a name or expression K gets the
1272 1000000-pass guard. `for i T K bound N` (omega-mv #857, `3a163bc5`) takes the same N as `while`;
1273 with a bound every count, literal or not, traps 4 after N passes. Before #857 `for` took no `bound`
1274 word (error 5).
1275- IR mode (`ir` first line) keeps the C oracle's ranges so that checker2 proves every guard: `bound N`
1276 on `while` or `for` is 1..1000000, and a number or integer-const `for` count is 0..1000000; outside
1277 them (a minus sign included) is error 8 on the loop's line. An IR `for` with a value count (a name)
1278 now carries the hidden 1000000-pass guard; before #857 it was emitted unguarded and checker2
1279 rejected it (C2-LOOP-UNBOUNDED).
1280- Observed 2026-10-31, Linux AArch64 host, omc `24caacf4…abb7` (negative control: the previous pin
1281 omc `2aec185d…d8d5`): `while lt i 1500000 bound 2000000` exits 83 = 1500000 mod 89 (old: error 8);
1282 `bound 9223372036854775807` and `bound 1000000` compile and run (old: error 8); `bound 0` and
1283 `bound 9223372036854775808` are `omc: line 3: error 8` on both; `const BIG ulong 5000000` as the
1284 bound runs 1100000 passes (exit 49 = 1100000 mod 89; old: error 8); `bound 5` with 10 passes wanted
1285 and 1000001 passes with no bound both exit 104 (trap 4) on both. `for i ulong 1234567 bound 1300000`
1286 exits 48 = 1234567 mod 89 (old: error 5); `for i ulong 11 bound 10` and the same with `k = ulong 11`
1287 as the count exit 104 (old: error 5); `for ... bound 0` and `bound 9223372036854775808` are error 8
1288 (old: error 5); `for i ulong 2000000` without a bound still runs unguarded (exit 81 = 2000000 mod
1289 89). IR mode: `while ... bound 1000000` compiles (old: error 8), `bound 1000001` is error 8 on both;
1290 `for i ulong 1000000` compiles, `for i ulong 1000001` is error 8 (old: compiled); `for i ulong 3
1291 bound 10` compiles and `bound 1000001` is error 8 (old: error 5 for both); `for i ulong k` with
1292 `k = ulong 3` grows from 162 to 225 bytes of IR (the guard). Wolfram:
1293 `{Mod[1500000,89], Mod[1100000,89], Mod[1234567,89], Mod[2000000,89]}` -> `{83, 49, 48, 81}`.
1294- `break` and `continue` (`omc` only, gate7); `continue` in a `while` re-runs the condition and bound.
1295- Choose N from a proof, not a guess. Example: a read loop where every pass adds at least one byte to
1296 a 65536-byte buffer needs at most 65536 passes. Write that reasoning in a `note`.
1297- No loop runs forever and recursion is bounded by the 8 MiB stack. A long-running service needs an
1298 explicit epoch/restart design, not a bigger bound.
1299
1300### Compiler limits checked at main `bf54b19fa` (2026-10-29; rechecked at `91c83438d` on 2026-10-31)
1301
1302Checked with main's `seed/out/omc` (sha256 `62775d2a391cfef7cde64e387655caa9809a267093112910ec76bfa568f3712b`)
1303and `seed/rung4/om4.bin` (`d0da40e4…19efab`) on the Linux AArch64 host; facts 2, 3, 5 and 6 were also
1304reproduced with the omega MCP `run` tool (pin `e5b32567`, compiler `2c824805…029f`). Host evidence only.
1305The first six facts (value slots through x86 target) were rerun on 2026-10-31 with main
1306`91c83438d`'s omc `2aec185d…d8d5` and with the previous main omc `7a8b84fc…` (#970): the same exit
1307codes and diagnostics with both. The om4 cap was rechecked as stated in its entry; the 4096 cap on
1308user programs was not rerun. Float literals longer than about 1000000 characters are a separate,
1309fixed limit (section 4).
1310
1311- **Value slots.** `fn alloc` ([omc.om#L2848-L2855](https://github.com/aien-dev/omega-mv/blob/bf54b19fa590e8ae925c0e80815516dbf41e7326/seed/omc/omc.om#L2848-L2855))
1312 fails error 12 when `npar + nslot >= 16`. There is no spilling: split the function. Fifteen
1313 `aN = int N` names summed in one nested `add` chain already give `omc: line 17: error 12`.
1314- **Loop guard.** `for i ulong k` with a name `k = ulong 1000001` compiles and exits 104 (trap 4,
1315 LOOP_BOUND); `k = ulong 1000000` exits 0. A literal count is unguarded: `for i ulong 2000000` exits 0.
1316- **Float literal mantissa.** The digits of a float literal, read without the dot, must fit in
1317 2^63-1 = 9223372036854775807 (Wolfram `2^63-1`). `922337203685477580.7f64` compiles;
1318 `92233720368547758.08f64` and `9223372036854775807.0f64` are error 8.
1319- **Forward calls** are allowed: `main` calling `f` defined after it compiles and exits 7.
1320 **Globals and texts are not:** a `global` or `text` named in a function before its definition line
1321 is `error 3`. Rechecked 2026-11-06 with the omega MCP pin omc `2c824805…029f` (`e5b32567`, not the section 0 compiler): `fn f` that
1322 does `put g 0 uchar 7`, then `global g uchar 1`, gives `omc: line 2: error 3`; the same unit with the
1323 `global` first compiles and exits 7; a `text` written after its first `write` use is also
1324 `omc: line 2: error 3`; moving the text first compiles, prints `x` and exits 0. When a unit is built by concatenating files (a library such as CUDApp
1325 `native/nvrm/context.om`, then the code that uses it), each file's globals and texts must sit
1326 above their first use in the concatenated order; functions may come in any order.
1327- **Hex.** OM-1 rejects `0x10` with error 6; under `om2` the same unit compiles and exits 16.
1328- **x86 target.** A first line exactly `target x86linux` emits an x86-64 ELF; with a leading space it
1329 is error 16.
1330- **om4 function cap: 512 functions in `omc.om` itself (contributors to the compiler).** Measured at
1331 main `57a4135d6` on 2026-10-31: `omc.om` has 495 `^fn ` lines (16,432 lines, sha256 `d4b4b89d…30f6`,
1332 the same file as at `9920aab14`) and `om4.bin` is still `d0da40e4…19efab`. `omc.om` plus 17 appended
1333 `fn zqN to ulong` / `ret 0` / `end` functions compiled with exit 0; plus 18 gave
1334 `om4: line 16484: error 14`, exit 14. So 17 entries were free then; at the current pin
1335 `d3d1b1bc` `omc.om` has 510 `^fn ` lines, so 2 are free (section 0). **Decision (Drake, 2026-10-31): stay
1336 within 512 for now (option 3).** A prototype that moves om4's table to 4096 entries is draft
1337 [omega-mv#1013](https://github.com/aien-dev/omega-mv/pull/1013) (`646ed1ec`, om4 `bfc1cfd1…`, omc
1338 bytes unchanged), **parked until after alpha**: do not merge it unless `omc.om` needs more than 512
1339 functions or an alpha-critical fix needs more than the free entries. If it merges, the published
1340 challenge pin moves in the same release as a new version (v1 = om4 `d0da40e4` at `369dbc96` stays
1341 checkable), `seed/challenge/run.sh` builds the new pin, and never while an outside recheck
1342 (DRA-58) is running. Its cubic cycle check is omega-mv#1014. Until it merges, the 512 cap below holds. Earlier
1343 checks: main `62d1d0d66` (2026-10-30), `4376c2112` and `91c83438d` (2026-10-31), when `omc.om` had
1344 512 functions and one more gave `om4: line 15953: error 14`. om4 is the seed rung that compiles `seed/omc/omc.om` into the first
1345 `omc` (`seed/omega-from-seed.sh`
1346 [#L43-L46](https://github.com/aien-dev/omega-mv/blob/62d1d0d668f897386a0e311374f8dbcc5c32dde8/seed/omega-from-seed.sh#L43-L46)).
1347 Its function table is 128-byte entries at `0x1840000`
1348 ([om4.s#L45](https://github.com/aien-dev/omega-mv/blob/62d1d0d668f897386a0e311374f8dbcc5c32dde8/seed/rung4/om4.s#L45)),
1349 and a new function is refused with `E_FULL` (error 14) once 512 are recorded
1350 ([om4.s#L768-L769](https://github.com/aien-dev/omega-mv/blob/62d1d0d668f897386a0e311374f8dbcc5c32dde8/seed/rung4/om4.s#L768-L769),
1351 `cmp.x.i x10 512` / `b.hs E_FULL`; [#L3073-L3075](https://github.com/aien-dev/omega-mv/blob/62d1d0d668f897386a0e311374f8dbcc5c32dde8/seed/rung4/om4.s#L3073-L3075)).
1352 512 entries x 128 bytes fill exactly `0x1840000..0x1850000`, where the state slots begin
1353 (Wolfram `IntegerString[16^^1840000 + 512*128, 16]` -> `1850000`). At `62d1d0d66` main's `omc.om` had exactly 512
1354 `^fn ` lines (`main` included), so it was full. Observed there (dated): om4 compiled that `omc.om` with exit 0;
1355 the same file plus one three-line function gave `om4: line 15625: error 14`, exit 14, and the seed
1356 chain stops there. Any omc change that adds a function must fold or remove another one (#875 inlines
1357 `dit`/`scrub` for this reason; its `omc.om` note is at L7525-L7526 in the merge commit `23678743`,
1358 which still has exactly 512 `^fn ` lines). On 2026-10-30
1359 a clean `git merge-tree` of main with draft
1360 [#817](https://github.com/aien-dev/omega-mv/pull/817) (head `d0d794d0`) has 532 functions and with
1361 draft [#832](https://github.com/aien-dev/omega-mv/pull/832) (head `707faca6`) 526, so both are
1362 blocked until 20 and 14 functions are folded (Wolfram `{532-512, 526-512}` -> `{20, 14}`) or the cap
1363 is raised. Raising the om4 cap changes a seed rung and is Drake's decision, not a contributor's.
1364 Check before every compiler PR: `grep -c '^fn ' seed/omc/omc.om` must print at most 512. To
1365 measure the headroom, append k three-line functions (`fn zqN to ulong`, `ret 0`, `end`, N unique;
1366 never `fN`, because `f32`/`f64` are type words) and run `seed/rung4/om4.bin < omc.om > /dev/null`.
1367- **Do not confuse it with omc's cap on user programs.** The compiled `omc` holds 4096 functions per
1368 program ([omc.om#L116-L118](https://github.com/aien-dev/omega-mv/blob/62d1d0d668f897386a0e311374f8dbcc5c32dde8/seed/omc/omc.om#L116-L118),
1369 refusal [#L7809-L7810](https://github.com/aien-dev/omega-mv/blob/62d1d0d668f897386a0e311374f8dbcc5c32dde8/seed/omc/omc.om#L7809-L7810);
1370 gated by `seed/omc/gate12.sh`, 4095 helpers plus `main` accepted, 4096 plus `main` error 14). The
1371 "1024 functions" in omega-harness issue #9 described omc on branch `feat/allen-imac-competition`
1372 (`7eca2ac3f`, 2026-10-25), not om4 and not current main.
1373- **IR-mode capacity and nested call arguments: PENDING, not on omega-mv main**
1374 ([omega-mv#889](https://github.com/aien-dev/omega-mv/pull/889), draft, rechecked 2026-10-30 at head
1375 `916a082a90e09de4df04cbeb57dadc84939954ec`, committed omc sha256
1376 `34768ee8f2779347c0cfa49a1b8a82b8d110b14123a7693774d4e1e435c944c6`; harness issue #142). Per that PR's
1377 OMEGESE diff and gate comment (author-stated, not observed here), main's omc stops an IR-mode (`ir`)
1378 function at 64 registers, 32 literals, 32 blocks and 256 instructions (error 14), and miscompiles a call
1379 nested in a later argument of another call: for `ret add2 uint 30 add2 uint 4 uint 5` it passes 4, not
1380 30, as `add2`'s first argument. #889 raises the
1381 limits to the OSC IR v1 format's own (480 registers, each distinct literal taking one; 512 blocks; 4096
1382 instructions; 480 names in scope; 64 open blocks; error 14 beyond) and keeps the earlier arguments.
1383 Observed with that omc (host only): its `seed/omc/gate-ir.sh` exited 0, with `call_nested_arg` and
1384 `capacity_100_literals` (100 distinct literals, 40 `if` blocks) byte-identical to the C oracle and
1385 accepted by checker2, and `capacity_481_literals` error 14. Main's omc `62775d2a…` gives
1386 `omc: line 36: error 14` for the 100-literal unit and, for `call_nested_arg`, IR bytes that differ from
1387 the oracle (sha256 prefix `47d5c7b0` against `09f9f859`). Until #889 merges, keep IR-mode functions
1388 under the old limits and bind a nested call's result to a name before passing it.
1389
1390## 9. Host I/O: counts, errors, evidence
1391
1392Base words ([#L476-L486](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L476-L486)): `read fd A off n`,
1393`write fd A off n`, `pread`/`pwrite fd A off n pos`. Native host words ([#L624-L747](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L624-L747)):
1394files, directories, clocks, sockets, poll, processes, arguments, environment, random.
1395
1396**cpufence / cpurelax: merged in [omega-mv#946](https://github.com/aien-dev/omega-mv/pull/946) as `d94617177`; in the current pin `d3d1b1bc` / omc `b4f45121` (since `91c83438`).**
1397Rechecked 2026-10-31 at omega-mv main `91c83438daec0bdb88bf5c077cae10f3d15d365d` (omc sha256
1398`2aec185d4ed6d7a6a5779ed656b4e56904742bde5551b02893fb5f73916ad8d5`).
1399These are operand-free statements. `cpufence` (keyword 199) is a full host CPU barrier, AArch64 `DSB SY`
1400and x86-64 `MFENCE`. `cpurelax` (200) is a spin-wait hint with no ordering, `YIELD` and `PAUSE`.
1401Unlike every other host word they compile in function mode too. An operand gives error 5, use as a
1402value or at top level gives error 16, use as a name gives error 5, after `ret` gives error 17, and IR
1403mode gives error 16. `seed/host/cpufence.sh` proves this: a fixture that exits 42 natively and under
1404qemu-x86_64, objdump instruction deltas, and a nop-fence mutant that is caught. These are host results
1405only. An omc older than `d94617177` (its parent's omc is `62775d2a…`) does not know either word: the
1406fixture fails with error 4 (a bare `cpufence` line read as a name waiting for `=`) and `cpurelax 1` is
1407error 11, so check the pin before writing them.
1408**Keyword ids:** #946 landed with ids 199/200. Draft [omega-mv#878](https://github.com/aien-dev/omega-mv/pull/878)
1409(`vfioctl`/`vfiomap`, with #890 stacked on it) is still open, PENDING, and must take ids that do not
1410collide; recheck `fn kw` in `seed/omc/omc.om` at the pin before quoting any id.
1411
1412**pread/pwrite writability (landed via [omega-mv#904](https://github.com/aien-dev/omega-mv/pull/904), `e2662fff`).**
1413At omega-mv main `bf54b19f` (omc sha256 `62775d2a391cfef7cde64e387655caa9809a267093112910ec76bfa568f3712b`),
1414`pwrite` only reads its array, so it accepts a `text` or a `view`; `pread` writes its array, so
1415`pread` into a `text` or an unsized `view` is error 20, as for `read`. Observed 2026-10-30 on the
1416AArch64 host with main `seed/out/omc` (`omc < file`): `seed/omc/om2/s4/v-bad-pread-text.om` gives
1417`omc: line 5: error 20` (rc 20); `seed/omc/om2/s4/v-pwrite-text.om` compiles (rc 0) and runs with
1418exit 0, writing `ABC\n` to stdout. Host evidence only.
1419
1420Historical note: up to omc `2c824805…` (omega-mv `e5b32567`, the omega MCP pin before omega-mcp #6) the check sat on
1421the wrong word: `pwrite` from a `text` was error 20 and `pread` into a `text` compiled and returned
1422`-EFAULT` at run time. Code written for that pin copied a text into a `new` array before `pwrite`.
1423
1424**x86efi firmware boundary word `efi`, OP 11 boot-file word (in the pin: omega-mv `d3d1b1bc` / omc `b4f45121…`, merged via [omega-mv#1015](https://github.com/aien-dev/omega-mv/pull/1015); the previous pin `9920aab1` / omc `be8c5130…` refuses `target x86efi` with error 25).**
1425Read [omega-mv `docs/X86-EFI.md`](https://github.com/aien-dev/omega-mv/blob/main/docs/X86-EFI.md) for the full word. Under `target x86efi` it is `r = efi OP ARG A OFF N`:
1426OP a literal 0..13 (14 is error 25), `ulong` result, bit 63 set means an error with its code in
1427the low bits. OPs 0..10: info, key, stall, gop blt, time, rng, recv, tx, net up, pointer, clock;
142812 general file, 13 console. OP 11 is the boot-file word of the firmware Allen's self-install
1429contract (first proposed in draft [omega-mv#981](https://github.com/aien-dev/omega-mv/pull/981)):
1430`ARG` bits 0..7 = sub-op, bits 8..15 = volume index k. Sub 0 counts the Simple-File-System volumes
1431and finds the one this image was loaded from, result `count | index << 8`. Sub 1 reads
1432`\EFI\BOOT\BOOTX64.EFI` from volume k into `A[OFF..OFF+N)` and returns the byte count. Sub 2
1433writes `A`'s N bytes as that file (the merged code deletes it first, unlike #981's "must already
1434exist") and returns the bytes written. File and root handles close on every path (source notes
1435above `fn xefile` in `seed/omc/omc.om` at `d3d1b1bc`; quote error codes from that source, not from #981).
1436omega-mv's own table marks OP 11 "shipped, NOT_RUN" at `d3d1b1bc` (only OPs 12 and 13 are
1437EXERCISED, EMULATED under QEMU q35 + OVMF); physical hardware NOT_RUN. Observed 2026-11-04 with
1438the pinned omc `b4f45121…`: `efi 11 0 a 0 0` under `target x86efi` compiles (exit 0, `MZ` image) and the
1439same unit with `efi 14` is `omc: line 4: error 25`; the previous pin's omc `be8c5130…` gives `line 1: error 25`.
1440
1441**`peername`: bounded peer address of an existing descriptor** (merged in
1442[omega-mv#918](https://github.com/aien-dev/omega-mv/pull/918) as `2d848d939`, committed omc
1443`38748442…`; in the current pin `d3d1b1bc` / omc `b4f45121`, since `3a163bc5` / omc `24caacf4`). `peername fd A off n` is host word 224,
1444program mode only. It writes the connected peer's address into `A[off, off+n)` through AArch64
1445`getpeername` 205 (not `getsockname` 204) or x86-64 `getpeername` 52 (not 51), with the same slice and
1446private 32-bit length convention as `sockname`. Zero capacity is allowed, at the array end too, and
1447returns the full length. The result is the full address length (above `n` means truncated) or a
1448negative errno. An invalid slice traps 3; a read-only buffer (a view or text) is error 20. It creates
1449and connects no descriptor; the caller owns the descriptor's lifetime. The peer is the transport
1450endpoint, not an authenticated user; forwarding headers gain no authority from it. Observed
14512026-10-31 (host only) with `seed/host/tests/peername.om` at `3a163bc5e`: omc `24caacf4…` compiles it
1452and the run prints `PASS native peername: accepted peer, truncation, empty slices, errno and bounds`,
1453exit 0; its mutant arguments 1, 2 and 3 each exit 103; prefixed with `target x86linux` it gives the
1454same PASS line and exits under `qemu-x86_64` 8.2.2 (EMULATED, not native x86). The earlier pin
1455`2aec185d…` gives `omc: line 24: error 3` for that file, and compiles `peername = int 1` as a name
1456(at `24caacf4` that is `omc: line 2: error 16`). Rerun 2026-10-31 at `9920aab14` with omc
1457`be8c5130…` (host only): the same PASS line with exit 0, mutant arguments 1, 2 and 3 each exit 103,
1458the `target x86linux` build gives the same PASS line with exit 0 under `qemu-x86_64` 8.2.2 (EMULATED),
1459and `peername = int 1` as a one-line unit is `omc: line 1: error 16`. This supersedes the pending
1460candidate notes of harness draft #108 (candidate omc `4ef67f18`/`6a2916cd`).
1461
1462**`execpure` and descriptor closing in `execprog`** (merged in
1463[omega-mv#970](https://github.com/aien-dev/omega-mv/pull/970) as `1db941627`; in the current pin
1464`d3d1b1bc` / omc `b4f45121`; observed below with the then pin `91c83438` / omc `2aec185d`). `execpure A off n` is host word 198
1465(AArch64 only; `target x86linux` is error 25): it decodes the packet as `execprog` does, pins the
1466executable as descriptor 3, applies a fixed strict stdio profile (Landlock execute/read beneath that file,
1467no-new-privs, seven `prlimit64` ceilings, a seccomp filter allowing only `read` on 0, `write` on 1 and 2,
1468`exit`, `exit_group` and `execveat` on 3) and calls `execveat(AT_EMPTY_PATH)`. It returns only on failure,
1469with the first failing step's negative errno, and has no weaker fallback. `execprog` also changes: it now
1470closes every descriptor at or above 3 with `close_range(3, UINT_MAX, CLOSE_RANGE_UNSHARE)` before exec,
1471so a child no longer inherits them. Observed 2026-10-31 with omc `2aec185d` (host only): the
1472`seed/qualification/security673/pure-launch.om` fixture launching a static omc program that exits 7 gave
1473exit 7; launching `/nonexistent/x` printed `PURE_LAUNCH_REFUSED` and exited 2 (ENOENT); a child that reads
1474descriptor 3 got EPERM (exit 1) under `execpure`, and EBADF (exit 9) under `execprog` with the parent's
1475descriptor 3 open. The omc of `1db941627^` (`0243e4aff`, sha256 `1578b357…`) refuses `execpure` with
1476error 3, and its `execprog` child read the inherited descriptor 3 (exit 50). Older pins, including the
1477omega MCP pin before omega-mcp #6 (`2c824805…`), lack both; the current MCP pin `3ad9f10f…` has both.
1478
1479- Types: `fd`, flags, modes, pids are `int`; offsets, counts, capacities `ulong`; file positions and
1480 intervals `long`; buffers are `uchar` arrays. Every result is `long`.
1481- A result is a **count or minus the Linux errno**. `read` may return fewer bytes than asked, 0 at
1482 end of input, or a negative error; `write` may write fewer bytes. Loop until done, and handle
1483 `k < 0` and `k == 0` separately. Do not copy `seed/rung4/tests/bytecopy.om`'s loop as error
1484 handling: it ends silently on a negative result.
1485- Slices are checked before the kernel call: `n <= len A` and `off <= len A - n`, else trap 3. `off`
1486 does not wrap (`t_write_wrap.om`).
1487- Count conventions differ per word and are part of the contract: `cwd` includes the trailing zero;
1488 `readlnk` has none and a result equal to capacity may be truncated; `sockname` may return more
1489 than capacity; `argread`/`envread` return -105 on short capacity without touching the buffer.
1490- `send` adds `MSG_NOSIGNAL`; `write` does not, so writing to a closed pipe follows ordinary Linux
1491 SIGPIPE behaviour [INFERENCE from Linux semantics; not gated here].
1492- These words carry the process's permissions; they are not a sandbox. Linux ARM64 is the only
1493 qualified host ([#L739-L743](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L739-L743)).
1494- Merged: `seed/effects` ([omega-mv #820](https://github.com/aien-dev/omega-mv/pull/820), train r1,
1495 main squash `f56a372a`, 2026-10-30) lists the host words a unit uses with their Linux syscalls,
1496 checks that the omc binary issues no others, and emits a seccomp filter for `bwrap --seccomp`
1497 (`effects src|elf|verify|bpf|table`, `seed/effects/README.md`). It works at syscall granularity
1498 only and gives no filesystem isolation. **Its own qualification fails at current main:** observed
1499 2026-11-04 at main `d3d1b1bc` (omc `b4f45121…`) and at `19b8340d` (omc `be8c5130…`),
1500 `sh seed/effects/check.sh` printed `SEMANTIC EFFECTS FAIL failed=3 checks=49`, exit 1: the closure
1501 check found the host-coded keywords of `seed/omc/genkw.awk` and the effects table different (the
1502 table lacks `execpure`, added by #970, and lists `peercred`, `pollfds` and `sendmsg`, which the
1503 closure list does not have), `execprog`'s ELF issues syscall 436 beyond its table row 221, and
1504 `seed/host/tests/memcheck.om`, `process.om` and `peername.om` fail `verify`. Until that check
1505 passes again, an `effects` manifest is not evidence that a unit's syscall set is complete.
1506 PENDING fix, not merged: [omega-mv #1023](https://github.com/aien-dev/omega-mv/pull/1023) (head
1507 `eb7b3c60`, open) makes the closure read every keyword list of `genkw.awk` by content, adds rows
1508 `peername net 205`, `execprog proc 221 436` and an `execpure` row, and lets a table row hold any
1509 number of syscalls (a pool replacing the fixed two slots `ws1`/`ws2`). Observed 2026-11-04 at
1510 that head (its `seed/out/omc` `b4f45121…`): `sh seed/effects/check.sh` printed
1511 `SEMANTIC EFFECTS PASS checks=50`, exit 0, with the tool mutants still killed.
1512- Evidence for any host claim: compiler sha256, source sha256, output binary sha256, exact command,
1513 exit status, and the observed bytes. A program that ignores a negative result is not evidence.
1514- Measured 2026-10-25 while building a disk image with the seed compiler `seed/out/omc` sha256
1515 `c99eda2465036c0637a444689a65dd7fc736e4fa8a8b4cf3456b0ce1b57f8996` (omega branch
1516 `feat/allen-imac-competition` `c3fb79697`, off main `55f9b0af`). Except where noted, these are NOT
1517 re-measured at the current pin (omc `2c824805…`). The failures that cost the most wasted compiles:
1518 - `fopen` returns `long`, but `read`, `write`, `fclose`, `fsync`, `fseek`, `ftrunc` and `fchmod`
1519 take `fd` as `int`: `read int fi A 0 n`. `fseek`'s offset and `ftrunc`'s length are `long`, so a
1520 `ulong` constant must be converted explicitly (`ftrunc int fo long IMGLN`); a plain `ulong`
1521 value there is error 7, not a quiet narrowing.
1522 - There are no implicit conversions in any argument position: mixing a `ulong` value with a
1523 `uchar` array element (`xor c get A i`) is error 7 until you write `xor c ulong get A i`
1524 (reproduced at omc `2c824805…`: `d = xor c get A 0` is error 7, `xor c ulong get A 0` compiles).
1525 - Host words and `global` need program mode: without `fn main` the unit compiles in function mode
1526 and every host word is error 9 with an empty output file, which reads like a broken pin. (Pending
1527 exception for nine file/identity words in OM-2 units: section 2, omega-mv#1008. Observed
1528 2026-11-04: `om2` / `export fn f to long` / `r = geteuid` gives `omc: line 3: error 9` with
1529 omc `be8c5130…` and `b4f45121…`, and compiles with the #1008 omc `c000ec02…` at `2992a68b`.)
1530- **Owned DMA-window integration: PENDING, not the main compiler or a kernel driver.**
1531 Depends on the VFIO words described below ("VFIO device words", added by
1532 [guide #79](https://github.com/aien-dev/omega-harness/pull/79), merged `d3d6738`; the words stay PENDING), compiler
1533 [omega-mv#890](https://github.com/aien-dev/omega-mv/pull/890) stacked on #878, exact source
1534 `397e67040fb74853c6814097fe02ae4e1ebd6f66`, omc sha256
1535 `bcfa582892afca8f65e551fe56867d918d86e84540c7381be8fa9ef18d0cf0f6`.
1536 Driver source
1537 [`c69470f5`](https://github.com/aien-dev/omega-gpu-driver/blob/c69470f5fac6fe603a45b2c4af0c79eea3409ec6/chan/gmmu.om)
1538 distinguishes simulator `mmwinit` (`mmwin`) from `mmwalloc` (owned shared anonymous handle).
1539 CPU accesses use handle+offset; IOVA, informational CPU base and GPU VA remain separate.
1540 `mmwdmap(epoch, fd)` maps the whole owned extent; `mmwpublish(epoch)` must precede any externally
1541 visible DMA reference. Epoch/handle/length/IOVA/container identity stays fixed for that lifetime.
1542 Rebuild MAP_DMA requests after every call: the compiler overwrites vaddr even on ioctl error.
1543 An unpublished DMA-mapped extent closes only after UNMAP_DMA returns its exact original length,
1544 then successful `mapdrop`; a never-mapped OWN extent drops directly. Only EBADF is proven no-target;
1545 uncertain mapping errors,
1546 failed/partial/unexpected unmaps and drop failures retain backing. Published or quarantined backing
1547 cannot be reset/reused/dropped: TLB invalidation or a simulator idle is not a documented DMA-idle
1548 proof, and no GB10 reclaim-proof API exists here. The single owner must retain process/container
1549 lifetime (no fork, fd close/reuse or restart); the latch is process-local, not crash-safe containment.
1550 `tests/dma_host.sh`: EXERCISED anonymous memory, real invalid-fd refusal/retry, 23 explicit host
1551 replay/boundary cases and 11 compiling negative-control mutants. Simulator parity remains 391
1552 byte-identical C-reference lines. This is Linux userspace VFIO, not a Linux kernel module;
1553 hardware/DMA/kernel execution NOT_RUN. It neither opens a VFIO device nor grants authorization.
1554- **VFIO device words: PENDING, not on `main`.** Draft
1555 [omega-mv#878](https://github.com/aien-dev/omega-mv/pull/878), rechecked 2026-10-30 at head
1556 `019108d5cbaae12bdad818741b6a97ac8572501b` (committed omc sha256
1557 `d5d7d1029bf1b7011570d346e320bc793a0f3ee3c227033f7f8d2bbc292c4054`, self-rebuild byte-identical), adds
1558 keyword ids 178/179 ([MAPPING.md#L18-L19](https://github.com/aien-dev/omega-mv/blob/019108d5cbaae12bdad818741b6a97ac8572501b/seed/host/MAPPING.md#L18-L19),
1559 allowlist [#L66](https://github.com/aien-dev/omega-mv/blob/019108d5cbaae12bdad818741b6a97ac8572501b/seed/host/MAPPING.md#L66)):
1560 `vfioctl fd req A off n -> long` takes only a **literal** request from the allowlist at its exact
1561 `n` (GET_API_VERSION 15204/0, CHECK_EXTENSION 15205/4, SET_IOMMU 15206/4 value 3 only,
1562 GROUP_GET_STATUS 15207/8, GROUP_SET_CONTAINER 15208/4, GROUP_GET_DEVICE_FD 15210 nonempty name
1563 without zero bytes, DEVICE_GET_INFO 15211/24, DEVICE_GET_REGION_INFO 15212/32), writes
1564 `argsz = n` when `n >= 8`, returns the result or -errno. A non-literal or unlisted request
1565 (including DEVICE_RESET 15215) is compile error 9; wrong sizes or values trap 103 at run time.
1566 Both words are AArch64 only: under `target x86linux` either one is error 25
1567 ([#L85-L86](https://github.com/aien-dev/omega-mv/blob/019108d5cbaae12bdad818741b6a97ac8572501b/seed/host/MAPPING.md#L85-L86)).
1568 Observed with that omc on Linux AArch64: `r = vfioctl neg int 1 uint 15207 a 0 8` returned -9
1569 (EBADF, run exit 0 in a program checking it); `uint 15215` and a request held in a name are
1570 error 9; a count held in a name compiled and trapped 103 at run time; the x86 form is error 25;
1571 the PR's `seed/host/tests/vfio.om` exits 0 and `vfiocheck.om` prints
1572 `PASS 15 VFIO compiler refusals`. Main's omc `62775d2a…` does not know the words (error 3); nor
1573 does the guide-pin omc `be8c5130…` or main `d3d1b1bc7`'s omc `b4f45121…` (rechecked 2026-11-04:
1574 `r = vfioctl neg int 1 uint 15207 a 0 8` is `omc: line 3: error 3` on both).
1575 Not calling DEVICE_RESET does not avoid a reset: Linux vfio-pci FLRs on device open when a reset
1576 method is enabled and calls `pci_reset_bus` (SBR) on release even with `reset_method` empty.
1577 `vfiomap fd A off 32 -> handle` maps one `vfio_region_info` read-only and shared, exactly its size
1578 at its offset; flags must include READ and MMAP. Read with `mapget`, release with `mapdrop`;
1579 `mapset` through it traps. Exercised on host fixtures and in QEMU against real `vfio-pci`
1580 ([omega-gpu-driver qemu/w0-edu.log](https://github.com/aien-dev/omega-gpu-driver/blob/main/qemu/w0-edu.log)); not qualified on GB10.
1581- **Keyword-id conflict, PENDING:** [omega-mv#946](https://github.com/aien-dev/omega-mv/pull/946)
1582 (`cpufence`/`cpurelax`) merged as `d9461717` (2026-10-31) with ids 199/200, so it no longer
1583 collides. Main `d3d1b1bc7` (#1015, 2026-11-04 recheck) now returns 178 for `efi`, a keyword only
1584 under `target x86efi` (`fn kw` in `seed/omc/omc.om`), while #878 (head `019108d5`, open draft,
1585 conflicting with main) still returns 178/179 for `vfioctl`/`vfiomap`. #878 must renumber and
1586 reseed when it is brought up to main, so the ids above can still change; recheck `fn kw` at the
1587 merge commit before quoting them.
1588- **VFIO DMA and writable BAR: PENDING, stacked on #878.** Draft
1589 [omega-mv#890](https://github.com/aien-dev/omega-mv/pull/890) (base branch `feat/vfio-device-calls`;
1590 rechecked 2026-10-30 at head `f850c52622577eedcb65af3e1af09ab568101e7a`, which contains #878's head;
1591 committed omc sha256 `fe6e986596f5d22fcfce2bd66006608f49a8f9a28c555066569350aedd3c408b`, self-rebuild byte-identical) adds keyword id 180
1592 `vfiomapw fd A off 32 -> handle`: as `vfiomap`, but the
1593 region flags must include READ, WRITE and MMAP and the map is shared read/write, so `mapget`/`mapset`
1594 drive registers (one aligned access each, DSB SY on both sides)
1595 ([MAPPING.md#L20](https://github.com/aien-dev/omega-mv/blob/f850c52622577eedcb65af3e1af09ab568101e7a/seed/host/MAPPING.md#L20)).
1596 It also allows IOMMU_MAP_DMA 15217/32 and IOMMU_UNMAP_DMA 15218/24 in `vfioctl`
1597 ([#L84-L99](https://github.com/aien-dev/omega-mv/blob/f850c52622577eedcb65af3e1af09ab568101e7a/seed/host/MAPPING.md#L84-L99)):
1598 Omega code never supplies an address. Write a mapping handle into bytes 8..15 and the IOVA into
1599 16..23; the compiler checks the handle like `mapget`, requires a read/write mapping and flags exactly
1600 3, then stores the mapping's own base and whole length; any failed check traps 3 (exit 103).
1601 UNMAP_DMA requires flags 0. Unmap before `mapdrop`: a dropped mapping that is still DMA-mapped
1602 stays pinned until the container closes. All three VFIO words are error 25 under `target x86linux`
1603 ([#L104-L105](https://github.com/aien-dev/omega-mv/blob/f850c52622577eedcb65af3e1af09ab568101e7a/seed/host/MAPPING.md#L104-L105)).
1604 Observed with that omc: MAP_DMA on a zeroed span (no live handle) trapped 103; UNMAP_DMA on fd -1
1605 returned -9; `vfiomapw` under x86 is error 25; the PR's `vfio.om` exits 0 and `vfiocheck.om` prints
1606 `PASS 19 VFIO compiler refusals`. #878's omc refuses 15217 (error 9) and does not know `vfiomapw`
1607 (error 3). Exercised on host fixtures only.
1608
1609## 9a. GPU kernels written in `.om` (GB10 sm_121, raw driver)
1610
1611Observed 2026-11-02 to 2026-11-04 while building the Omega LLM GPU training path in aien-dev/aien-train
1612[#56](https://github.com/aien-dev/aien-train/pull/56) (head `4e0039070cce87802654a74b869288159ce94f5d`;
1613merged `e186ea29`): rungs 4 and 5 at `d6ff5f5`, `geval` and the
1614Kahan CE sum at `154fd8c`, kernel round k1 (one-warp softmax, split-K weight gradients, `gprof`) at
1615`ed2e1925d7a838995582131196b60cbfda1b666b`, k2 (64×64 GEMM tile) at
1616`ea0f078ed8bec21f9a50cccaf85a7cba11bc3a34`, k3 (warp-per-row RMS norm) at
1617`1d241c38d213c8921d24ab970c7260aaf93c5a36`, k4 (warp-per-row cross-entropy) at
1618`9a5225a4bbc4df0ee19d4cc416ebe72db5c518b0`, k5 (causal attention GEMMs) at
1619`f84a657246e80686302f534017540fee68e85171`, k6 (causal predicated softmax loads and stores) at
1620`8dff0ba1d249583c1a9f00e6f47b2dc3d80c3c9a` (evidence crumb `af29657423dc548a40a9e685484cf95a1ccc0e7e`,
1621README fix `099fa9e68e94516404486c2c3ef27956149e249b`), k7 (FFMA operand reuse plus an accumulator
1622remap) at `d3d4551d2c3726e3927c9cf0a95b8091e11919f7`, k7b (remap removed) at
1623`574e78afaa80976538c8f08cf1a2ddbf8e5a36c2`, k8 (pipelined 64×64 GEMM, per-kernel shared-memory
1624TARGET, GPR guard) at `c05b89f7e08ea8d2c3717a500fc3e17af8e30a9d`, k9 (ReLU fused into the FFN GEMM
1625epilogues) at `1575dc866bb556c8b6b605044e5bd43d17c3f2a0`, rung 6 (30000 steps, evidence
1626`0d744749465cf31c5220ac0eaad26462a993b0e4`); rung 7 (v2 shape D 384, F 1536, #57, head
1627`43f374a6042769a3d853d9b953dbe4d86348b01b`) at
1628`b312942460bc81ef590a92fde8f23a298e119916` (files `native/omegallm/gpu/gk.om`,
1629`gr.om`, `gg.om`), the BF16 path (#58, head `cb556468380944f4aa1a9a5da389f4ad193f4154`) at
1630`a82fc1a11f01031162fd305e9ce6158afb760eb6` (adds `gb.om`), rung 8 (60000-step schedule, #59, head
1631`7baaf8b4bda00a4394f1f094aece5ce7b3b6ed5c`, evidence only) at
1632`2d19e6fec5b12930e17d6ad6ddbb038263732c5b`, v3 (L ≤ 16, banked storage, #60, head
1633`b92c96b627f33beadd69dc2d8f70833e973a377f`), rung 9 (first long BF16 run, #61, head
1634`fcf6cdedec3024806a82f40e977c1d1389d684a4`, evidence only) at
1635`687bbcb82aa0bf03e9d3fa71447ce544909f642c`, and rung 10 (BF16 on the 60000-step schedule, #62, head
1636`3ed47a0503f15cdff38ad911eeddb13cf13b4c32`, evidence only) at
1637`6929722a36023f0c807d8b05945e845bbe88534e`; every cited commit is an ancestor of its PR head. All
1638merged on aien-train main (checked with `gh pr view` 2026-11-04): #56 `e186ea29`, #57 `16e9932e`,
1639#58 `4461e3fa`, #59 `24d21497`, #60 `a9c720db`, #61 `930ae21c`, #62 `56cc8870` (main head). The
1640best trained model is rung 10's BF16 v2 checkpoint (P 15,833,472, T 256, held-out `E 60000 2243
16411204466`). The Omega LLM is the planned model for `:18091` (Linear P-DRA-7), not served yet: its
1642only inference path is the CPU command `ollm sample`, and no HTTP server exists. Compiled with omc `2c824805…` (omega-mv
1643`e5b32567`). The device words come from the vendored CUDApp `context.om`/`vector.om`/`launch.om`
1644(`dcba8bb8`). Status EXERCISED on one GB10, non-quiet windows; not QUALIFIED. These are pin-specific
1645facts, not rules of the language.
1646
1647- The kernels are instruction words that the program emits itself: `.om` code writes 16-byte SASS
1648 words into a code slot, then launches them through a QMD. Verify every new instruction encoding
1649 with nvdisasm (CUDA 13.0, `nvdisasm -b SM121`) as a read-only oracle. A slot dumped whole ends in
1650 zero bytes that disassemble as illegal instructions. Trim trailing zero bytes to a 16-byte
1651 multiple first (`tests/omegallm/gpu-disasm.sh`).
1652- `LDC.64` loads a 64-bit constant-bank value and needs an 8-byte aligned offset. A pointer
1653 argument must start at an even 32-bit argument slot (`gr.om` `grptr`: pointer i sits in slots
1654 i+1, i+2), with the argument area laid out so slot pairs start 8-byte aligned.
1655- Allocate GPU-uncached any memory that the CPU writes or polls (pushbuffer, constant bank, QMD,
1656 completion marks, code). When cached, a release sat in L2 for about 1.06 s (recorded in the
1657 `gk.om` note at lines 1023-1026 at `1575dc8`, the 1.06 s on line 1024). The data arena can stay
1658 cached, provided the host invalidates it after host writes and every launch ends with
1659 `L2_FLUSH_DIRTY` before the CPU reads results.
1660- Output buffered in the program (`oputu`/`oputc`, flushed by `oflush` in aien-train `lio.om`)
1661 is lost on `exit` or `trap` unless it is flushed first. Call `oflush` before every diagnostic
1662 `exit N` (`gg.om` `ggdie`), or the failure prints nothing.
1663- Host loops over parameter-sized arrays need chunking. A `for` with a computed bound gets the
1664 1000000-pass guard (section 8), and P = 7409920 parameters exceed it (trap 4, exit 104). Loop over
1665 chunks of at most 999999 elements (`gg.om` `ggupc`, `OCH`).
1666- Host glue around launches needs many values at once (pointer halves, grid sizes, argument
1667 counts), and each live name takes a register from the 16-register pool (section 6). Pass launch
1668 arguments through a small global (`gkarg`) and split pointers in a helper (`ggpt`), so callers
1669 stay inside the pool.
1670- For f32 Adam on chip, use `sqrt(v) + eps` followed by a reciprocal (`MUFU.SQRT`, then `MUFU.RCP`,
1671 `gr.om` `gradam`). Avoid `v · rsqrt(v)`, because v = 0 occurs for parameters with zero gradient
1672 and 0 · inf is NaN.
1673- Gate f32 chip numerics against the f64 CPU reference with a tolerance derived from the summation
1674 length, not a fixed constant. The gradient gate uses relative error < R·2^-24 for a reduction
1675 over R rows. A fixed tolerance of 1e-4 failed at 1.61e-4 on the night shape. The maximum came
1676 from ReLU units whose pre-activation lies within f32 resolution of zero. Both sides are valid
1677 subgradients, and forcing the CPU onto the chip's side gave 7.1e-5 (aien-train
1678 `evidence/OMEGALLM/gpu/README.md`, `probe/`). Never loosen the gate to make it pass; explain the
1679 maximum.
1680- A mutant must be able to change the observed value. A wrong Adam β1 is invisible on a step-0
1681 checkpoint, because m = 0. Run the Adam gate's negative control on a trained checkpoint
1682 (mutant h fails at step 1000, resid 0.114 against 2^-16).
1683- A long f32 sum in one register is biased, not just noisy. The CE kernel summed exp(l − m) over
1684 V = 4096 logits sequentially; once the running sum is large, terms below half its ulp vanish, so
1685 log Σ came out ~1.04e-5 low on every row and the chip's held-out loss missed the f64 CPU's by
1686 11 µnats on a 10 µnat gate. Find such a bias by comparing per-row intermediates against the CPU,
1687 not the final loss (`gg.om` `ggdiag`: max logit and l_y agreed to ~3e-7, log Σ did not). The fix
1688 is a compensated (Kahan) sum (`gr.om` `grce`, `OMUTK`), after which the chip printed the CPU's
1689 E line exactly (aien-train `evidence/OMEGALLM/geval/`). There the plain sum (`--mutant k`) failed
1690 the gate by 11 µnats. Since k4 each lane sums only V/32 = 128 terms before the warp tree, and the
1691 plain per-lane sum moves `geval` by at most 1 µnat (`gpu-k4/`): a mutant whose effect falls below
1692 the gate is an observation, not a control. Replace it with one the gate can see.
1693- A kernel launched with `gkgpr` G may use R0 to R(G−3) only. On Volta and later two registers of the
1694 QMD count go to the program counter (Mesa `0b6d3f401e2b2e53be44786692f12e31055b749c`, main
1695 2026-11-04: NAK `src/nouveau/compiler/nak/sm70.rs:101` `hw_reserved_gprs`; `api.rs:275` sets the
1696 count to `max(4, num_gprs + 2)`). Two hangs fit that rule: Kahan
1697 state in R69-R71 under `put gkgpr id 72` (`gr.om` `grall`) timed out every launch (`GX 121 -110`,
1698 exit 84) while R40-R42 ran (`evidence/OMEGALLM/geval/a1/`), and k8's 64×64 GEMM using R158 under
1699 160 did the same (`GX 99 -110`, `gpu-k8/a1/`); 168 runs. `tests/omegallm/gpu-disasm.sh` now prints
1700 `GPR <id> max R<n> need <n+3> declared <g> OK|LOW` per slot from the dump's `gkgpr` table and exits
1701 4 (`GPR_LOW`) on any LOW; its negative control is the 160 tree (`gpu-k8/disasm-neg-gpr160.txt`).
1702- Every ordered comparison with NaN is false in the pinned omc (0/0 takes neither `gt n 1.0`,
1703 `lt n 1.0` nor `gt 1.0 n`), so a running max `if gt d best` silently skips NaN. Count non-finite
1704 values separately and fail on any (`gg.om` gcmp2).
1705- ReLU sign flips grow with the shape: at P 7.4M the fixed-mask gradient gate failed at 1.58e-4 from
1706 4 units whose pre-activation was within 2.4e-7 of zero. The rung-5 gate (`gcmp2`) bounds the
1707 chip's pre-activations first, then compares gradients on the chip's branches (aien-train
1708 `evidence/OMEGALLM/gpu-max/README.md`). A pass of one gate is not a pass of the other.
1709- `ollm eval CK HELD W` needs W·T + 1 ≤ N held tokens and exits 23 otherwise (`cli.om` `cmdeval`):
1710 doubling T from 128 to 256 halves the usable W (4486 → 2243 on the v1 held set). On rung 6's
1711 `ck30000` the CPU `eval` (5519 s on one core, nice 19) and the chip `geval` (about 7 s) printed the
1712 same line, `E 30000 2243 1338156 499194` (aien-train `evidence/OMEGALLM/gpu-r6/`).
1713- Profile before tuning. `ollm-gb10 gprof` (k1) prints one `GP id gx gy gz m n k wait_ns` line per
1714 launch of the last profiled step. With every launch synchronous, GPU wait was 91.6% of the 200-step
1715 wall at k2 (`evidence/OMEGALLM/gpu-k2/`), so per-kernel wait, not launch preparation, names the
1716 next kernel to fix. A batching variant (one wait per group of launches) could save at most 0.69%
1717 of the measured step and was dropped.
1718- A retile that keeps every output element's FFMA order over k gives a result that is
1719 bit-identical, not just within tolerance. The k2 64×64 tile (`gk.om` ids 32-39, `gktile` picks it
1720 when m and n are multiples of 64, ids 0-7 stay for the rest) left the checkpoint after 200
1721 `gtrainf` steps byte-equal to k1's (sha256 `fde1fae9…`). Use that equality as a check in
1722 addition to the f32 gates. Its budget: 64 threads, an 8×8 microtile each, K8, 144 GPRs and 4352 B
1723 of shared memory (`put gkgpr id 144`, `put gksm id 4352`).
1724- A row kernel with one thread per row reads its row at a stride of 4·D bytes across the warp, so
1725 each warp load touches 32 lines. k3 runs `gr.om` RMS norm (ids 10, 11) one warp per row: lane l
1726 holds columns l + 32u in registers, loads and stores are coalesced 128-byte lines, each input is
1727 read once, and the row sum is a per-lane FFMA chain plus a 16-8-4-2-1 `SHFL.BFLY` butterfly
1728 (`grwred`). Launch R·32 threads (`gg.om` `ggrmsf`), and refuse D or T not a multiple of 32
1729 (`grall`). Forward 2.50× and backward 2.47× faster per profiled step, 237.6 and 215.8 GB/s of
1730 required traffic (aien-train `evidence/OMEGALLM/gpu-k3/`). The sum order changes, so the result is
1731 within the f32 gates but not bit-identical to the thread-per-row kernel.
1732- The same layout serves the CE kernel (k4, `gr.om` `grce`, id 21, one warp per row over V 4096):
1733 warp max, per-lane Kahan sum of e without storing it, warp sum, then a third pass recomputes e
1734 with the same FFMA and `MUFU.EX2` (the same value), scales and stores it, so the logit matrix is
1735 read 3 times and written once instead of 3 + 2. The lane that stored L[y] (y & 31) alone applies
1736 L[y] − sc and writes the row stats, so no lane reads another lane's store. 13.51 → 3.68 ms per
1737 profiled step (3.68×, 99 → 292 GB/s of required traffic); `grall` refuses V not a multiple of 256.
1738- `grwred` uses R65 as its shuffle scratch register (and R64 for the value). A value parked in R65
1739 across a butterfly is overwritten; k3's backward kernel keeps s in R67 for that reason, and k4's
1740 first CE build read R65 as −m·log2e after the warp sum. The slot-21 disassembly showed it before any
1741 chip run; the fix keeps m in R43 and recomputes R65 = R43·R29. Check a helper's scratch registers
1742 before giving a live value a register near the reduction.
1743- Skip causal work with runtime argument words, not new kernel ids (k5, `gk.om` words 22, 26, 27,
1744 28; `gg.om` `ggbh` sets the mode with `gkopz`, and `gkmm` reads and clears it, so an unmarked
1745 GEMM stays dense). The GEMM prologue exits a block whose column tile is above row tile + X (S and
1746 DP: X = 0), and reads kn = r·ka + base K tiles from tile r·kc (P·U and DS·K: ka = pt; Pᵀ·DO and
1747 DSᵀ·Q: ka = −pt, kc = pt). `gkczok` refuses a shape the mode does not fit (nverr −22). Every
1748 skipped FFMA term is ±0 and a +0 accumulator stays +0 under round-to-nearest, so the checkpoint
1749 after 200 steps stayed byte-equal to k4's. The three attention GEMMs ran 1.35×, 1.52× and 1.42×
1750 faster per profiled step, and 200 steps 1.059× faster (aien-train `evidence/OMEGALLM/gpu-k5/`).
1751 Skipped output tiles are no longer written and keep stale arena data, so every consumer must mask
1752 them rather than multiply by zero: p · (stale NaN) is NaN even when p = 0. `grsoftb` (id 16)
1753 `FSEL`s dp to 0 for columns > t.
1754- A bandwidth-bound row kernel gets faster only by moving fewer bytes: skip the causal upper triangle
1755 with predicated `LDG`/`STG` (k6, `gr.om` `grsoftf`/`grsoftb`, ids 15/16). `gk.om` `gkldgp`/`gkstgp`
1756 put the guard predicate in word 0 bits 12-15 (p 7 = PT, +8 negates; `gkldg`/`gkstg` are these with
1757 p 7). Set the load predicates (t ≥ 32u) with `ISETP` before the first load: an `ISETP` placed
1758 between loads waits on their scoreboard. Recompute them before the stores if a mask loop reused a
1759 predicate. Store only what a consumer reads (here chunk pairs with t ≥ 64·⌊u/2⌋, the end of the
1760 diagonal tile), and `FSEL` every unloaded register before arithmetic (−∞ in softf, +0 in softb),
1761 so the checkpoint after 200 steps stayed byte-equal to k5's. Softmax 1.639× and 1.676× faster per
1762 profiled step at about the same GB/s, 200 steps 1.053× (aien-train `evidence/OMEGALLM/gpu-k6/`).
1763- Check a new predicate encoder in the disassembly at a shape that uses it. `gk.om` `gkisge` wrote its
1764 destination predicate at word 0 bit 16; `ISETP`'s field is word 2 bit 17 (as in `gkisetp`), so every
1765 `gkisge` wrote P0. It went unseen because every caller asked for P0 and the parity shape (T = 32,
1766 one chunk) emits no predicates; the first max-shape dump showed seven `ISETP`s all writing P0.
1767- Mark FFMA operand reuse in the instruction word; nothing sets it for you (k7, `gk.om` `gkffma`'s
1768 reuse mask `ru`, control word 3 bits 26-28: Ra 1, Rb 2, Rc 4). `gkru` sets Ra reuse on every FFMA
1769 of a row run that reads the same a register except the last, which releases it; in a 64×64 slot
1770 that is 448 of the 512 k-loop FFMAs. Set control bit 109 (word 3 bit 13) with every nonzero mask:
1771 nvdisasm 13.0 prints `.reuse` only when bit 109 is also set, and ptxas 13.0 `-arch sm_121` sets it on
1772 every `.reuse` instruction of a probe kernel. What bit 109 does alone is unknown, so attribute
1773 results to the pair. Switch `OKREU` (`build.sh --variant r0` builds it off, byte-equal to k6's
1774 code). The checkpoint after 200 steps stayed byte-equal; the GEMMs' profiled wait fell to 0.955× of
1775 k6's over three rotated rounds and 200 steps ran 1.0457× faster (aien-train
1776 `evidence/OMEGALLM/gpu-k7b/`). A Volta-style register-bank remap (accumulator column j xor 1, off
1777 the b registers' low two bits) gave no measured gain on sm_121: remap-only 0.989× of k6, inside
1778 the k6 spread (`gpu-k7/`). k7b removed it, and 200 steps stayed equal to k7 (1.0003). Measure a
1779 bank model before coding to it; sm_121's is unpublished.
1780- Size the shared-memory carveout per kernel in QMD word 36, or a kernel that uses more shared
1781 memory loses blocks per SM. Word 36 holds `SHARED_MEMORY_SIZE_SHIFTED7` and the MIN, MAX and TARGET
1782 SM configs at bits 11, 17 and 23 (hw value = KiB / 4 + 1 over the GB10 carveouts 0, 8, 16, 32, 64 and
1783 100 KiB, Mesa `0b6d3f40` `src/nouveau/winsys/nouveau_device.c:218-231`). `gk.om` used a fixed
1784 TARGET of 32 KiB.
1785 `gksmw` now picks the smallest carveout holding smem × ⌊65536 / (`gkgpr` · `gkthr`)⌋ bytes, as Mesa
1786 NAK `qmd.rs` `gv100_get_hw_smem_sizes` does from its own residency bound. k8 double-buffered the
1787 64×64 GEMM's K loop (ids 40, 42, …, 54, two 16 KiB slots each, 2 × 4352 B shared, staging in
1788 R142-R157, one barrier per K tile). Under the fixed TARGET it was bit-identical but its GEMM wait
1789 1.12× k7b's (6 blocks × 8704 B do not fit in 32 KiB). Under `gksmw` its 64×64 wait was 0.913× of k7b's
1790 kernel under the same rule (max below min in all three rotated rounds), GEMM wait 0.914× and 200
1791 steps 0.969× of k7b's wall, checkpoint byte-equal (aien-train `evidence/OMEGALLM/gpu-k8/`). The
1792 carveout the hardware chose was not read back, so the cause is inferred from the reversal. In the
1793 same window k7b's own kernel with an identical QMD (arm C against B) ran 0.982× of B in every
1794 round: identical code spreads about 2% in a non-quiet window, so a gain must clear that.
1795- Fuse an elementwise kernel into the GEMM that produces or consumes the same tensor through an
1796 epilogue the caller arms per launch, and make the GEMM refuse every combination the epilogue was
1797 not written for. k9 removed `gr.om` RELUF/RELUB (ids 17/18): `gkope 1 y` makes the next `gkmm`
1798 with operand modes ma 1 mb 0 (W1 forward) store FP and also relu(FP) to y (ids 25 for the 32×32
1799 tile, 56 for the 64×64); `gkope 2 FP` makes the ma 1 mb 1 GEMM (dF backward) store C only where
1800 FP > 0 (ids 26, 58). `gkepok` refuses any other mode, beta or epilogue with -22. The select is the
1801 same `FSETP.GT` against RZ plus `FSEL` the separate kernels used (NaN → 0), so the result stayed
1802 bit-identical: equal gate lines, equal `geval` E lines, equal checkpoint after 200 steps. Launches
1803 fell by 16 per max-shape step, and summed GPU wait was 0.924× of k8's (144.56 → 133.54 ms/step, max
1804 k9 below min k8 in all three rounds; the pre-registered model gave an 8.49-14.15 ms/step saving and
1805 11.02 was measured). 200 steps took 0.942× of k8's wall (aien-train `evidence/OMEGALLM/gpu-k9/`).
1806 When `gktile` picks 32 at some shape, the 32×32 epilogue needs its own gate: neither the parity nor
1807 the max shape reaches it, so k9 ran `gcmp2` and mutant m at F = 96 (`ollm init … 256 32 64 2 96 2`).
1808- Make mutants build-time constants (`OMUTT`, `OMUTS`, `OMUTP`, `OMUTR`, `OMUTX`, `OMUTQ`, `OMUTW`;
1809 BF16 `OMUTU`, `OMUTL`, `OMUTO`, `OMUTV`, `OMUTN`; v3 `OMUTY`, selected with
1810 `tests/omegallm/build.sh --mutant t|s|p|r|x|q|w|u|l|o|v|n|y`), not runtime switches, so the
1811 product binary carries no mutant path. Check statically that a mutant changes exactly the intended
1812 slots before the window: mutant t differs from the product only in the 64×64 slots (32-39 until k7b,
1813 40-54 since k8), with one FFMA fewer per K tile (511 FFMA in slot 32 against 512; since k7, 447 of
1814 them `.reuse` against 448; k8's β kernels 575/447 against 576/448); mutant r's
1815 slot 11 has four `SHFL.BFLY` steps instead of five (the lane-1 step of the backward row sum is
1816 missing) and fails `gcmp2` with rc 47;
1817 mutant x's slot 21 has nine instead of ten (the CE sum's lane-1 step), fails `gcmp2` with rc 47 and
1818 moves `geval` by −362083 µnats. Mutant q is host-only (P·U and DS·K row tiles stop one K tile short
1819 through word 22), so its device code dump equals the product's; it fails `gcmp2` with rc 47.
1820 Mutant w differs from k6 only in the seven softmax `ISETP` immediates (+32, so each row's diagonal
1821 chunk is not loaded) and fails `gcmp2` at the max shape with rc 47. At the small shape its code is
1822 the product's and it passes with rc 0: a mutant needs a shape where its code differs.
1823- `tests/omegallm/gpu-disasm.sh` builds the CPU sources without `gg.om`. Every hook that `model.om`
1824 calls must therefore come from `nogpu.om`, or omc stops with error 5 at the call (seen from
1825 rung 5 until k2's fix). The dump writes all 64 slots of `gkcode` (1 MiB). A 32-slot dump silently
1826 drops ids 32-39. Since k6 `SHAPE="V T D H F B"` (the `grset` arguments, default the parity shape
1827 `256 32 64 2 128 2`) dumps any shape; the script exits 2 with `SHAPE_NOT_SET` when the substitution
1828 into `gpu-dump.om` did not take, and an empty slot prints `SLOT n empty`.
1829- Widening a shape past a register or scratch bound needs the old shape's code to stay byte-equal,
1830 and every host scratch sized by the old cap found before the window. Rung 7 (aien-train
1831 [#57](https://github.com/aien-dev/aien-train/pull/57) at `b312942`, `docs/omegallm/CONTRACT-V2.md`:
1832 D ≤ 384, F ≤ 1536) moved the warp-per-row RMS kernels' four D/32-word register banks above the
1833 scalars once D/32 > 8 (`gr.om` `grrb`: R32 + 8k up to 8 words, R72 + n·k beyond, ending at R119
1834 for D 384), so the v1-shape `gpu-code.bin` and GPR dump stayed byte-identical (`gpu-disasm.sh` with
1835 the rung-6 `SHAPE`). The first gate window still trapped (exit 103, BOUNDS) in `gcmp2` at the v2
1836 maximum: the host row scratch `gg.om` `ggfs` held 1024 rows, indexed by FFN unit j < F. grep the
1837 `global … f64 N` arrays for the old cap before opening a window. The v2 model (P 15,833,472) then
1838 trained 30000 steps on rung 6's data, seed and schedule to a chip `geval` of 1.254741 nats against
1839 1.338156 (EXERCISED, non-quiet; `evidence/OMEGALLM/gpu-r7/`); the CPU `eval` of that checkpoint
1840 printed the same `E 30000 2243 1254741 468077` (`gpu-r7/run/eval30000.txt`, `5bd9993`, 15,371 s
1841 on one core). An init-loss bound written without
1842 a derivation (v2 init within 0.05 nats of ln V, then of the v1 init) failed twice while the Python
1843 referee reproduced the product's init loss exactly: the contract init (uniform, sd 0.02) does not
1844 scale with D, so a wider model starts further above ln V. Derive such bounds or check against the
1845 referee instead.
1846- A BF16 tensor-core path can be added beside the f32 kernels without touching them. aien-train
1847 [#58](https://github.com/aien-dev/aien-train/pull/58) (`docs/omegallm/CONTRACT-BF16.md`, at
1848 `a82fc1a`) puts ten `gkgemmb` kernels in slots 27-36 (64x64 tile per 128-thread block, K tile 32,
1849 two 8192-byte shared buffers, `HMMA.16816.F32.BF16` with f32 accumulation, the f32 epilogues
1850 including fused 1 and 2). Operands stay f32 in memory and are rounded RNE by
1851 `F2FP.BF16.F32.PACK_AB` while staged into shared memory; master weights, Adam and checkpoints do
1852 not change, and `geval` keeps the f32 kernels, so the held-out metric is the same measure. It is
1853 opt-in (`gtrainb`/`gprofb`, `gkbf 1`). Every slot outside 27-36 (f32 ids 0-26 and 37-63) keeps its
1854 code and register bytes and the AArch64
1855 CPU build is byte-identical, so every f32 receipt still stands. Gates: `gbfrag` (exit 50) is exact
1856 per kernel on fixed data with NaN in every word the kernel must not read, both operand roles, and
1857 long-K cases; `gbcmp` (48) samples every BF16 launch of a gradient pass against an f64 sum over the
1858 bf16-rounded operands with bound (kn·2^-23 + 2^-22)·(|α|·Σ|a·b| + |old C|); `gbcmp2` (49) is
1859 `gcmp2` with the loose heuristic tolb = n_c·(2u + u²), u = 2^-8, n_c = 10L + 3 (0.6497 at L 8),
1860 which catches gross failures only. Put the rounding in the reference: then the gate checks the
1861 stated numerics, and bf16-vs-f32 distance is a separate, pre-registered training comparison. At
1862 B 64 (kn 16384) `gbcmp` is blind to one wrong K tile, so long K loops need `gbfrag`'s exact
1863 long-K cases (mutant o, one K tile short, is invisible at k = 32 because the K loop is a
1864 do-while). Mutants l (lane g / g^1 A rows swapped in the LDS layout), o and v (F2FP toward zero)
1865 are caught by `gbfrag` and `gbcmp`; mutant u (reference skips the rounding) is caught by
1866 `gbfrag`, while `gbcmp` only reports it, since per-sample RNE error can sit inside the f32 bound.
1867 Mutant n (`gb.om` `OMUTN`: the host overwrites one C padding word after each short case's launch,
1868 no kernel change) is the negative control of `gbfrag`'s padding check, the only check that can see
1869 it; in the v3-g1 window (aien-train #60 at `b92c96b`, `evidence/OMEGALLM/v3/chip-g1/REPORT.txt`)
1870 the product printed `GFS 0` and mutant n failed with rc 50, `GFS 26`.
1871 Window bf-t1 (EXERCISED, non-quiet): `E 2000 2243 1749889` against
1872 rung 7's f32 1756935 (bound 1765719), the 250→2000 leg 1.18117x faster (367.57 s vs 434.16 s), median
1873 GEMM wait 135.3 vs 176.6 ms/step; BF16 GEMMs reached 11.6-22.4 TFLOP/s against 118.81 measured
1874 HMMA, and 54 ms/step of non-GEMM wait plus the synchronous launch round trip now dominate. It
1875 relaxes the bitwise f64-CPU gate on the GEMM path. Drake adopted it for training on 2026-11-03
1876 (CONTRACT-BF16 section 7): long runs use `gtrainb`, every f32 command keeps its behaviour, `geval`
1877 stays f32, and the CPU `eval` of a final checkpoint must still print the chip's line. Adoption is
1878 not a quality claim; the first long BF16 run carries its own prereg.
1879- Rung 8 (aien-train [#59](https://github.com/aien-dev/aien-train/pull/59), stacked on #57,
1880 `evidence/OMEGALLM/gpu-r8/`) changes only the schedule: rung 7's binary, seed, data and batch with
1881 init TOTAL 60000 (`cmp -l` against rung 7's ckL0: bytes 81-82 only). Chip `geval`
1882 `E 60000 2243 1206290 450002`, 1.206290 nats against rung 7's 1.254741 (−3.86%), the curve
1883 strictly decreasing over 22 points, summed `gtrainf` wall 14,688-14,864 s for 250→60000
1884 (0.24471 s/step on undisturbed legs, non-quiet). EXERCISED; the CPU `eval` of ck60000 (P4) printed
1885 the same E line (`gpu-r8/run/eval60000.txt`, `8915b46`). At step 30000 rung 8 was 30,366 µnats above rung 7's final value, because its
1886 learning rate there is still 0.5508 of peak: comparing intermediate steps across different
1887 schedules says nothing, so the prereg only compares final values. Two infrastructure events, both
1888 disclosed and counted in the wall sum: a full root disk (`gtrainf` rc 70 on the checkpoint write;
1889 `ck.bin.tmp` plus rename left `ck.bin` intact), and an agent session ending that killed a leg
1890 mid-window. Launch long drivers with `setsid nohup` so they do not belong to the agent session;
1891 batches derive from (seed, step), so resuming from the last checkpoint trains the same steps.
1892- Rung 9 (aien-train [#61](https://github.com/aien-dev/aien-train/pull/61), stacked on #58,
1893 `evidence/OMEGALLM/gpu-r9/`) is the first long BF16 run after adoption. It replays rung 7 step for
1894 step with `gtrainb` (same ckL0, data, seed, schedule and legs; binary 54fb8233…). Chip `geval`
1895 `E 30000 2243 1251860 467002`, against rung 7's f32 1254741 (−2,881 µnats, −0.230%), and the
1896 pre-registered bound was ≤ 1261014 (+0.5%). BF16 sits 0.14-0.81% below f32 at all 12 shared
1897 steps. With one seed per arm that is no regression, not a demonstrated gain. The CPU `eval` of
1898 ck30000 printed the same E line. Summed `gtrainb` wall for 250→30000 was 5,740.26 s
1899 (0.19295 s/step, 1.2387x rung 7, non-quiet). ck2000 and E 2000 reproduced bf-t1 byte for byte, so
1900 `gtrainb` is deterministic across windows on one chip. EXERCISED on one GB10.
1901- Rung 10 (aien-train [#62](https://github.com/aien-dev/aien-train/pull/62), stacked on #58,
1902 `evidence/OMEGALLM/gpu-r10/`) replays rung 8's 60000-step schedule with `gtrainb` (same ckL0
1903 e02c6234…, data, seed and legs; binary 54fb8233…). Chip `geval` `E 60000 2243 1204466 449322`,
1904 against rung 8's f32 1206290 (−1,824 µnats, −0.151%); the pre-registered bound was ≤ 1212321
1905 (+0.5%). BF16 sits 0.05-0.76% below f32 at all 22 shared steps, and 0.09-0.16% over
1906 30000→60000, so the gap does not widen with twice the steps. The CPU `eval` of ck60000 printed the
1907 same E line. Summed `gtrainb` wall for 250→60000 was 11,478.56 s (0.192110 s/step, 1.2738x
1908 rung 8's undisturbed rate, non-quiet). Hazard seen here: a run script written without the
1909 execute bit makes `spark-window` return leg rc 126 ("Permission denied") with no training done;
1910 `chmod +x` the leg script before the first window (its sha256 is unaffected). EXERCISED on one GB10.
1911- v3 (aien-train [#60](https://github.com/aien-dev/aien-train/pull/60) at `b92c96b`, stacked on
1912 #57 with #58 merged in; `docs/omegallm/CONTRACT-V3.md`) raises the L maximum from 8 to 16 at the
1913 v2 width (P 29,995,392) by moving parameters, gradients and activations into banked storage while
1914 every sum keeps its order, so v0-v2 commands, files and outputs keep their bytes. Test the bank
1915 boundaries at a small shape by shrinking the bank-A capacities (variant bx: `OWC 8400`, `OGC 5000`,
1916 `OAC 12344`, so `256 8 16 2 32 4` crosses every bank) and comparing checkpoint, T lines, eval and
1917 sample against the normal build; mutant y (bx plus `OMUTY 0`: `ostw` stages the first bank-B layer
1918 for every layer) must fail all four. Two branches that each add an `OMUTV` collide when merged
1919 (omc error 10, a duplicate name): v3's mutant was renamed `OMUTY`/`--mutant y`, and receipts that
1920 predate the rename keep the file name `ollm-mut-v`. Keep every `const OMUT*` unique across
1921 branches. Chip gates F1-F8, L1-L4 and B1-B6 ran pre-registered in window v3-g1 (2026-11-04) and
1922 all held, every gated mutant failing as predicted (`evidence/OMEGALLM/v3/chip-g1/REPORT.txt`).
1923 v3 is not trained yet: at aien-train main `56cc8870` `evidence/OMEGALLM/v3/` holds the host
1924 checks and `chip-g1` only, no training run.
1925 EXERCISED on one GB10, non-quiet.
1926
1927## 10. Wire serialization (only what the pin defines)
1928
1929- There is no byte-layout type. Encode and decode integers with shifts and masks into `uchar`
1930 arrays. Little-endian `uint` store (as in `examples/fnv1a32.om`):
1931 `put b 0 uchar and h 255`, `put b 1 uchar and shr h 8 255`, ... `shr h 24`.
1932- Little-endian `uint` load: `or or or uint get b 0 shl uint get b 1 8 shl uint get b 2 16 shl uint get b 3 24`.
1933 Split it over lines if it hits error 12.
1934- Signed decode without relying on integer `bitcast`: with `u` the loaded `uint`, write
1935 `v = long u`, then `if ge u 2147483648` / `v = sub v 4294967296` / `end`, then use `int v`
1936 (`v` is assigned before the block so it survives the block's `end`).
1937- Formats the pin itself defines: packed lists are a little-endian `u16` count (1..64) then records
1938 of little-endian `u16` length plus bytes, at most 4096 bytes, no padding or terminator
1939 ([#L724-L730](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OMEGESE.md#L724-L730)); `pipefds` writes two
1940 little-endian 32-bit descriptors; `fstat`/`stat` write the 128-byte Linux ARM64 stat structure;
1941 `waitpid` writes a 4-byte status. Any other protocol layout needs its own spec citation and test
1942 vectors.
1943 At the pin `9920aab1` (OMEGESE lines 1050-1056) a packed list with embedded zero bytes, a truncated
1944 record, extra trailing bytes or a count outside 1..64 traps 3; the first `execprog` record (path and
1945 argument zero) must be nonempty, and `renames` needs exactly two nonempty records. These refusals are
1946 gated by `seed/qualification/security673/packets.cases` (see `omega-harness`, seed tools section).
1947- IR mode and floats, observed 2026-11-05 with omc `be8c5130…`: a float type in an `ir` function
1948 signature (`fn fa a f64 b f64 to f64`) is `omc: line 2: error 9`, and a float word in the body
1949 (`x = f64 a`) is `omc: line 3: error 3` (OMEGESE says error 3 only). No producer of float IR exists, so
1950 float backends (`seed/stablehlo` wire v7, `irnki f32`) use hand-written fixtures or retyped u32 lanes.
1951
1952## 11. Compiler errors (exit code = error number, stderr `omc: line N: error K`)
1953
1954The single source of the codes on main `91c83438d` (#965) is the registry
1955[`seed/omc/error-codes.reg`](https://github.com/aien-dev/omega-mv/blob/91c83438daec0bdb88bf5c077cae10f3d15d365d/seed/omc/error-codes.reg)
1956(issue #797). `seed/omc/gate15.sh` ([#L1-L9](https://github.com/aien-dev/omega-mv/blob/91c83438daec0bdb88bf5c077cae10f3d15d365d/seed/omc/gate15.sh#L1-L9),
1957cases [#L45-L72](https://github.com/aien-dev/omega-mv/blob/91c83438daec0bdb88bf5c077cae10f3d15d365d/seed/omc/gate15.sh#L45-L72))
1958holds one minimal program per code for codes 1..25 and 27..30 (26 has no emitting site), each
1959checked for its exact exit code and `omc: line L: error C` line, and runs `seed/omc/codereg.om`,
1960which fails when an emitting site in `omc.om` has no registry row, an emitted row has no site, the
1961table in OMEGESE section 9.14 ([#L811-L855](https://github.com/aien-dev/omega-mv/blob/91c83438daec0bdb88bf5c077cae10f3d15d365d/docs/one_layer/OMEGESE.md#L811-L855))
1962differs from the registry, or a case did not refuse as listed. irwasm exit codes 20..28 are a
1963separate namespace in the same registry (OMEGESE section 11.1). The message format is `fn fail`
1964([omc.om#L122-L148](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/seed/omc/omc.om#L122-L148) at `55f9b0af`;
1965[omc.om#L292-L322](https://github.com/aien-dev/omega-mv/blob/e5b32567a7aff3ce594e3254a622a846a6cd190b/seed/omc/omc.om#L292-L322) at `e5b32567`;
1966[omc.om#L324-L356](https://github.com/aien-dev/omega-mv/blob/91c83438daec0bdb88bf5c077cae10f3d15d365d/seed/omc/omc.om#L324-L356) at `91c83438`,
1967`fn fail` on the first line and `exit int code`, the only non-zero `exit` in the compiler, on the last).
1968
1969| Code | Meaning | Code | Meaning |
1970|---|---|---|---|
1971| 1, 2 | compiler input / output (stdin a directory: 1; stdout `/dev/full`: 2; both observed) | 13 | non-function name over 8 characters (over 63 once #837 is pinned) |
1972| 3 | unknown name or field | 14 | capacity at `91b3c932`: 8192 names, 4096 functions, 512 nested blocks, 1024 nesting depth, 8 MiB input/output |
1973| 4 | line ends too early | 15 | missing `end` |
1974| 5 | extra words on the line | 16 | syntax / unknown word |
1975| 6 | malformed number | 17 | line after `ret`/`break`/`continue`/`trap`/`exit` |
1976| 7 | type mismatch | 18 | missing `ret` |
1977| 8 | number out of range | 19 | global passed, or the same array twice in one call |
1978| 9 | word in a disallowed place | 20 | write to a view or text |
1979| 10 | duplicate name | 21 | constant index out of range |
1980| 11 | ambiguous bare number | 22 | bad text literal |
1981| 12 | register pool exhausted | 23 | size capacity |
1982| 24 | AArch64 branch displacement out of range | 28 | abstract type: `seal` outside its constructor, or an unsupported `holds` |
1983| 25 | unknown target, an AArch64-only path on another target, or an x86efi refusal (omega-mv#1015: bare unit, Linux host word, `efi` OP literal outside 0..13, 0..14 with #1022) | 29 | external `layout` out of bounds or misplaced |
1984| 26 | unused (no emitting site) | 30 | contract syntax misplaced or not supported here (IR mode included) |
1985| 27 | `fresh` element read before it is definitely written, or a fresh array passed on | | |
1986
1987A refused compile may still leave bytes on stdout. Never run output from a non-zero compile.
1988Capacity boundaries are gated in `seed/omc/gate12.sh` (8192 globals accepted, 8193 refused;
19894095 helper functions plus `main` accepted, 4096 plus `main` refused).
1990
1991OM-2 units add or extend codes ([OMEGESE 9.13](https://github.com/aien-dev/omega-mv/blob/19f014f2178ca9cd3473728fe00a475a2398c409/docs/one_layer/OMEGESE.md#L624),
1992[`spec/omegese-om2.md` section 8](https://github.com/aien-dev/omega-mv/blob/19f014f2178ca9cd3473728fe00a475a2398c409/spec/omegese-om2.md#L225)):
199327 initialization (`fresh`), 28 constructor discipline (`seal`, `holds`), 29 external `layout`;
199414 also covers expansion fuel (`obligation=growth`) and a 33rd `export`; 24 keeps its OM-1 meaning
1995(branch displacement). Merged contracts (#807 through #768) add error **30**, diagnostic
1996`obligation=contract` (section 11a).
1997
1998**IR mode refuses contract clause lines with error 30** (main `91c83438d`, #965, #791; OMEGESE
1999section 11 [#L1097-L1102](https://github.com/aien-dev/omega-mv/blob/91c83438daec0bdb88bf5c077cae10f3d15d365d/docs/one_layer/OMEGESE.md#L1097-L1102)).
2000Contracts are native only; an IR unit that writes one is refused rather than misread. Only the clause
2001form is refused: a contract word followed by `=` (`ensures = ulong 1`) still assigns a local of that
2002name. Observed 2026-10-31 with omc `2aec185d…`, control omc `7a8b84fc…` (main before #965):
2003`ir` / `fn f x uint to uint` / `requires lt x 10` / `ret x` / `end` is `omc: line 3: error 30`,
2004exit 30 (control: exit 0, 59 bytes of IR, the clause read as a local named `requires`); the same
2005with `ensures lt x 10`: error 30 (control: exit 0, 59 bytes); with `invariant lt x 10`: error 30
2006(control: `omc: line 3: error 13`, a 9-byte name). `ensures = ulong 1` / `ret ensures` compiles with
2007exit 0 to the same 55 bytes of IR under both compilers. Native units are unaffected: with
2008`2aec185d`, as with `7a8b84fc`, an OM-1 unit (no `om2` first line) with `requires ge x 0`, called
2009with -5, still compiles and exits 6 (the contract is not checked), and the same unit with `om2`
2010first exits 109 (trap 9).
2011
2012Limits met while porting CUDApp's encoder and cubin writer (aien-dev/CUDApp#143, merged
2013`2fab72fde0`), rechecked with omega-mv main `bf54b19f` (`seed/out/omc` sha256 `62775d2a...`):
2014an array parameter of length 16777216 compiles and 16777217 is error 23, so one `.om` buffer holds at
2015most 16 MiB of `uchar`; `text` inside a function-mode unit is error 9 (both OBSERVED, identical on
2016omc `2c824805`). AUTHOR-CLAIMED, not rechecked: `global` inside a function-mode unit is error 9, and
2017omega-bridge `431fff0a` `native c` exits 110 when an entry's array length is written as a `const`
2018name (write the literal in the entry signature).
2019
2020One minimal refusal per code is in `examples/errNN_*.om` of this repository, with its exact stderr
2021line in `errNN_*.expect`, and `examples/gate.sh` runs them: codes 1..23 and 27..30, observed at
2022`e5b32567`, plus code 25 (`err25_target`, added 2026-10-31 at `91c83438`). Code 24 needs a
2023generated program of more than 1 MiB inside one loop (recipe in `writing-omega` section 11;
2024observed at `e5b32567` and rerun at `91c83438`, section 0). 25 and 26 were unused at `e5b32567`;
2025since `bf54b19f` the target checks emit 25 (section 0, rerun at `91c83438`).
2026
2027## 11a. Executable contracts (merged #807 through #768)
2028
2029Source: OMEGESE section 12 and `seed/omc/contracts/` at main
2030`91b3c9326919faf1491e29ae9276929e8349b8c7`, compiler `189ada82...3b54` (section 0).
2031The committed fixtures below were exercised by the batch host qualification:
2032`evidence/BATCH-189ada82/qualification.log` records all 44 contract cases and the two mutants.
2033Older compiler `befb8199` does not implement these contextual contract words.
2034
2035- **Opt-in and policy.** Only OM-2 units. The first non-`note` line selects the build policy:
2036 `om2` or `om2 debug` checks contracts at run time; `om2 release` erases their evaluation after the
2037 same syntax, scope, type and purity checks; `om2 diag debug` / `om2 diag release` add diagnostic
2038 records; `om2 fmt` keeps its canonical output and still checks contracts. No environment variable
2039 selects the policy. The words are contextual: OM-1 units and the keyword table are unchanged.
2040 Warning: an OM-1 unit that contains a contract line still compiles, and the contract never runs.
2041 `fn step x long to long` / `requires ge x 0` / `ret add x 1` called with -5 compiles with no
2042 diagnostic and returns -4; adding `om2` as the first line makes the same call trap 9 (exit 109),
2043 and with `om2` a call with 5 passes the contract and returns 6. Observed with omc 734f0a39,
2044 2c824805, the guide pin 2aec185d (omega-mv `91c83438`) and omc e4d84bc3 (omega-mv main
2045 `d39450a2`). Every unit that relies on a contract must start with `om2`.
2046- **Where clauses go.** `requires BOOL` and `ensures BOOL` form a function's prefix, before its first
2047 executable statement (blank and `note` lines may separate them; at most 64). `invariant BOOL` forms
2048 the prefix of a `while` or `for` body (at most 64 per loop). Anywhere else is error 30.
2049- **When they run.** Preconditions in order on entry, inline calls included. Postconditions in order
2050 on every normal return (`ret`, void fallthrough, inline return), never on `exit` or a trap; the
2051 return value is computed once and `result` (value functions only) names it. A parameter in a
2052 postcondition is its value at return: there is no `old`. Invariants run at the loop head before
2053 the condition: on entry even for zero trips, on every backedge, after `continue` (a `for` increments
2054 first) and before the final false test; `break` skips the next check.
2055- **What a predicate may use.** Type `bool`; integer and bool literals and names, integer and bool
2056 operations, checked conversions, grouping, `len`, ordinary checked array, struct and layout reads.
2057 User calls (inline too), floats, abstract values, host and device words, allocation, writes and
2058 ownership words are error 30, recursively, in release as well. `and`/`or` stay eager, so they do
2059 not guard a bounds check.
2060- **Failure.** False `requires` is trap 9 (exit 109); false `ensures` or `invariant` is trap 10 (exit
2061 110); function-mode callers get the same codes through `OscRt.trap`. A trap raised while evaluating
2062 a predicate keeps its own code (the `arithmetictrap` fixture expects 102). Note that 10 is also the
2063 OM-2 `holds` check trap, so the trap site, not the code, identifies the failing clause.
2064- **Erasure.** Only a predicate that folds to true without trapping is proved and erased in debug.
2065 Release erases evaluation by policy, never uses a predicate as an optimizer assumption, and never
2066 removes the body's own arithmetic, bounds, initialization, stack or loop-fuel checks. The fixtures
2067 require byte-identical output for `release.om` against `erased.om` and for `proved.om` against
2068 `plain.om`, not just equal exit statuses.
2069- **Diagnostics.** With `om2 diag` (debug) or `om2 diag release`, every contract site gets a
2070 `omc-check 1 kept|erased line=N rule=RULE kind=KIND` record on stderr: rule `runtime` for a kept
2071 check, `constant-true` for a proved one, `release` for policy erasure; kind `requires`, `ensures` or
2072 `invariant`. Postconditions are reported at their return sites. Error 30 carries
2073 `obligation=contract` in the `omc-diag` record. Fixture expectations: `diagproof.om`
2074 (`requires eq add uint 1 2 3`) gives `omc-check 1 erased line=3 rule=constant-true kind=requires`;
2075 `diagrelease.om` (`om2 diag release`, `requires false`) gives
2076 `omc-check 1 erased line=3 rule=release kind=requires`.
2077
2078`seed/omc/contracts/ok.om` (expected exit 0):
2079
2080```
2081om2
2082fn step x uint to uint
2083requires lt x 10
2084ensures eq result add x 1
2085ret add x 1
2086end
2087fn main to int
2088i = uint 0
2089while lt i 3
2090invariant le i 3
2091i = step i
2092end
2093ret int sub i 3
2094end
2095```
2096
2097`seed/omc/contracts/requires.om` (expected exit 109; the precondition fails on entry):
2098
2099```
2100om2 debug
2101fn f x int to int
2102requires gt x 0
2103ret x
2104end
2105fn main to int
2106ret f 0
2107end
2108```
2109
2110`seed/omc/contracts/release.om` (expected exit 0, and byte-identical to `erased.om`, which is the
2111same program without the three contract lines and with `om2` in place of `om2 release`):
2112
2113```
2114om2 release
2115fn f x int to int
2116requires gt x 0
2117ensures eq result add x 1
2118ret x
2119end
2120fn main to int
2121while false
2122invariant false
2123end
2124ret f 0
2125end
2126```
2127
2128Refusals pinned by `contracts.cases`: a user call, host word, float (also through a float constant
2129or float array), misplaced clause, late `invariant`, `result` in a `requires` or in a void function
2130are error 30; a non-bool predicate is 7; a name declared later in the body is 3; reading an
2131unwritten `fresh` element is 27. The cases run through the existing OM-2 conductor
2132`seed/qualification/om2/gate.om`. `mutant.cases` builds two broken compilers: one with enforcement
2133disabled (`requires.om` must still exit 109) and one whose prover treats any constant predicate as
2134proved (`false.om`, `requires false`, must exit 109). Both run to exit 0, so the suite must end
2135`OM2GATE FAIL cases=2 pass=0 fail=2 invalid=0 not_run=0` (conductor exit 1), which
2136`seed/host/check.sh` requires with the exact `VERDICT` lines. A passing mutant suite would mean the
2137check proves nothing.
2138
2139## 11b. Composed units and traps that compile
2140
2141Omega has no imports: a multi-file program is its units concatenated into one input
2142(`cat a.om b.om main.om | omc`). These rules bite there, and several compile without a word.
2143Observed 2026-11-04, Linux AArch64 host only, with the pinned omc `be8c5130…` (omega-mv
2144`9920aab1`); the first three are gated as `examples/pitfall_*.om` in this skill. Source citations
2145are `seed/omc/omc.om` at `9920aab1`.
2146
2147- **There is no `elif`.** A statement `NAME VALUE` is an assignment; the `=` is optional
2148 (`s_assign`, [omc.om#L8197-L8207](https://github.com/aien-dev/omega-mv/blob/9920aab1413983c2867d02d75b2276341595adb8/seed/omc/omc.om#L8197-L8207)).
2149 So `elif eq k 1` (or `elsif`, `elseif`) silently makes a local bool and the line after it runs
2150 every time: `zz ulong 9` / `ret int zz` exits 9, and `examples/pitfall_elif.om` returns 20 where
2151 10 is meant (compile exit 0, no diagnostic; same with omega-mv main omc `b4f45121`). Write
2152 separate `if ... ret ... end` blocks or nest the test inside `else`; both forms of the same
2153 function return 10, 20 and 0 for k = 0, 1, 2. A refusal (error 16) is omega-mv
2154 [#858](https://github.com/aien-dev/omega-mv/pull/858), an open draft, not on main at `d3d1b1bc`.
2155- **One namespace for the whole input.** Globals, texts, consts, structs and functions of every unit
2156 are visible in every other one. A local named like another unit's global array is error 7, not
2157 error 10 (`examples/pitfall_shared_name.om`, `omc: line 8: error 7`; renamed, exit 7); a local
2158 named like another unit's value function, `const` or `text` is also error 7 (a function name
2159 parses as a call). Two units that each define `fn twice` give `omc: line 4: error 10`; a second
2160 `global sh`, `const` or `text` of the same name is error 10 on its line, a second `struct P`
2161 error 9.
2162 Prefix every global and helper with the unit's short name. Modules are roadmap RM6
2163 ([omega-mv#795](https://github.com/aien-dev/omega-mv/issues/795)), not built.
2164- **Line numbers count the composed input.** `omc: line N` and every `omc-check`/`omc-site` record
2165 give N in the concatenated stream: composed from a 4-line unit (`global sh` and `seta`), a 4-line
2166 unit with the clashing local, and `main`, the clash is `omc: line 6: error 7`, line 2 of the
2167 second unit. Keep the per-unit `wc -l` or run `grep -n . composed.om` to map back.
2168- **The `om2` line must be the first non-`note` line of the composed input.** It sets the mode of
2169 the whole input. `om2 diag debug` as a one-line first unit, then a 3-line OM-1 library, then a
2170 unit with `requires gt x 0` compiles, prints `omc-check 1 kept line=6 rule=runtime kind=requires`
2171 and exits 4 as written; with a `note` line in front it prints `line=7`; the same header placed
2172 after the library is `omc: line 4: error 16`.
2173- **Four global `get` terms in one `or` chain exhaust the registers.** `or or or ne get hdr 0 1 …`
2174 over a global is error 12 (`examples/pitfall_or_global.om`, `omc: line 5: error 12`; also with
2175 `k`-relative indices). Three terms, the same four on a local `new` array (exit 9), or
2176 `a = or …` / `b = or …` / `if or a b` (exit 9) compile.
2177- **A trap names its code and function, never its line.** Each trap site records only its branch
2178 and code; `finish` emits one stub per code used in the function and patches every site of that
2179 code to it ([#L2939-L2952](https://github.com/aien-dev/omega-mv/blob/9920aab1413983c2867d02d75b2276341595adb8/seed/omc/omc.om#L2939-L2952),
2180 [#L9852-L9898](https://github.com/aien-dev/omega-mv/blob/9920aab1413983c2867d02d75b2276341595adb8/seed/omc/omc.om#L9852-L9898)).
2181 A function with `get ga i` (4 bytes) and `get gb i` (8 bytes) on two paths exits 103 with empty
2182 stderr for index 9 on either path (indices 3 and 7 exit 0). When the site matters, test the range
2183 yourself and give each site its own exit below 100 (`if ge i len ga` / `exit 21`): the same
2184 inputs then exit 21 and 22. Bounds are per array, so an index from one buffer's offset space used
2185 on another traps 3 only once the data grows past the smaller array.
2186- **The output has no symbols.** `file` reports `statically linked, no section header`,
2187 `readelf -S` `There are no sections in this file.`, `nm` `no symbols`; the function name `pick`
2188 occurs 0 times in the binary while a `text` literal `pickmark` occurs once. perf and gdb cannot
2189 name functions; profile by timing separate programs or entry points. A perf map from omc would be
2190 a compiler change.
2191- **Rechecked at this pin:** `le` as a local or function name is error 16 (`lte` compiles, exit 4);
2192 `line` and `out` are *not* reserved (`line = ulong 3` / `ret int line` exits 3); `getppid` returns
2193 the real parent (`sh -c 'echo $$ | ./ppid'` exit 0, a wrong pid exit 1); `\r` in a `text` is
2194 `omc: line 1: error 22`; `global g uchar 16777217` is error 23 and 16777216 compiles; a global
2195 argument is error 19 (copy into a local: exit 6). Eager `and`/`or` is section 3, the 16-register
2196 pool section 6.
2197- **Mutation runners:** write each mutant to a path that is not the build's own output `.om`;
2198 otherwise the runner overwrites one with the other and tests the wrong file.
2199
2200## 12. Before any claim
2201
22021. Inspect the compiler, not memory. Find the rule in `omc.om` or a gate fixture at the pinned commit
2203 and cite file and line. Skills, older notes and this file can be stale.
22042. Compile with the pinned `omc` and run. Report what was observed, labelled host-only.
22053. Add a negative control: change an expected value or remove a guard and confirm the exit status
2206 changes.
22074. No silent fallback. If `omc` cannot express something, do not write it in C, Rust, shell or
2208 Python and call the result Omega. Say exactly which word or capacity is missing.
22095. Missing is not impossible, and it is not a stopping point. Drake's standing rule (2026-10-26):
2210 "If .om doesn't have a feature, you need to make that feature." Build it in Omega as an omega-mv
2211 pull request, coordinated with whoever owns the compiler lane at the time. The PR names the
2212 hardware or OS need, the word and its types, refusal codes and a new error code if one is needed,
2213 gates with a negative control, parity against an independent oracle, and the matching update to
2214 this skill. Host code is a last resort only. When it is used, record it with its Omega successor
2215 and the omega-mv PR that will replace it. Known decision-blocked gaps still need Drake's decision
2216 before they are built (roadmap RM4 heap, RM6 imports;
2217 [omega-mv#793](https://github.com/aien-dev/omega-mv/issues/793), [#795](https://github.com/aien-dev/omega-mv/issues/795)).
2218 They are listed at `55f9b0af` ([OM_COMPLETION.md#L62-L72](https://github.com/aien-dev/omega-mv/blob/55f9b0af47de70a3d06357985cf99ae3e45c016f/docs/one_layer/OM_COMPLETION.md#L62-L72)),
2219 unchanged at main `bf54b19f` ([#L65-L73](https://github.com/aien-dev/omega-mv/blob/bf54b19fa590e8ae925c0e80815516dbf41e7326/docs/one_layer/OM_COMPLETION.md#L65-L73)):
2220 packed structs (FR-2), imports (FR-3, units concatenate), threads/atomics (FR-6), C ABI/shared
2221 objects (FR-7), heap (decision 24). x86-64 (FR-9) is no longer missing: since main `bf54b19f`
2222 (#923, 2026-10-28) `target x86linux` selects an x86-64 Linux static-ELF backend in
2223 `seed/omc/omc.om`. Its status there is DRAFT, x86 execution is EMULATED (QEMU) only and native
2224 x86 qualification is NOT_RUN (`docs/X86-LINUX.md` lines 3 and 286).
22256. Documents can disagree with the code; trust the code and name the conflict. At main `91c83438d`
2226 (rechecked 2026-10-31) the earlier conflicts are resolved: OM_COMPLETION FR-5
2227 ([#L68](https://github.com/aien-dev/omega-mv/blob/91c83438daec0bdb88bf5c077cae10f3d15d365d/docs/one_layer/OM_COMPLETION.md#L68))
2228 lists `devctl devcall uvmctl mapnew ... mapbind` (ids 166..177 in `seed/omc/genkw.awk`) as
2229 implemented for AArch64 program mode (omega-mv #944, merged by train r5 #985 as `613765d2b`; it
2230 said "absent" through `4376c2112`), and `seed/host/MAPPING.md`
2231 ([#L68-L70](https://github.com/aien-dev/omega-mv/blob/91c83438daec0bdb88bf5c077cae10f3d15d365d/seed/host/MAPPING.md#L68-L70))
2232 says the device words are on `main` (train r2 #972, `f5c9bd89a`). GPU launch and model execution
2233 through them are not qualified. The FR-9 row
2234 ([#L72](https://github.com/aien-dev/omega-mv/blob/91c83438daec0bdb88bf5c077cae10f3d15d365d/docs/one_layer/OM_COMPLETION.md#L72))
2235 and `docs/X86-LINUX.md` line 450 now cite the same EMULATED differential at `62d1d0d6` (15182 PASS,
2236 0 FAIL, 2 NOT_RUN, 222 EXCLUDED, aggregate FAIL); native x86 stays NOT_RUN.
22377. `devctl` request set at the pin (unchanged at omega-mv main `d3d1b1bc7`, rechecked 2026-11-04 in
2238 `hdevctl`, `seed/omc/omc.om`): FIONREAD (21531) and encoded read/write NVRM `'F'` requests only;
2239 any DRM request is error 9. PENDING, not merged: aien-dev/omega-mv#899 (head `15fb0b88`, open,
2240 its body says draft pending review, conflicting with main on 2026-11-04) adds an explicit list of
2241 eleven accel/ethosu requests (the ten `DRM_IOCTL_ETHOSU_*` of Linux v7.3 plus
2242 `DRM_IOCTL_GEM_CLOSE`), with the exact-size check unchanged. Until it merges and the pin moves,
2243 code that issues those requests needs that branch's `omc` and must say so.
2244
2245## 13. Examples
2246
2247- `examples/fnv1a32.om`: reads all of stdin with a partial-read loop, hashes it (FNV-1a 32, unsigned
2248 wrap), writes 4 little-endian bytes with a partial-write loop, distinct exit codes for each failure.
2249- `examples/trap_narrow.om`: a masked narrowing succeeds, an unmasked one traps 5 (exit 105).
2250- `examples/pitfall_elif.om`, `pitfall_shared_name.om`, `pitfall_or_global.om`: the first three
2251 traps of section 11b (exit 20, `omc: line 8: error 7`, `omc: line 5: error 12`).
2252
2253Each carries `.expect` (and `fnv1a32` also `.stdin` `abc` and the 4 expected bytes in `.stdout`) and
2254runs in [`examples/gate.sh`](../../examples/gate.sh) with the 105 programs in the repository's
2255`examples/` directory; section 0 records the `e5b32567` rerun of every row below. The portable guide
2256for writing a first program is [`skills/writing-omega/SKILL.md`](../writing-omega/SKILL.md).
2257
2258Observed on 2026-10-25, Linux AArch64 host only, compiler sha256 `734f0a39...6b61`:
2259
2260| Check | Observed |
2261|---|---|
2262| `fnv1a32.om` compile | exit 0, empty stderr |
2263| input `abc`, `a`, empty, 65535 zero bytes | `0be9471a`, `2c290ce4`, `c59d1c81`, `47dac371`; each exit 0 and equal to an independent Python FNV-1a computation |
2264| 65536 zero bytes | exit 2, no output |
2265| prime changed to `16777617` (negative control) | `abc` gives `55bedcf5`, differing from the expected hash |
2266| `trap_narrow.om` | compile exit 0, run exit 105 |
2267| unmasked line removed | run exit 44 |
2268| refusal below | compile exit 7, stderr `omc: line 3: error 7` |
2269
2270Refusal to try inline (expected exit 7, the same class as gate15 `e7_type_mismatch`):
2271
2272```
2273global b uchar 1
2274fn main to int
2275x = add get b 0 uint 1
2276ret int x
2277end
2278```
2279
2280- Numeric work in or behind an `.om` unit (limits, sizes, masks, checksums, expected values, tolerances) is computed with Wolfram and quoted with the query, never by hand: see `skills/wolfram-math/SKILL.md`.