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 Source

Pure freestanding OM2: arrays, private f64 and no libc

Status: IMPLEMENTED and EXERCISED, not merged or deployed. No GPU, NVIDIA driver, firmware or physical x86 qualification is claimed. Drake must review and approve the draft profile/gate contract before merge. This stacks on bridge #70 (2156ca177c954130fa2fdedf86da0f836e8c8a95); frozen bridge #68 is unchanged.

Implementation and custody

The first-party generator is src/native.om (sha256 77e494baf62dc7dd4a65c2c15085e2a9fad2d19a2f71c18037196427e4ed2fe4). tools-and-source.txt records the other tested source hashes and verification-tool versions. No compiler or compiler pin changes in this slice:

The OM2 freestanding runtime uses generated byte-transport helpers with volatile stores, not libc memset/memmove/memcpy. The entry's private out-frame is disjoint from valid caller buffers. Status-0-only copy-back and caller-overlap refusals remain intact. Objects compile with -fno-stack-protector; the import gate permits only the linker GOT marker, never a libc function. The aggregate bare ELF has no undefined symbols at all.

The source scanner admits the needed private f64 operations behind an integer public ABI, not public float parameters/results or private f32. It parses parameter names separately from types, reuses the bounded positive named-extent parser, retains fresh/layout checks, and counts distinct source-name spellings rather than assignment occurrences. The 1024-name bound is unchanged. OM1 remains scalar/integer-only. Host words, storage and text stay refused.

Actual six-unit inputs

