code wiki / (root) / nx_q8_mix_ab.nx

nx_q8_mix_ab.nx

buildroot/runtime/nx_q8_mix_ab.nx

4906 B128 linesdepth 10pulls 30 transitivereach 0 importersview sourcekind tooltopic q8
docsdependenciesstructsconstsfunctions

about

nx_q8_mix_ab.nx -- same-process, same-load A/B of the REAL per-layer block matmul mix (Qwen2.5-0.5B: W_q/W_k/W_v/W_o/W_gate/W_up/W_down), m=1 decode. A = force ALL through the pool (old behavior). B = threshold-routed (small -> single-thread, big -> pool = new behavior). Run back-to-back under IDENTICAL host load so the RATIO is noise-immune (absolute forward benches are not -- this box runs concurrent sessions). Reports total us for one "layer mix" repeated NLAY times, both ways, + the speedup. license_tier: ORIGINAL expect_exit: 0

dependencies 8 imports · 0 importers

nx_syscalls.nx nx_tier.nx nx_le.nx nx_f32.nx nx_f32_cvt.nx nx_thread_pool.nx nx_f32_lazy_weight.nx nx_fmt.nx nx_q8_mix_ab.nx

imports: nx_syscalls.nxnx_tier.nxnx_le.nxnx_f32.nxnx_f32_cvt.nxnx_thread_pool.nxnx_f32_lazy_weight.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 ab_lcg nx_i32_to_f32 ab_weight sys_mmap ↻ ab_lcg ↻ nx_f32_lazy_weight_new_q8_ sys_mmap ↻ nx_lw_shared_pool nx_pool_is_native sys_now_us sys_mmap ↻ sys_clock_gettime_mono _lw_q8_0_matmul_pool_force nx_lw_shared_pool ↻ _q8st_apk sys_mmap ↻ _fq4m_pack_a _q8mt_ctxs 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 ↻ nx_thread_yield ↻ nx_atom_store_i64 _pool_futex_wait sys_futex_wait _lw_q8_0_matmul nx_pool_is_native ↻ _lw_q8_0_matmul_pteam

structs

none

consts

18const HID: i64 = 896
19const FFN: i64 = 4864
20const KVD: i64 = 128
21const Q8B: i64 = 34
22const Q8V: i64 = 32
23const NLAY: i64 = 24

functions

25func ab_nl() -> i64 { fmt_puts("\n" as *u8); return 0 }
called by 1: main calls 1: fmt_puts
26func ab_lcg(s: i64) -> i64 { var v: i64 = s * 1103515245 + 12345; v = v & 2147483647; return v }
called by 2: ab_weightmain
27func ab_weight(k: i64, n: i64, seed: i64) -> *NxF32LazyWeight
46func main() -> i64