code wiki / (root) / nx_q8_0_simd_gate.nx

nx_q8_0_simd_gate.nx

buildroot/runtime/nx_q8_0_simd_gate.nx

5702 B164 linesdepth 8pulls 18 transitivereach 0 importersview sourcekind gate/prooftopic q8
docsdependenciesstructsconstsfunctions

about

nx_q8_0_simd_gate.nx -- does the SIMD __f32_i8dot32 fused Q8_0 dequant-dot WIN? Q8_0 has NO nibble unpack (int8 directly), so the intrinsic applies cleanly. lm_head is Q8_0 (136M values, 143ms in the forward, memory-bound). Threaded Q8_0-fused vs F32-pool at ~lm_head shape (m=1, k=896, big n). Ratio host-noise-tolerant. NO forward changes. 1 Q8_0-fused == F32-pool bit-exact (exact-int regime) 2 threaded ratio: WIN prints if >= 1.0x lineage_id: q8_0_simd_gate_v1

dependencies 9 imports · 0 importers

nx_syscalls.nx nx_tier.nx nx_le.nx nx_f32.nx nx_f32_cvt.nx nx_q8_0_to_f32.nx nx_thread_pool.nx nx_f32_matmul_t.nx nx_fmt.nx nx_q8_0_simd_gate.nx

imports: nx_syscalls.nxnx_tier.nxnx_le.nxnx_f32.nxnx_f32_cvt.nxnx_q8_0_to_f32.nxnx_thread_pool.nxnx_f32_matmul_t.nxnx_fmt.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 q_fill_weight q_lcg q_fill_a q_lcg ↻ nx_i32_to_f32 nx_q8_0_to_f32 _nx_q8_0_block_to_f32 nx_le_read_u16 nx_f16_to_f32 nx_le_read_u8 nx_pool_new nx_hw_worker_count nx_hw_cpu_count sys_mmap ↻ sys_munmap sys_mmap ↻ nx_chan_new sys_mmap ↻ _nx_chan_cell sys_thread_create nx_thread_spawn sys_mmap ↻ nx_thread_spawn_fn sys_mmap ↻ nx_f32_matmul_t_pool sys_mmap ↻ nx_pool_n_completed nx_atom_load_i64 nx_pool_submit nx_atom_faa_i64 nx_chan_send nx_chan_try_send _nx_chan_cell ↻ nx_thread_yield _pool_futex_wake_all sys_futex_wake nx_pool_wait nx_atom_load_i64 ↻

structs

27struct Q8Ctx { qbuf: i64, aptr: i64, cptr: i64, k: i64, n: i64, jlo: i64, jhi: i64 }

consts

21const QK: i64 = 896
22const QN: i64 = 32768
23const QREPS: i64 = 60
24const Q8B: i64 = 34
25const Q8V: i64 = 32
28const Q8CTX_BYTES: i64 = 56

functions

30func q_lcg(s: i64) -> i64 { var v: i64 = s * 1103515245 + 12345; v = v & 2147483647; return v }
32func q_fill_weight(w: *u8, seed: i64) -> i64
called by 1: main calls 1: q_lcg
50func q_fill_a(p: *i64, count: i64, seed: i64) -> i64
called by 1: main calls 2: q_lcgnx_i32_to_f32
57func q8_0_dot(qbuf: *u8, qoff: i64, Apk: *u8, k: i64) -> i64
called by 1: q8_task calls 2: nx_f16_to_f32nx_le_read_u16
73func q8_task(ctx_i: i64) -> i64
calls 1: q8_0_dot
87func q8_pool_matmul(pool: *NxThreadPool, qbuf: *u8, Apk: *u8, C: *i64, k: i64, n: i64) -> i64
110func q_nl() -> i64 { fmt_puts("\n" as *u8); return 0 }
called by 1: main calls 1: fmt_puts
112func main() -> i64