RegAlloc source root HEAD observed: 0df685dee3e93b79fa940900b7f344603bbd383d. CoreUtil source root HEAD observed: 68c8cff68f9e3f3260fba42963f0253d804e3c5b (CUDApp draft #308). The authoritative identities of exercised bytes are six-a64-sources.json and six-x86-sources.json, including both original-source and composed-input sha256 values. These are byte identities, not an assertion that another owner's worktree is clean.

Per RegAllocOm's explicit contract, snapshot these portable files separately and prefix exactly om2\n, without changing any other byte:

Snapshot CoreUtil's om/core/native.om, om/core/cubin.om and om/core/ampere.om unchanged; they are already OM2. Do not concatenate the units or relax the OM1-array refusal to feed portable sources directly. One invocation generates one library from all six immutable input copies. Hosted and freestanding generation consume the same copies.

The caller exercises allocation, IR/liveness decisions, a full-size graph edit, log-one, padded NOP encoding and CUBIN metadata refusal. It checks an invalid large fixed-span length returns 32 without changing the result or image, and a wrong-result control exits 90. This is selected-path qualification of the actual composition, not the full CUDApp suite.

Actual policy/mm extension and whole-at refusal

The additional CUDApp source root is ApiPlanOm, observed HEAD c0e085e99da555798686c109d8a9294c173cddf5 (draft #306). --api adds the complete portable om/components/api_policy.om and api_mm_plan.om, each with exactly the same om2\n prefix and no other transformation. Their source/input hashes are in eight-{a64,x86}-sources.json; all eight actual units share one library. The additional bare and hosted calls exercise policy rem acceptance/refusal and the matmul plan's 16-word edit, compare all words against the independent Wolfram result below, and check a short view leaves every word and the result unchanged. No C _exit, setjmp/longjmp, memory helper or 128-bit-division runtime is linked.

The complete api_at_plan.om also receives only om2\n, but remains an explicit negative control in this profile: exit 110, no output installed, because private f32 is excluded. The original source additionally used the OM2-reserved local name part; the first attempt failed with compiler9 before the scanner. red-api-at-reserved-name.log and its source identity preserve that observation. ApiPlanOm repaired the private name to partsz in the revision above, without changing the algorithm. The final whole-at negative control reaches the profile refusal on both targets; it is not attention-plan qualification.

Two separately copied, exactly-one-site source mutants compile and link under the same bare constraints: reverse the policy's remainder predicate -> exit14; change the matmul plan's put a 8 m to put a 8 add m 1 -> exit15. Both are caught before stdout. Baseline input copies are never mutated. eight-{a64,x86}-commands.log records every compiler, linker, inspector, executable and expected-failure rc; no binaries are committed.

Commands and observed results

commands.json records actual argument arrays and relevant explicit environment values. ~ replaces /home/drakestapleton in all published text; expand it to the local HOME when reproducing. Logs are linewise text with LF endings. Binary differential stdout in the aggregate command traces is encoded as stdout_hex, not committed as a binary. The host environment was inherited; this is not an env -i hermeticity claim.

Every command and child ran in this device-free namespace. No test was rerun outside it.

bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 python3 tests/native/test_freestanding.py
bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 python3 tests/native/test_freestanding_om2.py
bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 sh tests/native/v2/run.sh
bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 sh tests/native/x86/run.sh /tmp/bh/freestanding-x86-green
bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 python3 tests/native/x86/device.py /tmp/bh/freestanding-x86-device
bwrap --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
bwrap --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
bwrap --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
bwrap --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

The full V2/device gate needs the hosted A5 compiler, not the pure e5 compiler. Pure AArch64 qualification uses e5. x86 aggregate prerequisites additionally select x86_64-linux-gnu-gcc, x86_64-linux-gnu-nm and the QEMU 10.0.14 runner with /usr/x86_64-linux-gnu; see commands.json.

TierrcObserved final line / witnessReceipt
OM1 host0PASS source-swap control refuses original non-pure snapshot; reread mutant admits mismatched source/code and is caughtom1-host.log
OM2 pure host0PASS OM-2 public floats, private f32, malformed literal, unused host helper and storage refused before outputom2-pure-host.log
Full AArch64 V21NATIVE-V2 FAIL 1v2-known-fail-one.log
x86 six-language0NATIVE-X86 EMULATED PASS (six languages built and run; native x86 NOT_RUN)x86-emulated.log
x86 device ABI0NATIVE-X86-DEVICE EMULATED PASS shared fixtures, 15 word controls, 5 ABI1 controls, 3-unit context ABI, 12 mutants; native/driver/chip NOT_RUNx86-device-emulated.log
Six-unit AArch64 bare ELF0PASS allocator, IR, liveness, graph, private f64, padded NOP and CUBIN refusal; bad span untouched; wrong-result control exits 90six-a64.log, six-a64-commands.log
Six-unit x86 bare ELF0Same exact final line as AArch64; EMULATED onlysix-x86.log, six-x86-commands.log
Eight-unit AArch64 bare ELF0PASS actual policy/mm views and rem without libc; short span untouched; whole at private-f32 refusal110; two source mutants caughteight-a64.log, eight-a64-commands.log
Eight-unit x86 bare ELF0Same exact final line; EMULATED onlyeight-x86.log, eight-x86-commands.log

The sole final V2 failure is unchanged: FAIL hoist writes 0 of x20..x26 and 3 of d8..d15: OMEGA_NATIVE_OMC2 does not hoist (omega-mv perf/omc-loop-checks). It was not suppressed, normalized or reclassified as PASS. The earlier setup probe in setup-wrong-pure-pin-v2.log used pure e5 for device fixtures and failed with rc1/FAIL9; correcting the prerequisite to the already-pinned hosted A5 compiler, without changing a gate, produced precisely the known FAIL1 above. The historical span comparator is untouched.

After staging the new inputs/receipts (so tracked-file counts include them), the exact metadata commands also ran in the namespace: bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 crumb compile . (rc0, crumb compile: 11 crumbs, 4 rewritten, HEAD a4dd96c) followed by bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 crumb verify . (rc0, crumb verify: OK: 11 crumbs current). This is metadata verification, not a runtime tier.

Negative controls and test-first failures

Narrow independent FP oracle correction

red-x86-c-oracle-indefinite.log observed division of negative zero by negative zero: Omega 7ff8000000000000, C/SSE fff8000000000000, status 0. This is not a compiler defect: the x86 source explicitly preserves operand-NaN sign/payload in xfnans and emits Arm's positive default NaN for invalid arithmetic in xfdefnan (omega-mv c6c30fe3). Read-only review recommended normalizing **only the C oracle's exact zero/zero negative indefinite**, never the Omega output, not broad NaN equivalence. That precise predicate is implemented in the new test, not in an existing historical byte-comparison gate.

The same comparison must reject a negative indefinite, a different payload, or nonzero status where the canonical positive result is required. Targeted addition with the negative NaN encoding in either operand position must preserve it exactly. The full matrix retains raw signed-zero, subnormal, payload, unary-negation and ordinary-value comparisons. x86-fips-out-fp-witness.log records floatbits 1 with exit 0 on the final matrix. Hardware FP must already be enabled and the caller's control modes are inherited, not configured by the wrapper. FP exception/status-flag preservation is not promised. This does not qualify firmware/kernel FP-state management.

Mathematical oracle queries

WolframLanguageEvaluator:

Map[Function[b,{b,Quotient[b,2^63],Mod[Quotient[b,2^52],2^11],Mod[b,2^52]}],
    {16^^8000000000000000,1,16^^7ff8000000000001}]
-> {{9223372036854775808,1,0,0},{1,0,0,1},
    {9221120237041090561,0,2047,2251799813685249}}

{32*16, Log[1]} -> {512,0}

These supply expected bit classifications, padding bytes and log-one, not GPU measurements.

The additional expected matmul-plan words and remainder controls use:

WolframLanguageEvaluator:
Module[{m=17,k=19,n=9,mp,kp,np,a5=16^^a5},
 mp=16 Ceiling[m/16];kp=16 Ceiling[k/16];np=8 Ceiling[n/8];
 {"mm"->Join[{m,k,n,0,0,0,0,0},
   {mp,kp,np,2 mp kp,Max[4 mp np,64 8 Ceiling[0/8]],2 kp np,k n,a5}],
  "at"->Join[{8,2,64,0,0,0,0,0},
   {IntegerExponent[Quotient[8,2],2],1},ConstantArray[a5,6]],
  "badat"->Join[{7,2,64,0,0,0,0,0},ConstantArray[a5,8]],
  "remainders"->{Mod[128,128],Mod[129,128],Mod[7,2]}}]
-> {"mm"->{17,19,9,0,0,0,0,0,32,32,16,2048,2048,1024,171,165},
    "at"->{8,2,64,0,0,0,0,0,2,1,165,165,165,165,165,165},
    "badat"->{7,2,64,0,0,0,0,0,165,165,165,165,165,165,165,165},
    "remainders"->{0,1,1}}

The at vectors are derived expectations only, not exercised evidence in this profile.

Limits and external gates