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
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
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
structs
| none |
consts
| none |
functions
| 24 | func 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 } |
| 25 | func rk_emit(name: *u8, v: i64) -> i64 |
| 35 | func rk_is_digit(c: i64) -> i64 { if c < 48 { return 0 } if c > 57 { return 0 } return 1 } called by 1: rk_parse_two |
| 39 | func rk_run_to_file(binpath: *u8, outpath: *u8) -> i64 |
| 61 | func rk_read_file(path: *u8, buf: *u8, cap: i64) -> i64 |
| 75 | func rk_parse_two(buf: *u8, len: i64, out: *i64) -> i64 |
| 100 | func main() -> i64 |