nx_nofloat_w4_gemm_gate.nx
buildroot/runtime/nx_nofloat_w4_gemm_gate.nx
about
nx_nofloat_w4_gemm_gate.nx -- THE DECISIVE W4A16 EXPERIMENT (de-risks the inference-speed arc before any
core-engine change). Decode is memory-bound (baseline: i8 3x faster than i32 = 4x fewer weight bytes). W4A16
stores weights as 4-bit (0.5 B/weight = HALF of i8) -> less memory read, but needs extra 4-bit unpack. Q: does
the halved weight-read beat the unpack cost on the REAL decode shape (matvec: 1 x K activation * N x K weights)?
This gate builds both paths (i8-weight and 4-bit-weight, SAME __i16x16_madd inner product), checks correctness
(both approximate the int16 reference within quant error), and TIMES them. Verdict decides whether to build the
full W4 kernel (and whether it needs SIMD-unpack primitives). Isolated -- touches NO serve code. license_tier: ORIGINAL expect_exit: 0
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
| none |
functions
| 10 | func gp_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){ n=n+1 } sys_write(1,s,n); return 0 } |
| 11 | func gp_n(v: i64) -> i64 |
| 21 | func gp_iabs(x: i64) -> i64 { if x<0 { return 0-x } return x } called by 1: main |
| 22 | func i32x8_hsum(acc: *u8) -> i64 { let p: *i32=acc as *i32; var s: i64=0; var i: i64=0; while i<8 { s=s+(p[i] as i64); i=i+1 } return s } called by 1: main |
| 23 | func now_ms() -> i64 { let ts: *i64=sys_mmap(16) as *i64; sys_clock_gettime_mono(ts); return ts[0]*1000 + ts[1]/1000000 } |
| 26 | func lcg(st: *i64) -> i64 { st[0] = (st[0]*6364136223846793005 + 1442695040888963407) & 0x7FFFFFFFFFFFFFFF; return st[0] } called by 1: main |
| 28 | func main() -> i64 |