code wiki / (root) / nx_parallel_simd_reduce.nx

nx_parallel_simd_reduce.nx

buildroot/runtime/nx_parallel_simd_reduce.nx

3953 B94 linesdepth 8pulls 16 transitivereach 0 importersview sourcekind tooltopic parallel
docsdependenciesstructsconstsfunctions

about

nx_parallel_simd_reduce.nx -- proof of L7 x L8 composition. nx_parallel_reduce_i64 splits the array across worker threads; each worker reduces its chunk using __simd_vreduce_sum_i64_x4 (4 lanes at a time). The orchestrator combines per-chunk results into the final sum. Bit-exact vs scalar baseline. In Flynn-taxonomy terms this is exactly the HPC stack pattern the user named: MIMD across cores + SIMD inside each core = N_cores x 4-lane speedup over scalar single-core on real silicon. Under qemu the MIMD axis is fake (single CPU) and the SIMD axis is interpretive overhead, so the wall-time will LOSE vs scalar -- but the CORRECTNESS gate is hard.

dependencies 7 imports · 0 importers

nx_kernel_v2.nx nx_log.nx nx_atom.nx nx_thread_pool.nx nx_parallel.nx nx_clock.nx nx_hw.nx nx_parallel_simd_reduce.nx

imports: nx_kernel_v2.nxnx_log.nxnx_atom.nxnx_thread_pool.nxnx_parallel.nxnx_clock.nxnx_hw.nx

imported by: nobody (leaf or entry point)

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

main nx_hw_worker_count nx_hw_cpu_count sys_mmap sys_munmap nx_pool_new nx_hw_worker_count ↻ 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_clock_monotonic_ns sys_mmap ↻ sys_clock_gettime_mono nx_parallel_reduce_i64 sys_mmap ↻ nx_atom_load_i64 _nx_chunk_start _nx_chunk_end 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_shutdown nx_atom_faa_i64 ↻ nx_chan_send ↻ _pool_futex_wake_all ↻ nx_atom_load_i64 ↻ nx_thread_yield ↻

structs

none

consts

29const N: i64 = 65536

functions

39func scalar_add(acc: i64, x: i64) -> i64 { return acc + x }
41func main() -> nx_exit