interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / bench / omc_efficiency / PROTOCOL.md

140 lines · 9636 bytes Raw Blame History Source

OMC-EFF-1: fixed efficiency protocol for the seeded Omega compiler

Status: frozen before any suite timing was taken. The commit that adds this file is the freeze; the evidence directory records this file's sha256. Any change to the cases, arms, rounds, seeds, metrics or rules below is a new protocol version (OMC-EFF-2), never an edit of this one.

1. Question

How efficient are the programs, the compile step and the code size of seed/out/omc at omega-mv 3364a1dfd0ca50c1b82bf19ba34932d8bc10a7a9 (omc sha256 befb8199db8c4bca188a494dfaac2a6f0ee5c36fcea11188c75666c55fce8a1d), against C twins built by the host gcc, on a fixed suite of scalar arithmetic, control, call and memory kernels? Where does the excess go? This is a baseline and a hotspot finding, host only (Linux arm64, no GPU). It is not a hardware qualification and it is not a verdict on any optimization.

2. Cases (fixed)

Each case is kernels/CASE.om with a C twin kernels/CASE.c that runs the same algorithm and prints the same bytes. want/CASE.out holds the expected output. Every expected value was computed by Wolfram, independently of both compilers, before the freeze:

casekindworkexpectedWolfram query (WolframLanguageEvaluator)
arithwrapping mul/add, xor, shift, rem40,000,000 iterations257048857779055872, 19997288181122h: {{31,1,0},{0,1,1},{0,0,1}} raised to 40000000 by squaring mod 2^64, applied to {0,0,1}; s: Sum over 40 chunks of Total[Mod[BitXor[r^2, BitShiftRight[r,3]], 1000003]]
branchdata-dependent branch in a bounded whileCollatz steps for 1 .. 1,000,000131434424, 524compiled While[x!=1, If[EvenQ[x], x=Quotient[x,2], x=3x+1]; k++] over n = 1 .. 10^6
fibrecursive callsfib(38)39088169Fibonacci[38]
leafcalla 2-parameter leaf call with values live across it30,000,000 calls14033628548985435713, 209199473132473987232-bit halves: Accumulate of BitXor[r K, BitShiftRight[r,5]] with carries, xor-fold by bit parity
sievebyte array stores and loads50 passes, limit 2,000,000148933, 7446650PrimePi[2000000], 50 PrimePi[2000000]
isortulong array, inner whileinsertion sort of 20,000 values13308148862445, 0, 5, 99999NestList of the LCG, Sort, Total[v Range[20000]], First, Last, unsorted neighbours
matmul3 nested for, array index arithmetic300 x 300 x 300809974868, 2699759Total[a.b, 2], Tr[a.b]

Disclosed shape decisions, made before timing:

3. Arms

armbuildrole
omcOMC < CASE.om > bin with the pinned omcsubject
cO2env -i /usr/bin/gcc -B/usr/bin/ -O2 -static (gcc 13.3.0)C oracle and yardstick: the ratio denominator
cO0the same with -O0reference only; never decides anything
negomc build of a one-edit mutant of the case (edits listed in run.sh)negative control: its output must not match

Both C arms are static so that neither side pays for dynamic loading. -B/usr/bin/ is needed because the conductor runs every child with an empty environment (no PATH).

4. Design

5. Validity (before any number is read)

A run is VALID only when all of these hold; otherwise it is INVALID and no number from it is quoted:

  1. both conductor invocations exit 0; build: every B row same=1, status 0;
  2. every real T and P row has status 0 and ok 1; every neg row is detected (ctl_missed=0);
  3. for every (case, real arm), measured instructions:u max/min is at most 1.01 (counts must be stable; a wider spread is reported as a measurement fault, not averaged away);
  4. selftest.sh passes on the same omc (wrong expected output, a matching control and a wrong build reference are each rejected; usage errors exit 2).

6. Metrics and statistics

Per (case, arm), over the 21 measured rounds: median, min and max of wall ns, instructions:u and cycles:u. Per case and round, paired ratios omc / cO2 (wall, cycles, instructions; cO0 / cO2 as reference). For each ratio: the median and the distribution-free 95% interval for the median, the order statistics x(6) .. x(16) of the 21 sorted ratios (WolframLanguageEvaluator: n=21; k=Max[Select[Range[1,10], 2 CDF[BinomialDistribution[n,1/2], #-1] <= 1/20 &]] -> k = 6, upper rank 16, coverage 0.9734). Across cases: the geometric mean of the seven median ratios. Compile time: median, min, max per (case, arm) over 10 rounds, and the median paired ratio omc / cO2. Code size: the omc ELF file bytes (the whole program: header, code, trap stubs; no libc exists) against the .text bytes of gcc -c of the twin (the kernel's own code; libc excluded), plus the static C file bytes for reference. All statistics are computed with Wolfram from the raw rows; no p90 is promised.

7. Hotspot rule (declared before the data)

Cases are ranked by the median instruction ratio omc / cO2 and by absolute excess instructions. For the top-ranked cases the excess is attributed to compiler seams by disassembling the omc hot loops (objdump -D -b binary -m aarch64) and multiplying the per-iteration instruction classes by trip counts computed with Wolfram. The attribution is labelled MODELED; it must reconcile with the MEASURED instruction total within 3%, otherwise it is reported as UNRECONCILED. The facts go to the compiler owner; this protocol does not choose or implement the optimization.

8. Rule for a later A/B of a candidate compiler (declared now)

Arms omcB (this omc) and omcC (the candidate), cO2 reference only, same cases, same conductor, 21 + 3 rounds, a seed declared in the candidate's evidence before its run. Correctness: every row matches want/; any mismatch voids the candidate. Per case, on paired ratios omcC / omcB:

The candidate's compile time is measured with the build mode once per compiler (the v1 conductor takes one omc per build invocation, so compile time is not paired); a median compile ratio above 1.10 on any case is reported as a compile-time regression. Code size is reported for every case.

9. Disclosures

Before the freeze, two exploratory programs that are not suite cases (a 50,000,000-pass xorshift loop and fib(30)) were timed once with the shell's time while reading omc's code generation. The suite programs were run before the freeze only to check their outputs, without timing. Conductor smoke runs before the freeze printed the wall and counter columns masked.

10. Replay

git checkout <freeze commit>
sh bench/omc_efficiency/selftest.sh seed/out/omc /tmp/omc-eff-selftest
sh bench/omc_efficiency/run.sh seed/out/omc /tmp/omc-eff-run 19