code wiki / (root) / nx_par_matmul.nx

nx_par_matmul.nx

buildroot/runtime/nx_par_matmul.nx

4311 B96 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind tooltopic par
docsdependenciesstructsconstsfunctions

about

nx_par_matmul.nx -- SOVEREIGN CPU parallelism: matmul across all cores via fork + shared memory, NO 3rd party (operator: "no 3rd party, nishi ecosystem from the hardware rung up"). Pure syscalls -- sys_fork + sys_mmap_shared (children write row-slices of C into shared mem) + sys_wait4 (parent joins). Inner MAC = sovereign SSE (__f32_mul/__f32_add, nx_f32_hw). This is the tractable sovereign speed lever for the forward (the matmul is the bottleneck): serial vs N-worker parallel, measured, bit-verified. license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_f32.nx nx_f32_hw.nx nx_par_matmul.nx

imports: nx_syscalls.nxnx_f32.nxnx_f32_hw.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 f32_of sys_now_ms sys_mmap ↻ sys_clock_gettime_mono matmul_rows sys_mmap_shared sys_fork sys_exit sys_wait4 pm_puts sys_write pm_putn sys_write ↻ sys_mmap ↻

structs

none

consts

10const PM_M: i64 = 384
11const PM_K: i64 = 384
12const PM_N: i64 = 384
13const PM_NW: i64 = 8 // worker forks (>= cores -> measures effective parallelism)

functions

15func pm_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 1: main calls 1: sys_write
16func pm_putn(v: i64) -> i64
called by 1: main calls 2: sys_writesys_mmap
28func matmul_rows(A: *i64, B: *i64, C: *i64, K: i64, N: i64, lo: i64, hi: i64) -> i64
called by 1: main
44func main() -> i64