interplane.Get Omega
Read in your language

omega-bridge

Omega-first language interoperability: checked conversion backends and native language bindings

Brought by drakestapleton

branch main Branches Tags History

omega-bridge / evidence / native-freestanding-om2-nolibc / README.md

228 lines · 15494 bytes Raw Blame History Rendered
1# Pure freestanding OM2: arrays, private f64 and no libc
2
3Status: **IMPLEMENTED and EXERCISED**, not merged or deployed. No GPU, NVIDIA driver,
4firmware or physical x86 qualification is claimed. Drake must review and approve the draft
5profile/gate contract before merge. This stacks on bridge #70
6(`2156ca177c954130fa2fdedf86da0f836e8c8a95`); frozen bridge #68 is unchanged.
7
8## Implementation and custody
9
10The first-party generator is `src/native.om` (sha256
11`77e494baf62dc7dd4a65c2c15085e2a9fad2d19a2f71c18037196427e4ed2fe4`).
12`tools-and-source.txt` records the other tested source hashes and verification-tool versions.
13No compiler or compiler pin changes in this slice:
14
15- Generator OM1 compiler: `734f0a39319fbfa930bcc62cb30dbf06d47d78e126372b74f5baf478e6126b61`.
16- Pure AArch64 OM2: omega-mv `e5b32567a7aff3ce594e3254a622a846a6cd190b`,
17 compiler `2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f`.
18- Pure x86 OM2: existing compiler
19 `be8c51301307555254fc59e351d281aae1aa096d91521777e33a41c8b446448a`;
20 source custody remains as documented in NATIVE-ABI.md.
21- Full hosted AArch64 V2/device regression gate: existing A5 compiler
22 `b8f8f1371bc0303f8da02db8b754e085d5dd852620c8d8d676c5769c233d9195`.
23- Hosted x86 device regression gate: existing #1050 compiler
24 `c5ac9979232afd0d750e1d5088af69692032997136f761e585a25aa9a1cfc87e`.
25
26The OM2 freestanding runtime uses generated byte-transport helpers with volatile stores,
27not libc memset/memmove/memcpy. The entry's private out-frame is disjoint from valid caller
28buffers. Status-0-only copy-back and caller-overlap refusals remain intact. Objects compile
29with `-fno-stack-protector`; the import gate permits only the linker GOT marker, never a libc
30function. The aggregate bare ELF has **no undefined symbols at all**.
31
32The source scanner admits the needed private f64 operations behind an integer public ABI,
33not public float parameters/results or private f32. It parses parameter names separately
34from types, reuses the bounded positive named-extent parser, retains fresh/layout checks,
35and counts distinct source-name spellings rather than assignment occurrences. The 1024-name
36bound is unchanged. OM1 remains scalar/integer-only. Host words, storage and text stay refused.
37
38## Actual six-unit inputs
39
40RegAlloc source root HEAD observed:
41`0df685dee3e93b79fa940900b7f344603bbd383d`.
42CoreUtil source root HEAD observed:
43`68c8cff68f9e3f3260fba42963f0253d804e3c5b` (CUDApp draft #308).
44The authoritative identities of exercised bytes are `six-a64-sources.json` and
45`six-x86-sources.json`, including both original-source and composed-input sha256 values.
46These are byte identities, not an assertion that another owner's worktree is clean.
47
48Per RegAllocOm's explicit contract, snapshot these portable files separately and prefix
49exactly `om2\n`, without changing any other byte:
50
51- `om/codegen/regalloc.om` -> `omega2_ra_run`;
52- `om/codegen/regalloc_ir.om` -> `omega2_ra_ir`;
53- `om/codegen/regalloc_live.om` -> `omega2_ra_live`.
54
55Snapshot CoreUtil's `om/core/native.om`, `om/core/cubin.om` and `om/core/ampere.om` unchanged;
56they are already OM2. Do not concatenate the units or relax the OM1-array refusal to feed
57portable sources directly. One invocation generates one library from all six immutable
58input copies. Hosted and freestanding generation consume the same copies.
59
60The caller exercises allocation, IR/liveness decisions, a full-size graph edit, log-one,
61padded NOP encoding and CUBIN metadata refusal. It checks an invalid large fixed-span length
62returns 32 without changing the result or image, and a wrong-result control exits 90.
63This is selected-path qualification of the actual composition, not the full CUDApp suite.
64
65## Actual policy/mm extension and whole-at refusal
66
67The additional CUDApp source root is `ApiPlanOm`, observed HEAD
68`c0e085e99da555798686c109d8a9294c173cddf5` (draft #306).
69`--api` adds the complete portable `om/components/api_policy.om` and `api_mm_plan.om`,
70each with exactly the same `om2\n` prefix and no other transformation. Their source/input
71hashes are in `eight-{a64,x86}-sources.json`; all eight actual units share one library.
72The additional bare and hosted calls exercise policy `rem` acceptance/refusal and the
73matmul plan's 16-word edit, compare all words against the independent Wolfram result
74below, and check a short view leaves every word and the result unchanged.
75No C `_exit`, setjmp/longjmp, memory helper or 128-bit-division runtime is linked.
76
77The complete `api_at_plan.om` also receives only `om2\n`, but remains an explicit negative
78control in this profile: exit 110, no output installed, because private f32 is excluded.
79The original source additionally used the OM2-reserved local name `part`; the first attempt
80failed with compiler9 before the scanner. `red-api-at-reserved-name.log` and its source
81identity preserve that observation. ApiPlanOm repaired the private name to `partsz` in
82the revision above, without changing the algorithm. The final whole-at negative control
83reaches the profile refusal on both targets; it is not attention-plan qualification.
84
85Two separately copied, exactly-one-site source mutants compile and link under the same
86bare constraints: reverse the policy's remainder predicate -> exit14; change the matmul
87plan's `put a 8 m` to `put a 8 add m 1` -> exit15. Both are caught before stdout.
88Baseline input copies are never mutated. `eight-{a64,x86}-commands.log` records every
89compiler, linker, inspector, executable and expected-failure rc; no binaries are committed.
90
91## Commands and observed results
92
93`commands.json` records actual argument arrays and relevant explicit environment values.
94`~` replaces `/home/drakestapleton` in all published text; expand it to the local HOME when
95reproducing. Logs are linewise text with LF endings. Binary differential stdout in the
96aggregate command traces is encoded as `stdout_hex`, not committed as a binary.
97The host environment was inherited; this is not an `env -i` hermeticity claim.
98
99Every command and child ran in this device-free namespace. No test was rerun outside it.
100
101```sh
102bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 python3 tests/native/test_freestanding.py
103bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 python3 tests/native/test_freestanding_om2.py
104bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 sh tests/native/v2/run.sh
105bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 sh tests/native/x86/run.sh /tmp/bh/freestanding-x86-green
106bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 python3 tests/native/x86/device.py /tmp/bh/freestanding-x86-device
107bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 python3 tests/native/test_freestanding_aggregate.py --regalloc ~/work/cudastack/lanes/RegAllocOm --core ~/work/cudastack/lanes/CoreUtilOm --target aarch64linux --out /tmp/bh/freestanding-six-a64-new
108bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 python3 tests/native/test_freestanding_aggregate.py --regalloc ~/work/cudastack/lanes/RegAllocOm --core ~/work/cudastack/lanes/CoreUtilOm --target x86linux --out /tmp/bh/freestanding-six-x86-new
109bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 python3 tests/native/test_freestanding_aggregate.py --regalloc ~/work/cudastack/lanes/RegAllocOm --core ~/work/cudastack/lanes/CoreUtilOm --target aarch64linux --out /tmp/bh/freestanding-eight-a64-green --api ~/work/cudastack/lanes/ApiPlanOm
110bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 python3 tests/native/test_freestanding_aggregate.py --regalloc ~/work/cudastack/lanes/RegAllocOm --core ~/work/cudastack/lanes/CoreUtilOm --target x86linux --out /tmp/bh/freestanding-eight-x86-green --api ~/work/cudastack/lanes/ApiPlanOm
111```
112
113The full V2/device gate needs the hosted A5 compiler, not the pure e5 compiler. Pure AArch64
114qualification uses e5. x86 aggregate prerequisites additionally select x86_64-linux-gnu-gcc,
115x86_64-linux-gnu-nm and the QEMU 10.0.14 runner with `/usr/x86_64-linux-gnu`; see commands.json.
116
117| Tier | rc | Observed final line / witness | Receipt |
118|---|---:|---|---|
119| OM1 host | 0 | `PASS source-swap control refuses original non-pure snapshot; reread mutant admits mismatched source/code and is caught` | om1-host.log |
120| OM2 pure host | 0 | `PASS OM-2 public floats, private f32, malformed literal, unused host helper and storage refused before output` | om2-pure-host.log |
121| Full AArch64 V2 | 1 | **`NATIVE-V2 FAIL 1`** | v2-known-fail-one.log |
122| x86 six-language | 0 | `NATIVE-X86 EMULATED PASS (six languages built and run; native x86 NOT_RUN)` | x86-emulated.log |
123| x86 device ABI | 0 | `NATIVE-X86-DEVICE EMULATED PASS shared fixtures, 15 word controls, 5 ABI1 controls, 3-unit context ABI, 12 mutants; native/driver/chip NOT_RUN` | x86-device-emulated.log |
124| Six-unit AArch64 bare ELF | 0 | `PASS allocator, IR, liveness, graph, private f64, padded NOP and CUBIN refusal; bad span untouched; wrong-result control exits 90` | six-a64.log, six-a64-commands.log |
125| Six-unit x86 bare ELF | 0 | Same exact final line as AArch64; EMULATED only | six-x86.log, six-x86-commands.log |
126| Eight-unit AArch64 bare ELF | 0 | `PASS actual policy/mm views and rem without libc; short span untouched; whole at private-f32 refusal110; two source mutants caught` | eight-a64.log, eight-a64-commands.log |
127| Eight-unit x86 bare ELF | 0 | Same exact final line; EMULATED only | eight-x86.log, eight-x86-commands.log |
128
129The sole final V2 failure is unchanged:
130`FAIL hoist writes 0 of x20..x26 and 3 of d8..d15: OMEGA_NATIVE_OMC2 does not hoist (omega-mv perf/omc-loop-checks)`.
131It was not suppressed, normalized or reclassified as PASS. The earlier setup probe in
132`setup-wrong-pure-pin-v2.log` used pure e5 for device fixtures and failed with rc1/FAIL9;
133correcting the prerequisite to the already-pinned hosted A5 compiler, without changing a
134gate, produced precisely the known FAIL1 above. The historical span comparator is untouched.
135
136After staging the new inputs/receipts (so tracked-file counts include them), the exact
137metadata commands also ran in the namespace:
138`bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 crumb compile .`
139(rc0, `crumb compile: 11 crumbs, 4 rewritten, HEAD a4dd96c`) followed by
140`bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 crumb verify .`
141(rc0, `crumb verify: OK: 11 crumbs current`). This is metadata verification, not a runtime tier.
142
143## Negative controls and test-first failures
144
145- `red-no-libc-link.log`: the new strict OM2 relocatable-link test first failed on unresolved
146 memmove/memset. The generated transport removes those imports; the bare link, nm and
147 readelf checks now pass on both targets.
148- `red-private-f64.log`: private f64 fixture first refused with exit 110. Public f64, private
149 f32 (including after fresh/named extents), malformed exponent, storage and an unused host
150 helper still refuse before output. Crafted frames test the scanner only and are never run.
151- `red-distinct-name-boundary.log`: a duplicate name at capacity first refused. Repeated
152 assignments and a duplicate at full capacity now pass; a new 1025th spelling still refuses.
153 Removing the exact deduplication loop restores the repeated-name refusal and is caught.
154- Dropped copy-back leaves every digest at the pre-call fill. Wrong zero initialization has
155 the exact `outok 0 2 7 0` witness; copying after a trap has the exact `outtrap 5 0` witness.
156 A forced libc-copy import is rejected by nm and preserves the installed object.
157- Existing OM1 pthread-import, failing/missing symbol inspector, failed import-filter and
158 source-snapshot swap controls continue to pass.
159- Both six-unit bare executables have empty `nm -u`, no interpreter and no TLS sections.
160 They produce bytes identical to the hosted caller. The separately linked wrong-result
161 controls exit 90 without stdout. All exact commands and rc values are in their traces.
162
163### Narrow independent FP oracle correction
164
165`red-x86-c-oracle-indefinite.log` observed division of negative zero by negative zero:
166Omega `7ff8000000000000`, C/SSE `fff8000000000000`, status 0. This is not a compiler defect:
167the x86 source explicitly preserves operand-NaN sign/payload in `xfnans` and emits Arm's
168positive default NaN for invalid arithmetic in `xfdefnan` (omega-mv c6c30fe3).
169Read-only review recommended normalizing **only the C oracle's exact zero/zero negative
170indefinite**, never the Omega output, not broad NaN equivalence. That precise predicate is
171implemented in the new test, not in an existing historical byte-comparison gate.
172
173The same comparison must reject a negative indefinite, a different payload, or nonzero
174status where the canonical positive result is required. Targeted addition with the negative
175NaN encoding in either operand position must preserve it exactly. The full matrix retains
176raw signed-zero, subnormal, payload, unary-negation and ordinary-value comparisons.
177`x86-fips-out-fp-witness.log` records `floatbits 1` with exit 0 on the final matrix.
178Hardware FP must already be enabled and the caller's control modes are inherited, not
179configured by the wrapper. FP exception/status-flag preservation is not promised.
180This does not qualify firmware/kernel FP-state management.
181
182## Mathematical oracle queries
183
184WolframLanguageEvaluator:
185
186```
187Map[Function[b,{b,Quotient[b,2^63],Mod[Quotient[b,2^52],2^11],Mod[b,2^52]}],
188 {16^^8000000000000000,1,16^^7ff8000000000001}]
189-> {{9223372036854775808,1,0,0},{1,0,0,1},
190 {9221120237041090561,0,2047,2251799813685249}}
191
192{32*16, Log[1]} -> {512,0}
193```
194
195These supply expected bit classifications, padding bytes and log-one, not GPU measurements.
196
197The additional expected matmul-plan words and remainder controls use:
198
199```
200WolframLanguageEvaluator:
201Module[{m=17,k=19,n=9,mp,kp,np,a5=16^^a5},
202 mp=16 Ceiling[m/16];kp=16 Ceiling[k/16];np=8 Ceiling[n/8];
203 {"mm"->Join[{m,k,n,0,0,0,0,0},
204 {mp,kp,np,2 mp kp,Max[4 mp np,64 8 Ceiling[0/8]],2 kp np,k n,a5}],
205 "at"->Join[{8,2,64,0,0,0,0,0},
206 {IntegerExponent[Quotient[8,2],2],1},ConstantArray[a5,6]],
207 "badat"->Join[{7,2,64,0,0,0,0,0},ConstantArray[a5,8]],
208 "remainders"->{Mod[128,128],Mod[129,128],Mod[7,2]}}]
209-> {"mm"->{17,19,9,0,0,0,0,0,32,32,16,2048,2048,1024,171,165},
210 "at"->{8,2,64,0,0,0,0,0,2,1,165,165,165,165,165,165},
211 "badat"->{7,2,64,0,0,0,0,0,165,165,165,165,165,165,165,165},
212 "remainders"->{0,1,1}}
213```
214
215The `at` vectors are derived expectations only, not exercised evidence in this profile.
216
217## Limits and external gates
218
219- Focused host and x86 EMULATED tiers: **PASS** as listed.
220- Full AArch64 V2 gate: **FAIL**, exactly the one existing hoist assertion.
221- Physical x86, NVIDIA driver/GPU/chip and firmware: **NOT_RUN**; none authorized here.
222- Merge/deployment: **NOT_RUN**; Drake's approval is required before merge.
223- No compiler, frozen PR, GPU service or live device was changed. A separate authorized
224 metadata-only commit refreshes `evidence/native-x86-aien-abi1/.crumb` from count0 to9:
225 logs had been committed after its old count. `git diff --stat -- evidence/native-x86-aien-abi1`
226 showed that `.crumb` as the only changed file under the old receipt. Every old log byte
227 remains unchanged; the exact commit is
228 `crumb: refresh native-x86-aien-abi1 metadata count 0->9 (logs committed after count; no receipt change)`.