_i16dot_minrepro.nx
buildroot/runtime/_i16dot_minrepro.nx
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
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
structs
| none |
consts
| 19 | const MR_N: i64 = 1024 |
| 20 | const MR_HALF: i64 = 512 |
| 21 | const MR_PLANT: i64 = 777 |
| 22 | const MR_W: i64 = 16 |
| 23 | const MR_I16_MOD: i64 = 65536 |
| 24 | const MR_I16_HALF: i64 = 32768 |
| 25 | const MR_BYTE: i64 = 256 |
| 26 | const MR_BIG: i64 = 32767 // the widest i16: 1024 lanes of 32767*32767 sum past int32 (exit 5 guards the hsum) |
functions
| 28 | func 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 |
| 29 | func 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 } |
| 30 | func 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 } |
| 32 | func main() -> i64 |