code wiki / _hdl_build / nx_race_vs_c_test.nx

nx_race_vs_c_test.nx

buildroot/runtime/_hdl_build/nx_race_vs_c_test.nx

5843 B131 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind gate/prooftopic race
docsdependenciesstructsconstsfunctions

about

nx_race_vs_c_test.nx -- the ONGOING racing gate: Nishi vs C, 1:1, sovereign. "win over C in an ONGOING fashion" (operator) -- so this is a PERMANENT gate, not a one-shot. It forks+execs both pre-built contestants (the SAME kernel compiled by our nx_cc and by gcc -O2), captures each one's "<checksum> <cycles>" line, and judges. The HARD invariant is CAPABILITY: byte-identical checksum = our codegen did NOT miscompile. Speed/size are REPORTED + tracked, never red-failed -- we already KNOW we trail gcc on raw compute (the stack-machine/no-regalloc tax), and a gate that fails on the known grind would be a false-failing gate (racing doctrine: bake a NON-false-failing gate). It fails ONLY on a correctness break -- the one thing that must never regress while we close the speed gap. Build lane must produce /tmp/race_nishi.elf and /tmp/race_c.elf first (the two contestants). Known answer: byte-identical checksum -> exit 0; prints the board. CITATIONS (real): fair-benchmark methodology -- Curtsinger & Berger, "Stabilizer: Statistically Sound Performance Evaluation," ASPLOS 2013. The energy/time/memory tradeoff this race feeds into -- Pereira et al., "Energy Efficiency across Programming Languages," ACM SLE 2017. The named speed lever -- Poletto & Sarkar, linear-scan register allocation, ACM TOPLAS 1999.

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_race_vs_c_test.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 sys_mmap rk_run_to_file sys_mmap ↻ sys_fork sys_openat_wr sys_exit sys_dup3 sys_close sys_execve sys_wait4 wait_exit_code rk_puts sys_write sys_exit ↻ rk_read_file sys_openat_rd sys_read sys_close ↻ rk_parse_two rk_is_digit rk_emit rk_puts ↻ sys_mmap ↻ sys_write ↻

structs

none

consts

none

functions

24func rk_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 2: rk_emitmain calls 1: sys_write
25func rk_emit(name: *u8, v: i64) -> i64
called by 1: main calls 3: rk_putssys_mmapsys_write
35func rk_is_digit(c: i64) -> i64 { if c < 48 { return 0 } if c > 57 { return 0 } return 1 }
called by 1: rk_parse_two
39func rk_run_to_file(binpath: *u8, outpath: *u8) -> i64
61func rk_read_file(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
75func rk_parse_two(buf: *u8, len: i64, out: *i64) -> i64
called by 1: main calls 1: rk_is_digit
100func main() -> i64