code wiki / (root) / nx_conv_speedup.nx

nx_conv_speedup.nx

buildroot/runtime/nx_conv_speedup.nx

3181 B97 linesdepth 7pulls 10 transitivereach 0 importersview sourcekind tooltopic conv
docsdependenciesstructsconstsfunctions

about

THE PAYOFF: a real 2D convolution (1024x1024, 15x15 kernel), run SERIAL then THREADED (nx_thread_pool, 8 workers on disjoint output-row bands -- no shared writes, no atomics), with a measured wall-time speedup. Pointers travel via a ctx struct (NOT module statics -- the compiler has a PRE-EXISTING multi-static bug, proven pre-dating all recent compiler work), which is the same pattern nx_parallel uses.

dependencies 2 imports · 0 importers

nx_thread_pool.nx nx_fmt.nx nx_conv_speedup.nx

imports: nx_thread_pool.nxnx_fmt.nx

imported by: nobody (leaf or entry point)

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

main sys_now_us sys_mmap sys_clock_gettime_mono conv_range nx_pool_new nx_hw_worker_count nx_hw_cpu_count sys_mmap ↻ sys_munmap 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_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_wait nx_atom_load_i64 nx_thread_yield ↻ nx_atom_store_i64 _pool_futex_wait sys_futex_wait nx_pool_shutdown nx_atom_faa_i64 ↻ nx_chan_send ↻ _pool_futex_wake_all ↻ nx_atom_load_i64 ↻ nx_thread_yield ↻ fmt_puts

structs

13struct ConvCtx

consts

8const IMG_W: i64 = 1024
9const IMG_H: i64 = 1024
10const K: i64 = 15
11const NWORK: i64 = 8
20const CONVCTX_BYTES: i64 = 40

functions

22func conv_range(in_p: *i64, out_p: *i64, ker_p: *i64, y0: i64, y1: i64) -> i64
called by 2: conv_taskmain
50func conv_task(ctx_i: i64) -> i64
calls 1: conv_range
56func main() -> i64