interplane.Get Omega
Read in your language

aien-architecture-mv

Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories.

Brought by drakestapleton

branch main Branches Tags History

aien-architecture-mv / docs / milestone-6-spec.md

106 lines · 5203 bytes Raw Blame History Rendered
1# Specification: Milestone 6 — Omega Self-Hosting Compiler (`OMEGA_SELF_HOST`)
2
3```text
4Document ID: SPEC-OMEGA-M6
5Milestone: Milestone 6 (OMEGA_SELF_HOST)
6Classification: Sovereign Machine Canonical Specification
7Target Substrate: Native AArch64 Machine Code Reproducing Compiler from Semantic Graph
8Status: see doctrine/ROADMAP.md (M6 row and the §3 M6 correction note)
9Lineage: SILICON -> ATLAS (M1) -> PHYSICS (M2/M3) -> OMEGA (M4/M5/M6) -> AIEN
10```
11
12> **Correction note (2026-09-30).** This specification describes the intended target. The implementation that passed the M6 gates (`aien-spark/omega` `src/omega_self_host.c`) does not compile $G_C$: the emitted code writes three constant words for $G_S$ and copies its own bytes for $G_C$, so the `C1 == C2 == C3` fixed point holds by self-copy. M6 is not evidence of a self-hosting or general Omega compiler. The historical gate names and receipt are unchanged. Details and sources: `doctrine/ROADMAP.md` §3, M6 correction note.
13
14---
15
16## 1. Executive Summary & Foundational Invariants
17
18Milestone 4 established abstract semantic meaning (`OMEGA_SEMANTICS`) with content-addressed identity (`SEMANTIC_ID`).
19Milestone 5 established direct lowering from pure semantics into native physical machine code (`OMEGA_AARCH64`) without LLVM or GNU `as`.
20
21Milestone 6 specifies the closed-loop reproduction of the realization compiler itself (intended target; as qualified, the implementation proved a self-copy check, see correction note above):
22
23> **OMEGA REPRODUCES ITS MINIMAL REALIZATION COMPILER THROUGH ITS OWN SEMANTIC GRAPH.**
24
25The target architecture reaches self-hosting closure when the compiler is an explicit semantic object $G_C \in \text{OmegaGraph}$ that compiles itself into native machine code, achieving an exact fixed point:
26
27```text
28C0 = temporary reference C implementation
29G_C = OMEGA semantic definition of minimal compiler
30
31C0(G_C)
32 ↓
33 C1 (native AArch64 machine code)
34
35C1(G_C)
36 ↓
37 C2 (native AArch64 machine code)
38
39C2(G_C)
40 ↓
41 C3 (native AArch64 machine code)
42
43Required Fixed Point:
44C1 == C2 == C3 (bit-for-bit, byte-for-byte identity)
45```
46
47Once this fixed point is demonstrated, the reference C implementation ($C_0$) is sovereignly superseded and no longer required to reproduce the compiler.
48
49---
50
51## 2. Inviolable Governance Principles at M6
52
531. **No Foreign Compiler Dependency**:
54 Neither LLVM, Clang, GCC, nor any external assembler is used to generate $C_1$, $C_2$, or $C_3$. The canonical code generation path runs solely through OMEGA semantic lowering.
55
562. **Deterministic Bit-for-Bit Fixed Point**:
57 $$\text{SHA256}(C_1) == \text{SHA256}(C_2) == \text{SHA256}(C_3)$$
58 $$\text{REALIZATION\_ID}(C_1) == \text{REALIZATION\_ID}(C_2) == \text{REALIZATION\_ID}(C_3)$$
59
603. **Compiler Capability Completeness**:
61 The semantic compiler $G_C$ must contain all semantic machinery required to:
62 - Decode OMG0 binary wire streams.
63 - Validate input types and bit-widths.
64 - Lower pure operations into AArch64 instructions.
65 - Assign integer registers (`X0`–`X30`, `XZR`).
66 - Synthesize AArch64 ALU, immediate, branch, and return opcodes.
67 - Lay out bounded branches.
68 - Cryptographically compute `REALIZATION_ID` over generated code bytes.
69
704. **Preservation of Qualified Semantics (M5 Parity)**:
71 When $C_1$ compiles the qualified M5 semantic target $F(a, b, c) = (a + b) - c$, it must produce the exact machine bytes qualified in M5:
72 $$C_1(G_S) == C_0(G_S) == \text{00 00 01 8B 00 00 02 CB C0 03 5F D6}$$
73 and executing the resulting binary with $(a=7, b=11, c=3)$ must yield 15.
74
75---
76
77## 3. Canonical Compiler Interface
78
79The native realization compiler $C$ implements the standard AArch64 register ABI:
80
81```text
82Inputs:
83 X0: Pointer to serialized OMG0 input buffer (representing graph G)
84 X1: Size in bytes of input OMG0 buffer
85 X2: Pointer to output buffer for synthesized AArch64 machine code
86 X3: Pointer to uint64_t to receive synthesized code length in bytes
87 X4: Pointer to 32-byte buffer to receive REALIZATION_ID
88
89Output:
90 X0: 0 on success, negative error code on failure
91```
92
93---
94
95## 4. Qualification Gates for M6
96
971. `OMEGA_SELF_HOST_GRAPH_PASS`: Semantic graph $G_C$ successfully constructed and validated.
982. `OMEGA_SELF_HOST_C1_EMISSION_PASS`: $C_0(G_C) \to C_1$ emits valid AArch64 machine instructions.
993. `OMEGA_SELF_HOST_DECODER_SEAM_PASS`: Independent decoder validates all $C_1$ instructions prior to execution.
1004. `OMEGA_SELF_HOST_C2_REPRODUCTION_PASS`: Executing $C_1(G_C) \to C_2$ succeeds and emits machine code.
1015. `OMEGA_SELF_HOST_C3_REPRODUCTION_PASS`: Executing $C_2(G_C) \to C_3$ succeeds and emits machine code.
1026. `OMEGA_SELF_HOST_FIXED_POINT_PASS`: Byte-for-byte identity $C_1 == C_2 == C_3$ verified.
1037. `OMEGA_SELF_HOST_REALIZATION_ID_PASS`: `REALIZATION_ID` matching across $C_1, C_2, C_3$.
1048. `OMEGA_SELF_HOST_M5_PARITY_PASS`: $C_1(G_S)$ compiles $F(a, b, c) = (a + b) - c$ to exact M5 bytes.
1059. `OMEGA_SELF_HOST_NATIVE_EXECUTION_PASS`: Output of $C_1(G_S)$ executes natively to 15.
10610. `OMEGA_SELF_HOST_ADVERSARIAL_MUTATION_PASS`: Single-bit mutation in $G_C$ or $C_1$ produces immediate refusal or mismatch.