code wiki / _hdl_build / nx_superopt_race_test.nx

nx_superopt_race_test.nx

buildroot/runtime/_hdl_build/nx_superopt_race_test.nx

4471 B98 linesdepth 4pulls 5 transitivereach 0 importersview sourcekind gate/prooftopic superopt
docsdependenciesstructsconstsfunctions

about

nx_superopt_race_test.nx -- the team SYNTHESIZES + SUPEROPTIMIZES + EMITS real machine code, proven 1:1 by EXECUTION, ready to race gcc -O2. For each kernel x*C: 1. so_find synthesizes the SHORTEST program (provably minimal over its ISA) 2. se_emit_full emits competitive x86-64 (lea fusion + in-place reuse) 3. eng_link + eng_run assemble and RUN it; the exit byte is sum(synth(d)) over HELD-OUT inputs d -- compared to (sum d*C)&255, so a match proves BOTH that the synthesis generalizes (not overfit) AND that the emit is faithful. Prints the team's instruction count per kernel (the number for the gcc -O2 race). Gate: every kernel verifies 1:1 -> exit 0.

dependencies 2 imports · 0 importers

nx_superopt_emit.nx nx_engineer_crash.nx nx_superopt_race_test.nx

imports: nx_superopt_emit.nxnx_engineer_crash.nx

imported by: nobody (leaf or entry point)

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

main rp_puts race_one se_emit_full se_str se_num se_emit_synth so_is_shift se_str ↻ se_rn se_num ↻ se_slot_isreg se_slot se_str ↻ se_rn ↻ se_opmn doc_emit_write sys_openat_wr eng_link sys_mmap sys_fork sys_openat_wr ↻ sys_dup3 sys_close sys_execve sys_exit sys_wait4 eng_run sys_mmap ↻ sys_fork ↻ sys_openat_wr ↻ sys_dup3 ↻ sys_close ↻ sys_execve ↻ sys_exit ↻ sys_wait4 ↻ rp_num rp_puts ↻ tally

structs

none

consts

none

functions

14func rp_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: rp_nummain
15func rp_num(v: i64) -> i64
called by 1: main calls 1: rp_puts
24func tally(r: *i64, n: i64) -> i64 { var ec: i64 = 0; var i: i64 = 0; while i < n { if r[i] != 1 { if ec == 0 { ec = i + 1 } } i = i + 1 } return ec }
called by 1: main
27func doc_emit_write(path: *u8, buf: *u8, len: i64) -> i64
called by 1: race_one calls 1: sys_openat_wr
34func race_one(c: i64, res: *i64) -> i64
70func main() -> i64