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 / docs / zig-cc-lane.md
| 1 | # Zig cc cross-check lane |
| 2 | |
| 3 | Workflow: `.github/workflows/zig-cc.yml` ("Zig cc cross-check"). It runs on every |
| 4 | pull request and on pushes to `main`, on the same `ubuntu-24.04-arm` hosted runner |
| 5 | as `pr-smoke.yml`. |
| 6 | |
| 7 | ## What it is |
| 8 | |
| 9 | Omega is built with gcc everywhere else. This lane builds the same sources with |
| 10 | `zig cc` from a pinned Zig 0.17.0 (clang 22) and asks one question: does an |
| 11 | independent compiler agree with gcc about what the code means? It is a |
| 12 | cross-check, not a second source of truth. The gcc lanes (`pr-smoke.yml` and the |
| 13 | host-suites workflows) stay authoritative, and this is not a migration to Zig. |
| 14 | |
| 15 | The Zig tarball is downloaded from ziglang.org and checked against a pinned |
| 16 | SHA-256 before it is unpacked. The version and digest live in the workflow file; |
| 17 | changing the version means changing both together. |
| 18 | |
| 19 | ## What it checks |
| 20 | |
| 21 | 1. `omegatool` and the compiler tests build under clang with the Makefile's own |
| 22 | flags (`-Wall -Wextra -Werror`). A warning that clang reports and gcc does not |
| 23 | fails the lane. |
| 24 | 2. `make test` passes with the same assertions as `pr-smoke.yml`: every |
| 25 | `TOTAL GATES` line shows zero failures. |
| 26 | 3. `make test-language` (Omega language V0 golden, 407 cases) passes. |
| 27 | 4. `make test-compiler-quick` (OSC compiler smoke) passes. |
| 28 | 5. Gate and demonstration output from the zig-built `omegatool` is compared with a |
| 29 | gcc-built `omegatool` from the same commit, for 18 suites: `--run-gates`, |
| 30 | `--run-m6-gates` to `--run-m14-gates`, and the arithmetic, physics, self-host, |
| 31 | verify, program, synthesis, library and discovery demonstrations. The output |
| 32 | must be byte-identical, so every gate total and every printed 64-hex identity |
| 33 | matches. |
| 34 | |
| 35 | ## What it does not check |
| 36 | |
| 37 | - Any GPU or chip suite. Nothing here touches `/dev/nvidia*`, the GB10, or the |
| 38 | M15 and later gate sets. Chip qualification stays on the Spark. |
| 39 | - The QEMU-backed pieces: `--run-m5-gates` and `--reference-demonstrate-realization`. |
| 40 | No omega workflow installs QEMU, so they are left out of the hosted comparison. |
| 41 | They were run by hand against both compilers on the Spark (QEMU present) when |
| 42 | this lane was added, with identical output. |
| 43 | - Makefile targets that hard-code `gcc` instead of `$(CC)` (the numeric CPU, |
| 44 | reduce and transcendental checks). They do not exercise Zig. |
| 45 | - AddressSanitizer. `zig cc` accepts `-fsanitize=address` but does not instrument |
| 46 | the code with it, so the `_asan` test binaries in `test-compiler-quick` run as |
| 47 | plain builds. UBSan is applied (through Zig's own runtime). The gcc lanes remain |
| 48 | the ASan evidence. |
| 49 | - Byte-for-byte reproducible binaries. Two clean zig builds of the same commit |
| 50 | gave different `omegatool` bytes (the gcc builds were identical), so the lane |
| 51 | compares program behaviour, not binary hashes. |
| 52 | |
| 53 | ## Resolved item |
| 54 | |
| 55 | clang 22 reported `-Wunterminated-string-initialization` for |
| 56 | `src/omega_blackwell_encoder.c` (`static const char HEXDIGITS[16] = |
| 57 | "0123456789abcdef";` left no room for the terminating NUL; gcc 13 does not |
| 58 | warn). The array is now declared `HEXDIGITS[]` (17 bytes, omega#432), and the |
| 59 | lane no longer passes `-Wno-error=unterminated-string-initialization`: every |
| 60 | warning is an error, as in the gcc lanes. |
| 61 | |
| 62 | ## Running it by hand |
| 63 | |
| 64 | From a checkout with the pinned Physics at `PHYSICS_DIR`: |
| 65 | |
| 66 | ZIG=/path/to/zig-aarch64-linux-0.17.0/zig |
| 67 | make CC="$ZIG cc" PHYSICS_DIR=../physics test |
| 68 | |
| 69 | Use a separate `OUT_DIR` per compiler if you want both builds side by side. The M5 |
| 70 | QEMU gate writes to a fixed `build/` directory, so create `build/` first when |
| 71 | `OUT_DIR` is something else. |