nx_genver.nx
buildroot/runtime/nx_genver.nx
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
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
| 39 | const NX_GENVER_NTOL: i64 = 5 |
| 40 | const NX_GENVER_CSIZE: i64 = 8 |
functions
| 43 | func nx_genver_emit(label: *u8, value: i64) -> i64 |
| 58 | func nx_genver_tols(tol: *i64) -> i64 |
| 73 | func nx_genver_exceeds(got: i64, want: i64, tol: i64) -> i64 |
| 84 | func nx_genver_init(c: *i64, pass_idx: i64) -> i64 |
| 96 | func nx_genver_tally(c: *i64, tol: *i64, got: i64, want: i64, flat_idx: i64) -> i64 |
| 110 | func nx_genver_report(c: *i64) -> i64 |