code wiki / _hdl_build / nx_cost_race_test.nx
nx_cost_race_test.nx
buildroot/runtime/_hdl_build/nx_cost_race_test.nx
about
nx_cost_race_test.nx -- the team judges by COST, not just instruction count, reading the
latency of BOTH its own emitted code and the competitors' (gcc, clang) straight from the
machine code. This is the team applying, ITSELF, the "count != cost" judgment I used to
supply by hand: clang's x*100 imul is 1 insn but ~3 cycles, vs the team's 3 one-cycle leas,
so by COST it is a TIE, not a loss. Gate: every team sequence verified by execution AND
both competitors costed -> the team raced correctly on the honest metric. exit 0.
dependencies 4 imports · 0 importers
imports: nx_mulchain.nxnx_superopt_emit.nxnx_engineer_crash.nxnx_gcc_race.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
| 13 | func cr_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 14 | func cr_num(v: i64) -> i64 |
| 23 | func 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 |
| 24 | func cr_write(path: *u8, buf: *u8, len: i64) -> i64 { let fd: i64 = sys_openat_wr(path, 0x1a4); if fd < 0 { return 0 - 1 } sys_write(fd, buf, len); sys_close(fd); return 0 } |
| 25 | func cr_build_c(c: i64, path: *u8) -> i64 |
| 37 | func cr_min(a: i64, b: i64) -> i64 { if b > 0 { if b < a { return b } } return a } called by 1: cr_one |
| 40 | func cr_one(c: i64, gccpath: *u8, res: *i64) -> i64 |
| 68 | func run_all(ks: *i64, nk: i64, gccpath: *u8, mat: *i64, r: *i64) -> i64 |
| 81 | func report(ks: *i64, nk: i64, mat: *i64) -> i64 |
| 100 | func cr_main(r: *i64) -> i64 |
| 112 | func main() -> i64 |