omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / spec / r10-omega-faculty.md
| 1 | # R10: Omega as a resident realization faculty |
| 2 | |
| 3 | ADR 0016 §43. Gate `R10_CONTINUOUS_OMEGA_PASS`. |
| 4 | |
| 5 | ## Rule |
| 6 | |
| 7 | Omega is not a service. Nothing calls Omega and waits for an answer. |
| 8 | |
| 9 | ``` |
| 10 | world state changes |
| 11 | ↓ |
| 12 | Omega dependencies become ready |
| 13 | ↓ |
| 14 | Omega reaction acts |
| 15 | ↓ |
| 16 | publishes objects/evidence |
| 17 | ↓ |
| 18 | other faculties naturally become ready |
| 19 | ``` |
| 20 | |
| 21 | ## What runs |
| 22 | |
| 23 | Code: `src/runtime/rx_omega.{c,h}`, `src/omega_matvec_quad.{c,h}`. |
| 24 | Test: `tests/runtime/rx_r10_omega.c`, `make test-r10` (AArch64 hosts only). |
| 25 | |
| 26 | The operation is Omega's integer matrix-vector product from M12 |
| 27 | (`omega_matvec`): `y[i] = Σ_j A[i·N+j]·x[j] mod 2^64`, for M ≥ 1 and N ≥ 1. |
| 28 | |
| 29 | | Reaction | Wakes on | Publishes | ADR 0016 object | |
| 30 | |---|---|---|---| |
| 31 | | `workload.matvec.serve` | `request` | `result`, `demand` | production path | |
| 32 | | `omega.watch` | `demand` window field only | `search` | CostEstimate | |
| 33 | | `omega.synthesize.k` | `search` epoch | `candidate[k]` | RealizationCandidate | |
| 34 | | `omega.verify.k` | `candidate[k]` | `verdict[k]` | verification evidence | |
| 35 | | `omega.measure.k` | `verdict[k]` | `measure[k]` | measured cost | |
| 36 | | `omega.select` | every `measure[k]` | `selection` | recorded, eligible | |
| 37 | |
| 38 | Production reads `selection` as an ordinary input on its next request. It does |
| 39 | not wait for it. A regime runs the semantic reference until a selection for |
| 40 | that regime exists. |
| 41 | |
| 42 | - **Hot:** a regime is hot when its calls and its total measured time both |
| 43 | cross the configured threshold. Production publishes the evidence every 16 |
| 44 | calls, so `omega.watch` wakes on fresh evidence, not on every call. A regime |
| 45 | already searched is not searched again. |
| 46 | - **Synthesis:** one reaction per candidate slot. Slots 0–2 are the qualified |
| 47 | M12 emitters, unchanged. Slot 3 is `quad4` (below). Code sits in a |
| 48 | content-addressed store owned by the faculty. World objects carry only the |
| 49 | 32-byte realization identity. An identity may never be rebound to different |
| 50 | bytes. |
| 51 | - **Verification:** |
| 52 | 1. Recompute the identity from the stored bytes. |
| 53 | 2. Run Omega V0 structural verification. |
| 54 | 3. Run a differential check against `omega_matvec_reference` in a forked |
| 55 | child: 87 shapes × 3 inputs (random, edge values, wrap-around). It also |
| 56 | checks guard words past `y`, and that `A` and `x` are not modified. A |
| 57 | crash or hang ends only the child. |
| 58 | 4. Code runs in the world's own process only after its verdict passed, and |
| 59 | only under its full 32-byte identity. |
| 60 | - **Measurement:** best of 7 rounds. The candidate and the incumbent |
| 61 | reference are timed back to back in the same rounds, at the searched regime. |
| 62 | A refused candidate is declined without being run. |
| 63 | - **Selection:** the fastest measured candidate that beats its paired |
| 64 | reference by 5% or more. If none does, the reference is kept and that is |
| 65 | recorded too. |
| 66 | - **Authority:** production and Omega are separate subjects under the native |
| 67 | Aienux authority. Omega can read `demand` but cannot write any production |
| 68 | object. A revoked Omega capability blocks that reaction, and production |
| 69 | carries on. |
| 70 | |
| 71 | ## Findings |
| 72 | |
| 73 | 1. **M12's three emitters never beat the compiled reference on the DGX |
| 74 | Spark.** |
| 75 | - On Cortex-X925 they land between 4% faster and 8% slower than it. |
| 76 | - On Cortex-A725 they are 1.8–2.1× slower. |
| 77 | - Cause: every element load post-increments its base register. Each row |
| 78 | is therefore one serial chain of address updates. |
| 79 | - `omega_matvec_dispatch`'s fixed rule (unroll4 when N > 8) therefore picks |
| 80 | a slower realization on A725 cores. |
| 81 | 2. **`quad4`** is a new Omega emitter. It keeps four independent |
| 82 | accumulators, loads at fixed offsets, and moves each base once per four |
| 83 | elements. Pinned single-thread timings at 64×256, in µs per call: |
| 84 | |
| 85 | | Core | reference | gcc -O3 acc4 | quad4 | |
| 86 | |---|---|---|---| |
| 87 | | X925 | 4.58 | 2.64 | 2.69 | |
| 88 | | A725 | 6.27 | 5.92 | 6.08 | |
| 89 | |
| 90 | `quad4` matches the compiler on both core types. It lives in its own file |
| 91 | so the M12 sources keep the digests recorded in |
| 92 | `evidence/m12_corpus_digests.txt`. |
| 93 | 3. **The best realization depends on the core class.** The R10 test pins |
| 94 | itself to the X925 cores when they exist, and records that in its receipt. |
| 95 | 4. **Engine fix (`rx_world.c`).** |
| 96 | - The bug: an activation invalidated by a change to a read-only input was |
| 97 | never run again, so the stimulus that woke it was dropped. |
| 98 | - R10 hit it when a new selection landed while production was serving a |
| 99 | request. |
| 100 | - Invalidation now re-arms the activation under the same cause. Conflict |
| 101 | limits still apply. |
| 102 | - Regression test: `invalidation_by_read_only_input_reruns` in `test-r3`. |
| 103 | It fails without the fix. |
| 104 | |
| 105 | ## Not claimed / limits |
| 106 | |
| 107 | - One operation, CPU realizations only. No graphics-processor realization |
| 108 | here. |
| 109 | - Candidates come from a fixed emitter family. This is not open-ended search |
| 110 | through `omega_synthesis` or `omega_realize_synth`. |
| 111 | - One `selection` object. Only the most recently searched regime has a |
| 112 | record. Choosing a realization per core class is not implemented. |
| 113 | - The realization store is process memory. It does not survive a restart and |
| 114 | does not go through the R9 generation barrier. |
| 115 | - The sandbox is a forked Linux process, not an Aienux-enforced sandbox. |
| 116 | - The production reaction is labelled `RX_FACULTY_EXTERNAL`. It is not AIEN |
| 117 | (R11). |
| 118 | - The M12 emitters return without writing `y` when N = 0. The reference |
| 119 | writes zeros. N = 0 is outside the declared domain, and verification does |
| 120 | not test it. |
| 121 | - Hosted CI runs on a different AArch64 core. There, a win is recorded, not |
| 122 | required (`R10_ALLOW_NO_WIN=1`, gate `CHAIN_PASS_NO_WIN`). The gate is |
| 123 | claimed only by a clean, candidate-bound run on the DGX Spark. |