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
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
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
structs
| none |
consts
| 13 | const NX_MAGIC_32768: i64 = 32768 |
| 15 | const NX_MAC4_OK: i64 = 0 |
| 16 | const NX_MAC4_ERR: i64 = 1 |
functions
| 19 | func nx_f32_hw_matmul_mac4(a: *i64, b: *i64, c: *i64, m: i64, k: i64, n: i64) -> i64 |
| 47 | func mac4_time(which: i64, A: *i64, B: *i64, C: *i64, N: i64) -> i64 |
| 64 | func main() -> i64 |