code wiki / (root) / nx_genver.nx

nx_genver.nx

buildroot/runtime/nx_genver.nx

5089 B121 linesdepth 5pulls 9 transitivereach 20 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_genver.nx -- shared differential-verification reporting for the sovereign gen migration. Every op organ in this lane answers the same question -- "does our result match the oracle's, and by how much" -- so the tolerance ladder, the comparison rule and the report format live here rather than being re-typed per organ. The previous generation of verify organs each carried its own copy, which is why they drifted apart in tolerance and in what they printed, and why no two of them could be compared. WHY A DISTRIBUTION AND NOT A VERDICT A bare PASS cannot tell the next change whether it moved the number. These organs report the error distribution across five decades, so a later tweak is measurable against a banked baseline instead of being graded on whether it still says GREEN. WHY THE PASS BAND IS AN ARGUMENT AND NOT A CONSTANT Measured 2026-08-06: the oracle's `mul_mat` against a Q8_0 weight is NOT an f32 matmul. ggml quantizes the ACTIVATIONS too and does a blocked integer dot, so it never computes dequant(W) @ x. An exact f64 reference deviates from the oracle by ~0.52% median / 9.8% max on a Z-Image qkv projection -- and the sovereign f32 organ reproduced that same distribution to within 3 elements in 11,520, i.e. the sovereign matmul is right and the ORACLE is the lower precision one. Hardcoding "GREEN below 1e-2" would fail a CORRECT implementation for being more accurate than the thing it is graded against. ★ A TOLERANCE IS A CLAIM ABOUT THE REFERENCE'S PRECISION, NOT THE IMPLEMENTATION'S. So the caller states the band its comparison is entitled to; the full distribution is always reported regardless, and the band used is echoed so a report can never hide which one it took. COUNTER LAYOUT (caller allocates 8 i64): c[0..4] fail counts at 1e-1, 1e-2, 1e-3, 1e-4, 1e-5 c[5] elements checked c[6] flat index of the first element to exceed the PASS band, or -1 c[7] pass-band index (0 = 1e-1 ... 4 = 1e-5) license_tier: ORIGINAL

dependencies 5 imports · 20 importers

nx_syscalls.nx nx_f32.nx nx_f32_div.nx nx_f32_cvt.nx nx_strconv.nx nx_genver.nx nx_gen_adaln_gate_verify.nx nx_gen_archprobe.nx nx_gen_blockrun.nx nx_gen_ditchain.nx nx_gen_ditfull.nx nx_gen_embed_verify.nx nx_gen_linear_verify.nx nx_gen_lora_repr.nx nx_gen_lora_verify.nx nx_gen_modelid.nx

diagram shows first 10 each side; +0 more imports, +10 more importers in the complete lists below.

imports: nx_syscalls.nxnx_f32.nxnx_f32_div.nxnx_f32_cvt.nxnx_strconv.nx

imported by: nx_gen_adaln_gate_verify.nxnx_gen_archprobe.nxnx_gen_blockrun.nxnx_gen_ditchain.nxnx_gen_ditfull.nxnx_gen_embed_verify.nxnx_gen_linear_verify.nxnx_gen_lora_repr.nxnx_gen_lora_verify.nxnx_gen_modelid.nxnx_gen_pipecheck.nxnx_gen_prenorm_mod_verify.nxnx_gen_qknorm_verify.nxnx_gen_rmsnorm_verify.nxnx_gen_rope_verify.nxnx_gen_sdpa_verify.nxnx_gen_swiglu_verify.nxnx_gen_taedec.nxnx_gen_zoo.nxnx_genblock.nx

structs

none

consts

39const NX_GENVER_NTOL: i64 = 5
40const NX_GENVER_CSIZE: i64 = 8

functions

43func nx_genver_emit(label: *u8, value: i64) -> i64
58func nx_genver_tols(tol: *i64) -> i64
73func nx_genver_exceeds(got: i64, want: i64, tol: i64) -> i64
84func nx_genver_init(c: *i64, pass_idx: i64) -> i64
called by 15: mainmainmainmainmainmain+9
96func nx_genver_tally(c: *i64, tol: *i64, got: i64, want: i64, flat_idx: i64) -> i64
110func nx_genver_report(c: *i64) -> i64
called by 15: mainmainmainmainmainmain+9 calls 1: nx_genver_emit