code wiki / _hdl_build / nx_f32_hw_matmul_mac4.nx

nx_f32_hw_matmul_mac4.nx

buildroot/runtime/_hdl_build/nx_f32_hw_matmul_mac4.nx

4438 B97 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind tooltopic f32
docsdependenciesstructsconstsfunctions

about

nx_f32_hw_matmul_mac4.nx -- ILP matmul: 4 independent accumulators hide the addss latency. The single-acc inner loop serializes on `acc` (each addss waits ~4 cyc for the previous). Four independent accumulator chains let the CPU pipeline them -> up to ~4x if latency-bound -- and it is PURE .nx (scalar SSE via nx_f32_hw), so NO nx_cc change, NO rebuild, ZERO build risk. The safe win to bank BEFORE the risky packed-SIMD compiler surgery (which adds 4 lanes/instruction on top). Sum order differs from sequential, so f32 results can differ by ROUNDING -- but for small ints (exact) it is bit-identical to nx_f32_matmul/nx_f32_hw_matmul, so the KAT cross-checks exactly. Sovereign: imports nx_f32_hw_matmul (-> nx_f32_hw SSE) + nx_syscalls. license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_f32_hw_matmul.nx nx_syscalls.nx nx_f32_hw_matmul_mac4.nx

imports: nx_f32_hw_matmul.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main hmm_puts sys_write sys_mmap f32_of nx_f32_hw_matmul nx_f32_hw_matmul_mac4 f32_of ↻ f32_add f32_mul sys_exit mac4_time sys_now_ms sys_mmap ↻ sys_clock_gettime_mono nx_f32_hw_matmul ↻ nx_f32_hw_matmul_mac4 ↻ hmm_putn sys_write ↻ sys_mmap ↻

structs

none

consts

13const NX_MAGIC_32768: i64 = 32768
15const NX_MAC4_OK: i64 = 0
16const NX_MAC4_ERR: i64 = 1

functions

19func nx_f32_hw_matmul_mac4(a: *i64, b: *i64, c: *i64, m: i64, k: i64, n: i64) -> i64
called by 2: mac4_timemain calls 3: f32_off32_addf32_mul
47func mac4_time(which: i64, A: *i64, B: *i64, C: *i64, N: i64) -> i64
64func main() -> i64