code wiki / (root) / _i16dot_minrepro.nx

_i16dot_minrepro.nx

buildroot/runtime/_i16dot_minrepro.nx

2887 B50 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

_i16dot_minrepro.nx -- the feature program for __i16_dot (R0r-b, 2026-09-17): the compiler's whole-chunk integer dot, a:*i16[n] . b:*i16[n] -> i64 with the int32x8 accumulator register-resident and one horizontal sum per call. nx_cc_equiv_gate builds this with the CHALLENGER only (a baseline that lacks the builtin cannot), runs it, and requires exit 0. Every arm is checked against an exact scalar reference read back from the same bytes: exit 1 = the 1024-lane signed ramp disagrees with the scalar sum exit 2 = the smallest legal call (one 16-lane trip) disagrees exit 3 = a planted +1 in one lane of a does not move the dot by exactly that lane of b (a lane was skipped) exit 4 = the reference is zero (a vacuous fixture; the ramp is built so it cannot be) exit 5 = the sum of eight int32 lanes exceeds int32 and the builtin's int64 horizontal sum lost it The contract the builtin holds the caller to: n is a POSITIVE multiple of 16, and n is bounded so no int32 lane overflows (nx_nofloat_llm keeps n at NF_CHUNK_K = 1024 lanes of 12-bit values). expect_exit: 0 license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx _i16dot_minrepro.nx

imports: nx_syscalls.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 nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ mr_put mr_ref mr_get mr_get ↻

structs

none

consts

19const MR_N: i64 = 1024
20const MR_HALF: i64 = 512
21const MR_PLANT: i64 = 777
22const MR_W: i64 = 16
23const MR_I16_MOD: i64 = 65536
24const MR_I16_HALF: i64 = 32768
25const MR_BYTE: i64 = 256
26const MR_BIG: i64 = 32767 // the widest i16: 1024 lanes of 32767*32767 sum past int32 (exit 5 guards the hsum)

functions

28func mr_put(p: *u8, i: i64, v: i64) -> i64 { var u: i64 = v; if u < 0 { u = u + MR_I16_MOD } p[i*2] = (u % MR_BYTE) as u8; p[i*2+1] = ((u / MR_BYTE) % MR_BYTE) as u8; return 0 }
called by 1: main
29func mr_get(p: *u8, i: i64) -> i64 { var u: i64 = (p[i*2] as i64) + (p[i*2+1] as i64) * MR_BYTE; if u >= MR_I16_HALF { u = u - MR_I16_MOD } return u }
called by 2: mr_refmain
30func mr_ref(a: *u8, b: *u8, n: i64) -> i64 { var s: i64 = 0; var i: i64 = 0; while i < n { s = s + mr_get(a, i) * mr_get(b, i); i = i + 1 } return s }
called by 1: main calls 1: mr_get
32func main() -> i64