code wiki / (root) / nx_sum_bench_all.nx

nx_sum_bench_all.nx

buildroot/runtime/nx_sum_bench_all.nx

4295 B119 linesdepth 8pulls 16 transitivereach 0 importersview sourcekind benchtopic sum
docsdependenciesstructsconstsfunctions

about

nx_sum_bench_all.nx -- comprehensive sum-of-N-i64 bench across all NishiLang paths for cross-language comparison. Same workload as sum_c.c (N=1M i64 sum, 100 reps) but exercises every parallelism axis NishiLang ships: 1. scalar single-thread, no SIMD 2. parallel_reduce MIMD across pool workers 3. SIMD-only i64x4 horizontal reduce in chunks of 4 4. parallel + SIMD per-chunk SIMD reduce, parallel across chunks All paths produce bit-exact results vs the scalar reference. Wall-time numbers are reported but qemu interpretive emulation distorts both MIMD (single-CPU emulator) and SIMD (per-lane interpretive cost), so the wall-time signal is noisy -- see docs/PERF_NISHI_VS_C.md for the honest interpretation.

dependencies 7 imports · 0 importers

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

imports: nx_kernel_v2.nxnx_log.nxnx_atom.nxnx_clock.nxnx_thread_pool.nxnx_parallel.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 scalar_sum 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 simd_sum nx_parallel_reduce_sum_sim sys_mmap ↻ nx_atom_load_i64 ↻ _nx_chunk_start ↻ _nx_chunk_end ↻ nx_pool_submit ↻

structs

none

consts

32const N: i64 = 1000000
33const REPS: i64 = 10 // fewer reps than C bench --

functions

36func scalar_sum(arr: *i64) -> i64
called by 1: main
43func simd_sum(arr: *i64) -> i64
called by 1: main
55func iadd(a: i64, b: i64) -> i64 { return a + b }
57func main() -> nx_exit