code wiki / _hdl_build / _xperf003a_gate.nx
_xperf003a_gate.nx
buildroot/runtime/_hdl_build/_xperf003a_gate.nx
about
_xperf003a_gate.nx -- SOVEREIGN gate for rung X-PERF-003a (CLBG fannkuch-redux
throughput baseline, measure-before-optimize).
(1) Runs the SOVEREIGN-compiled organ /tmp/nx_clbg_fannkuch.sov.elf (the runtime),
parses its (checksum,maxflips,sov_us). Asserts (checksum,maxflips)==golden for
N -> CORRECTNESS GREEN. sov_us came from nx_clock_monotonic_ns() bracketing the
sovereign permutation hot loop INSIDE that organ.
(2) Compiles the equivalent C ref with gcc -O2 (BENCHMARK LANE ONLY -- never the
runtime, like qemu=hardware-align / openssl=crypto-ref), runs it timed the SAME
way (CLOCK_MONOTONIC, same FK_REPEAT), parses ref_us.
(3) ratio_permil = ref_us*1000/sov_us. REPORTED, not asserted to win: sovereign
scalar codegen is expected to trail gcc, and that gap IS the X-PERF-003 target.
(4) Appends to knowledge/status/clbg_fannkuch.log:
CLBGFANNKUCH n=<N> sov_us=<..> ref_us=<..> ratio_permil=<..> checksum=<..> maxflips=<..> verdict=MEASURED
PASS = correctness==golden AND an honest MEASURED ratio line is emitted.
spec: knowledge/specs/2026-06-13-clbg-fannkuch-throughput.md
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
| 20 | const G_N: i64 = 10 |
| 21 | const G_GOLD_CHECKSUM: i64 = 73196 |
| 22 | const G_GOLD_MAXFLIPS: i64 = 38 |
| 23 | const G_MODE_RWX: i64 = 0x1a4 // 0644 |
| 24 | const G_BUFSZ: i64 = 4096 |
functions
| 26 | func g_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 27 | func g_fputs(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 } |
| 28 | func g_putn(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(1,bb,k); return 0 } |
| 29 | func g_fputn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(fd,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(fd,bb,k); return 0 } |
| 33 | func g_run(path: *u8, argv: *i64, envp: *i64, redir_out: i64) -> i64 |
| 48 | func g_slurp(path: *u8, buf: *u8) -> i64 |
| 63 | func g_match_at(buf: *u8, i: i64, key: *u8) -> i64 called by 1: g_parse_after |
| 74 | func g_parse_after(buf: *u8, blen: i64, key: *u8, notfound: i64) -> i64 |
| 106 | func main() -> i64 |