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-f32

30fba61 native: admit private f32 in the integer-only freestanding profile Drake Stapleton committed 2026-11-06
..
.crumb890
README.md13840
commands.json14308
fp32-a64-commands.log74107
fp32-a64-sources.json498
fp32-a64.log11247
fp32-x86-commands.log77105
fp32-x86-emulated.log11690
fp32-x86-sources.json498
nine-a64-commands.log11694
nine-a64-sources.json2532
nine-a64.log8423
nine-x86-commands.log12946
nine-x86-emulated.log9109
nine-x86-sources.json2532
om1-host.log587
om2-host.log12331
red-before-private-f32.log1315
red-x86-obsolete-hoist-expectation.log22898
tools-and-source.txt2114
transfers.json3519
v2-known-fail-one.log10230
wolfram-attention.txt1371
wolfram-fp32.txt2546
wolfram-newton.txt1214
x86-device-emulated.log2548
x86-emulated.log23211

README.md

Private FP32 behind the integer-only freestanding native ABI

Status: IMPLEMENTED and EXERCISED, draft only; not merged or deployed. This is the separate private-FP32 followup to bridge #72 at 12f8132c2fe0ad240430583c85e0d9c4f7bd1c33. The preceding OM2-array/private-FP64 receipt remains immutable in ../native-freestanding-om2-nolibc/. Its whole-attention refusal describes that earlier profile, not this extension. Drake must review and approve the profile and gate-expectation change before merge. No physical-x86, firmware, NVIDIA-driver or GPU qualification is claimed.

What changed

The first-party implementation is src/native.om, sha256 d1ee759748139bb703b20e4da43d8508fe8e15a9f2bb6cdcf8e682963ec3ef3c. Its bounded whole-source scanner now admits private f32 operations and explicit f32 literal suffixes, alongside the already admitted private f64. A small scalar branch keeps the scanner within the seeded compiler's live-value limit. No compiler, public ABI, view runtime, native trampoline, host-word allowlist or portable converter changes. src/toc.om remains sha256 69d629df170a24ba0c2cb6d41dbfaed520e248e0d723236dd32abf0581524d84. The C files added/extended here are verification oracles, not production implementations.

Public floating parameters, results and view elements remain refused. Both widths are covered in fourteen genuinely compiled fixtures: scalar parameter/result, fixed view/edit/out, and dynamic view/edit. Each actual compiled frame must produce direct generator **exit110 and empty stdout**, then CLI exit110 without installed wrapper output. The direct check prevents the CLI's generic generator-error mapping from disguising a crash as refusal.

The unused host-helper negative control is deliberately scanner-only: the pure e5/be8c compilers do not admit that host word in function mode. The test appends an unused helper to a clean source frame and reuses its code solely to reach the whole-source scanner, requires exact generator110/empty output, and never executes the mismatched frame. This is not a claim that the pure compiler compiled a host helper.

FP32 semantics and independent oracle

tests/native/freestanding/f32.om exports only an integer bit-pattern interface. Private FP32 identity, add, divide, negate, a helper call, separate multiply/add, and comparison flags are exercised over the raw operand matrix in f32.c. That C oracle uses volatile FP32 operands and -ffp-contract=off; it checks signed zero, subnormals, infinities, finite extremes, NaNs, RNE ties and a non-contracting witness. The bare and hosted callers consume the same actual Omega code and must emit identical raw, unmodified bytes on the same target. This is not cross-architecture NaN-payload equality.

The approved comparison contract is deliberately narrower than a NaN-payload promise:

  • Non-NaN results are bit-exact against the raw IEEE results produced by the seeded code.
  • Include canonical-qNaN operand 0x7fffffff and other positive/negative NaN payloads.
  • Arithmetic NaN results are compared by NaN class only. 0x7fffffff is a documented comparison canonicalization on local comparison copies, not an omc semantic or payload assertion.
  • Identity and comparison flags remain exact. Never rewrite the integer-ABI output array.
  • No claim that raw 0/0 bits equal 0x7fffffff.
  • FP control state is inherited; this does not add soft-float or qualify a firmware FP setup.

The oracle's own controls accept a different NaN payload as the same class, but reject an infinity substituted for NaN, a one-bit finite change, wrong status and a high-word change. A wrong-result caller exits90. Three exactly-one-site source mutants are caught: add->sub exits2; widening the intermediate product to FP64 exits2 on the non-contracting witness; normalizing the integer identity's NaN output exits3. Two exactly-counted generator mutants remove private-FP32 keyword admission or its literal suffix and restore refusal110 without installed wrapper output. Neither a mutant nor the oracle normalizes production results.

