code wiki / _hdl_build / _xperf003a_gate.nx

_xperf003a_gate.nx

buildroot/runtime/_hdl_build/_xperf003a_gate.nx

9494 B227 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx _xperf003a_gate.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 g_puts sys_write sys_mmap sys_openat_wr g_run sys_fork sys_dup3 sys_execve sys_exit sys_mmap ↻ sys_wait4 sys_close g_slurp sys_openat_rd sys_read sys_close ↻ g_parse_after g_match_at g_putn sys_mmap ↻ sys_write ↻ sys_exit ↻ sys_openat_append g_fputs sys_write ↻ g_fputn sys_mmap ↻ sys_write ↻

structs

none

consts

20const G_N: i64 = 10
21const G_GOLD_CHECKSUM: i64 = 73196
22const G_GOLD_MAXFLIPS: i64 = 38
23const G_MODE_RWX: i64 = 0x1a4 // 0644
24const G_BUFSZ: i64 = 4096

functions

26func 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 }
called by 1: main calls 1: sys_write
27func 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 }
called by 1: main calls 1: sys_write
28func 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 }
called by 1: main calls 2: sys_mmapsys_write
29func 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 }
called by 1: main calls 2: sys_mmapsys_write
33func g_run(path: *u8, argv: *i64, envp: *i64, redir_out: i64) -> i64
48func g_slurp(path: *u8, buf: *u8) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
63func g_match_at(buf: *u8, i: i64, key: *u8) -> i64
called by 1: g_parse_after
74func g_parse_after(buf: *u8, blen: i64, key: *u8, notfound: i64) -> i64
called by 1: main calls 1: g_match_at
106func main() -> i64