code wiki / (root) / nx_natbw_mt.nx

nx_natbw_mt.nx

buildroot/runtime/nx_natbw_mt.nx

3235 B95 linesdepth 5pulls 5 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_natbw_mt.nx -- MULTI-THREAD memory-bandwidth probe (native-vs-WSL2). N threads each stream their OWN 64MB buffer (4-acc, BW_PASSES times) and set a done-flag; main spins until all set (no join syscall -> works identically on Linux clone AND native CreateThread). Aggregate traffic = N*PASSES*64MB. Timing is EXTERNAL (Measure-Command / date). Threads spawn via sys_thread_create, a NAMED shim the native-PE emitter PATCHES to a CreateThread thunk (Linux path = nx_thread_spawn/clone). This is the decisive test: does native MT bandwidth scale past WSL2's ~9.5 GB/s pool plateau toward gcc's ~39 GB/s? license_tier: ORIGINAL expect_exit: 0

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_thread.nx nx_natbw_mt.nx

imports: nx_syscalls.nxnx_thread.nx

imported by: nobody (leaf or entry point)

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

main sys_mmap sys_thread_create nx_thread_spawn sys_mmap ↻ sys_write sys_exit

structs

none

consts

14const BW_MAGIC_1048576: i64 = 1048576
16const BW_PER: i64 = 67108864 // 64MB per thread (> L3 slice -> DRAM-bound)
17const BW_PASSES: i64 = 24
18const BW_NT: i64 = 16 // threads (box has 20 logical cores)

functions

21func bw_worker(ctx: i64) -> i64
51func sys_thread_create(argptr: i64) -> i64
called by 1: main calls 1: nx_thread_spawn
56func main() -> i64