WolframLanguageEvaluator queries and results are committed verbatim in wolfram-fp32.txt, wolfram-attention.txt and wolfram-newton.txt. They use exact rational IEEE rounding, including RNE/subnormal packing, rather than an ad-hoc host floating calculation. Selected query results, expressed as dimensionless raw uint32 bit patterns:

  • canonical-qNaN =2147483647, payload NaN =2143363909, negative payload NaN =4290847557;
  • min subnormal =1, half minimum normal =4194304, RNE halfway-to-one =1065353216;
  • the separate-vs-fused multiply/add witness yields {0,2826960896};
  • attention scale1.5 output =1074429868;
  • the actual per-operation binary64 Newton model for64 takes8 iterations, reaches root8, and yields attention output bits1043900987; the128 case yields1040356334;
  • attention's finite3.0e38 FP32 threshold has bits2137108966.

These are modeled expectations, not measured performance figures. Each query is paired with its full tool result in the named text files; observed execution is in the logs. The earlier binary64 oracle/comparison policy is unchanged.

Whole actual nine-unit composition

One invocation binds all nine separately copied units into one library; no concatenation, mode extraction, reduced attention source, C algorithm substitution or ignored branch:

  1. RegAllocOm om/codegen/regalloc.om, regalloc_ir.om, regalloc_live.om;
  2. CoreUtilOm om/core/native.om, cubin.om, ampere.om;
  3. ApiPlanOm om/components/api_policy.om, api_mm_plan.om, whole api_at_plan.om.

The portable allocator/API sources receive exactly the approved om2\n prefix and no other byte transformation; the core sources are already OM2. nine-{a64,x86}-sources.json records original-source and actual-input SHA256 values. These byte identities are authoritative; they do not assert another owner's worktree is clean. The whole attention source SHA256 is 927e668a2dee55f0fc0b5d07f0311e75f03562e38ee13a2ace990762ab89f87f, composed-input SHA256 1920de0d7e9993c09aef93740bc2cfb7dbb68b8e7b2ddbc98e275dd52af9a821. Its owner's reserved-name repair part->partsz is included; no local source repair or algorithm change is hidden in the bridge fixture.

The caller retains the allocator/IR/liveness/graph/CUBIN/private-FP64 checks, then exercises actual policy remainder and matmul-view decisions, attention mode0 plan/refusal paths, mode7 scale validation, and modes22/23 raw integer FP results against the Wolfram bit oracle. Short spans return32 without changing the result or any caller word; untouched slots are checked. The bare ELF has no undefined symbols at all, no interpreter and no TLS. No _exit, setjmp/longjmp, memory helper, 128-bit-division runtime or libc is linked. Raw hosted/bare byte streams must match on each target.

Four exactly-one-site source mutants compile and link under the same bare constraints: policy remainder reversal -> exit14; matmul view edit -> exit15; attention scale acceptance reversal -> exit19; attention packed result change -> exit20. Each is caught before stdout. The baseline snapshots are never mutated. A wrong-result control exits90. This qualifies selected paths of the whole composition, not every mode or the full CUDApp API suite.

Commands and observed results

commands.json contains the actual argument arrays, relevant explicit environment values, rc and receipt-log name for each final command and the two selected red probes. Environment was inherited, not env -i. Final builds use GOMAXPROCS=3, GOFLAGS=-p=3; every test, compiler/linker child and mutant stays inside this device-free namespace:

bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 <command>

There is no rerun outside it. ~ replaces /home/drakestapleton in all published text. Receipt transport verifies each complete raw source byte count before that one HOME-prefix normalization; transfers.json records both byte counts. Command traces encode captured binary stdout as stdout_hex; no executable, NVIDIA binary, cubin, PTX or disassembly is committed. tools-and-source.txt records source and verification-tool custody.

The commands below are the payload after the wrapper; exact environments and full source paths for the composition are in commands.json.

