nx_f32_parity.nx
buildroot/runtime/nx_f32_parity.nx
about
nx_f32_parity.nx -- differential-parity measurement organ: the MEASURED-EXCEED engine for the
Z-Image benchmark (operator 2026-06-30 "use z image as the benchmark... until we exceed them").
Per [[feedback-no-wave-measured-exceed]] an EXCEED is MEASURED head-to-head, never self-graded. This is
the reusable primitive every "our sovereign op vs the sdcpp/ggml oracle" gate composes: feed identical
inputs/weights to our f32 organ AND ggml's op, then nx_f32_parity_check(ours, ref, n, tol) renders a
PASS/FAIL verdict + the max abs error. Reference values are reference KATs extracted from ggml/sdcpp
(the same pattern `nx_q4k_to_f32`'s bit-vs-ggml gate already uses). Parity-first, then exceed.
f32 magnitude compare trick: for FINITE values the bit pattern with the sign bit cleared (raw & 0x7FFFFFFF)
is monotonic in magnitude, so |a-b| as an f32 magnitude pattern is order-comparable as a plain integer,
and clearing the sign of (a-b) yields |a-b| itself as a positive f32 value (returned as max_abs).
ours, ref: flat *i64 f32 bits [n]. tol_abs: f32 (the parity tolerance). out_maxabs[0] <- max |error| (f32).
license_tier: ORIGINAL
dependencies 4 imports · 0 importers
imports: nx_syscalls.nxnx_f32.nxnx_f32_div.nxnx_f32_cvt.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 20 | const NX_F32PAR_FAIL: i64 = 0 |
| 21 | const NX_F32PAR_PASS: i64 = 1 |
functions
| 24 | func nx_f32_parity_check(ours: *i64, ref: *i64, n: i64, tol_abs: i64, out_maxabs: *i64) -> i64 |
| 43 | func main() -> i64 |