code wiki / _hdl_build / nx_race_native.nx

nx_race_native.nx

buildroot/runtime/_hdl_build/nx_race_native.nx

3192 B50 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic race
docsdependenciesstructsconstsfunctions

about

nx_race_native.nx -- "OURS" in the cross-language RACE: the SAME workload as the IR program, compiled SOVEREIGN (nx_cc -> nxasm_x86, no gcc) and run as a direct native loop. Timed head-to-head vs the exported C/JS/Python/Perl/Java versions. The answer must match the Nishi IR-interpreted truth and every exported language (correctness); wall-time shows where our output sits vs mainstream toolchains. license_tier: ORIGINAL ⚠⚠HEADER CORRECTED 2026-08-14 -- IT DESCRIBED A DIFFERENT PROGRAM THAN THE ONE BELOW, THREE WAYS: it claimed the workload was "sum of i for 1..120,000,000"; the code runs a 50,000,000-iteration LEHMER step, not a sum; and the quoted answer 200000010000000 is the sum 1..20,000,000 (n(n+1)/2), matching NEITHER. For a benchmark whose entire claim is that every language runs THE SAME WORKLOAD, a stale header is not cosmetic: anyone porting from the comment implements a different program and the race silently compares two workloads. ★★★A CROSS-LANGUAGE BENCHMARK'S HEADER IS PART OF ITS CONTRACT, AND A CONTRACT THAT DISAGREES WITH THE CODE IS WORSE THAN NO CONTRACT -- THE READER TRUSTS IT PRECISELY BECAUSE IT IS SPECIFIC. ★THE CORRECT ANSWER, MEASURED 2026-08-14 BY RUNNING IT: 668950819 (seed h=1, RN_ITERS Lehmer steps). The old header quoted 200000010000000, which is the sum 1..20,000,000 and matches nothing this program computes. A stated answer is the ONLY part of a cross-language contract a port can actually check itself against, so a wrong one is worse than none: it certifies a mismatched port as correct. ⚠OWED: the exported C/JS/Python/Perl/Java ports must be read to confirm they run THIS loop (same multiplier, same modulus, same iteration count) and produce 668950819. Until that is checked the race's comparability is asserted, not proven -- and this header is no longer the evidence for it.

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_race_native.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main putn sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ sys_write ↻ sys_write ↻

structs

none

consts

27const RN_ITERS: i64 = 50000000 // loop count -- shared with every exported port
28const RN_MINSTD_MULT: i64 = 48271 // Park-Miller revised multiplier
29const RN_MINSTD_MOD: i64 = 2147483647 // 2^31 - 1, Mersenne prime modulus

functions

30func putn(v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
43func main() -> i64
calls 2: putnsys_write