Command / tierrcObserved last lineReceipt
python3 tests/native/test_freestanding.py (OM1 host)0PASS source-swap control refuses original non-pure snapshot; reread mutant admits mismatched source/code and is caughtom1-host.log
python3 tests/native/test_freestanding_f32.py --out /tmp/bh/freestanding-f32-a64-compiled140FP32 bare-ELF PASS line quoted belowfp32-a64.log
Same with --target x86linux --out /tmp/bh/freestanding-f32-x86-compiled140Same FP32 PASS line; EMULATED onlyfp32-x86-emulated.log
python3 tests/native/test_freestanding_om2.py (OM2 host)0Same FP32 PASS line, after the OM2 controlsom2-host.log
python3 tests/native/test_freestanding_aggregate.py --regalloc ~/work/cudastack/lanes/RegAllocOm --core ~/work/cudastack/lanes/CoreUtilOm --target aarch64linux --out /tmp/bh/freestanding-nine-a64 --api ~/work/cudastack/lanes/ApiPlanOm0PASS whole policy/mm/attention without libc: views/rem/private f32/f64, RNE conversion/Newton outputs, bad span untouched; four source mutants caughtnine-a64.log
Same with --target x86linux --out /tmp/bh/freestanding-nine-x860Same whole-composition PASS line; EMULATED onlynine-x86-emulated.log
sh tests/native/v2/run.sh (hosted A5 compiler)1NATIVE-V2 FAIL 1v2-known-fail-one.log
sh tests/native/x86/run.sh /tmp/bh/f32-native-x86-compiled140NATIVE-X86 EMULATED PASS (six languages built and run; native x86 NOT_RUN)x86-emulated.log
python3 tests/native/x86/device.py /tmp/bh/f32-native-device-compiled140NATIVE-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

The exact common FP32 final line is:

PASS FP32 bare ELF: no undefined symbols, interpreter, TLS or libc; raw hosted bytes identical; three source and two generator mutants caught; 14 compiled public float interfaces and scanner-only host helper refused110

Pure AArch64 uses the pinned e5 compiler (SHA256 2c824805...), pure x86 the existing be8c binary. Full hosted AArch64 uses the existing A5 b8f8 binary; the hosted x86-device regression uses the #1050 c5ac binary. Full binary SHA256 values and exact paths appear in tools-and-source.txt; no compiler pin silently changed. The OM1 generator compiler is 734f0a39, not the OM2 compiler.

Two different hoist observations, not a waiver

red-x86-obsolete-hoist-expectation.log records the first x86 gate failing only its old hard-coded claim that hoist.om exported float arrays and must still refuse110. Inspection and the read-only consultant established the decisive point: its sole export hadd takes an editable ulong array plus ulong, returning ulong; FP64/FP32 conversions are private. It therefore belongs in this approved profile.

The correction deletes only the obsolete FREEST_REFUSED constant/comment and its branch. The existing OM2 predicate still requires baseline f637021 110 with empty stdout and candidate 0 with nonempty stdout. It does not skip hoist or accept arbitrary status. All other byte comparisons, baseline pins, exact span-zero-initialization normalization, its per-fixture counts and its one-byte negative control remain untouched. This is a profile-specific expectation change requiring Drake's review, not a new normalization. Generation acceptance alone is not a hoisting/register-preservation qualification.

The distinct full AArch64 V2 gate still reports exactly one unchanged failure:

FAIL hoist writes 0 of x20..x26 and 3 of d8..d15: OMEGA_NATIVE_OMC2 does not hoist (omega-mv perf/omc-loop-checks)
NATIVE-V2 FAIL 1

It was not suppressed, reclassified or changed to green. The separate compiler-profile repair from BridgeV2Fix is not adopted here. The x86 gate's former false refusal assertion is not that AArch64 register-hoist failure. red-before-private-f32.log independently preserves the test-first pre-admission refusal110; preliminary red probes are not final PASS.

Remaining gates and guide delta

  • PASS / EXERCISED: selected AArch64 no-libc and hosted differentials, explicit refusal boundaries, actual nine-unit composition, all named mutants and negative controls.
  • PASS / EMULATED: six-language x86 gate, FP32/nine-unit no-libc differentials and hosted x86-device regression. Physical x86 remains NOT_RUN.
  • FAIL: full AArch64 V2 retains exactly its known single compiler-hoist-pin failure.
  • NOT_RUN: firmware FP setup, physical x86, NVIDIA driver, WC timing, GPU/chip and full CUDApp API acceptance. No GPU window was authorized; no live service was touched.
  • NOT_MERGED / NOT_DEPLOYED: Drake must approve this draft contract/profile and pins.

The harness/encoding guidance delta is the explicit freestanding OM2-array/private-FP32/FP64 profile, integer-only public ABI, inherited FP control, exact NaN-comparison limitations, whole-source host-word refusal, no-libc link requirement and target-specific tool custody. This lane does not own the harness checkout or mounted skills; update the existing aien-dev/omega-harness#181 guide-update issue with the published bridge head and this receipt instead of silently editing global skills. Re-run changed guide examples and refresh pins when Drake approves adoption. No portable converter capability is claimed.