code wiki / (root) / _q8blkdot_minrepro.nx

_q8blkdot_minrepro.nx

buildroot/runtime/_q8blkdot_minrepro.nx

3539 B61 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

_q8blkdot_minrepro.nx -- the feature program for __q8blk_i16dot (search R0s-b, 2026-09-17): one Q8_0 block's dot, codes:*i8[32] . x:*i16[32] -> i64, the int8 codes sign-extended IN REGISTER (vpmovsxbw) so the block-native kernel never stores an i16 copy of the weights. 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 32-lane signed ramp disagrees with the scalar sum exit 2 = a planted +1 in one code lane does not move the dot by exactly that lane of x (a lane was skipped) exit 3 = a planted +1 in one x lane does not move the dot by exactly that lane's code (the other operand) exit 4 = the reference is zero (a vacuous fixture; the ramps are built so it cannot be) exit 5 = the widest legal block (every code 127, every x 32767) disagrees: 32 * 127 * 32767 = 133,153,088 exit 6 = the most negative code (-128) against the most negative x (-32768) disagrees: the sign extension is two's complement on both sides, 32 * 4,194,304 = 134,217,728 The contract the builtin holds the caller to: exactly 32 lanes, codes are int8 two's complement, x is i16. expect_exit: 0 license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx _q8blkdot_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_put8 mr_put16 mr_ref mr_get8 mr_get16 mr_get8 ↻ mr_get16 ↻

structs

none

consts

21const MR_LANES: i64 = 32
22const MR_HALF: i64 = 16
23const MR_PLANT: i64 = 21
24const MR_I16_MOD: i64 = 65536
25const MR_I16_HALF: i64 = 32768
26const MR_BYTE: i64 = 256
27const MR_I8_HALF: i64 = 128
28const MR_CODE_MAX: i64 = 127
29const MR_CODE_MIN: i64 = 0 - 128
30const MR_X_MAX: i64 = 32767
31const MR_X_MIN: i64 = 0 - 32768
32const MR_X_STEP: i64 = 1000

functions

34func mr_put16(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
35func mr_get16(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
36func mr_put8(p: *u8, i: i64, v: i64) -> i64 { var u: i64 = v; if u < 0 { u = u + MR_BYTE } p[i] = (u % MR_BYTE) as u8; return 0 }
called by 1: main
37func mr_get8(p: *u8, i: i64) -> i64 { var u: i64 = (p[i] as i64) & 0xff; if u >= MR_I8_HALF { u = u - MR_BYTE } return u }
called by 2: mr_refmain
38func mr_ref(codes: *u8, x: *u8) -> i64 { var s: i64 = 0; var i: i64 = 0; while i < MR_LANES { s = s + mr_get8(codes, i) * mr_get16(x, i); i = i + 1 } return s }
called by 1: main calls 2: mr_get8mr_get16
40func main() -> i64