code wiki / (root) / nx_f32_parity.nx

nx_f32_parity.nx

buildroot/runtime/nx_f32_parity.nx

3451 B70 linesdepth 4pulls 6 transitivereach 0 importersview sourcekind tooltopic f32
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_f32.nx nx_f32_div.nx nx_f32_cvt.nx nx_f32_parity.nx

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

main sys_mmap nx_f32_div nx_f32_classify nx_f32_exp_field nx_f32_mant_field nx_f32_sign nx_f32_mant_field ↻ nx_f32_exp_field ↻ nx_i32_to_f32 nx_f32_parity_check nx_f32_sub nx_f32_add nx_f32_classify ↻ nx_f32_sign ↻ nx_f32_mant_field ↻ nx_f32_exp_field ↻ nx_f32_neg nx_f32_add ↻

structs

none

consts

20const NX_F32PAR_FAIL: i64 = 0
21const NX_F32PAR_PASS: i64 = 1

functions

24func nx_f32_parity_check(ours: *i64, ref: *i64, n: i64, tol_abs: i64, out_maxabs: *i64) -> i64
called by 1: main calls 1: nx_f32_sub
43func main() -> i64