code wiki / _hdl_build / nx_research_integrate.nx

nx_research_integrate.nx source

↩ module page · 82 lines · 7747 B

1// nx_research_integrate.nx -- the INTEGRATED research/benchmark loop (operator: "integrate the fetch systems -- what 2// we HAVE vs what we NEED vs more research, iterating toward s-class exceed, grounded in real tools like Unsloth 3// (renamed from nx_research_ledger to un-shadow the distinct RESEARCH_MEMORY library runtime/nx_research_ledger.nx -- 4// this is a research STATUS REPORT, that is an append-only findings LEDGER; two different capabilities, one name). 5// that test speed + capabilities"). For each domain it joins: HAVE (a gate status-log exists?), RESEARCHED (counts 6// the REAL fetched/*.raw corpus by prefix via getdents64 -- this is the fetch system integrated), the BENCH-TOOL 7// (the incumbents' own yardstick to measure exceed by), and the NEED. Then it prints the prioritized NEXT actions. 8// T1 the corpus is really read (sum of researched > 30). T2 >=6 domains have research. 9// T3 the "tools that test speed+capabilities" ask is met: Unsloth (eff_) AND a bench-suite (bt_) are grounded. 10// expect_exit: 0 Sovereign: nx_syscalls (getdents64 dir-read pattern from nx_claude_bridge). 11import "nx_syscalls.nx" 12const K_MAGIC_1048576: i64 = 1048576 13 14func 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 } 15func g_pn(v: i64) -> i64 { let b: *u8=sys_mmap(28); var x: i64=v; if x<0{b[0]=45;sys_write(1,b,1);x=0-x} if x==0{b[0]=48;sys_write(1,b,1);return 0} var d: i64=0; var y: i64=x; while y>0{d=d+1;y=y/10} var i: i64=d-1; y=x; while i>=0{b[i]=(48+(y%10)) as u8;y=y/10;i=i-1} sys_write(1,b,d); return 0 } 16func ck(name: *u8, c: i64) -> i64 { if c==1 { g_puts(" PASS " as *u8) } else { g_puts(" FAIL " as *u8) } g_puts(name); g_puts("\n" as *u8); return c } 17func have(path: *u8) -> i64 { let fd: i64=sys_openat_rd(path); if fd<0 { return 0 } sys_close(fd); return 1 } 18func starts_with(db: *u8, off: i64, pre: *u8) -> i64 { var i: i64=0; while pre[i]!=(0 as u8) { if db[off+i]!=pre[i] { return 0 } i=i+1 } return 1 } 19// count files in `dir` whose name starts with `pre` -- reads the REAL corpus (getdents64 loop). 20func count_prefix(dir: *u8, pre: *u8) -> i64 { 21 let fd: i64=sys_openat_rd(dir); if fd<0 { return 0-1 } 22 let db: *u8=sys_mmap(K_MAGIC_1048576); var total: i64=0; var go: i64=1 23 while go==1 { 24 let nb: i64=sys_getdents64(fd, db, K_MAGIC_1048576) 25 if nb<=0 { go=0 } else { 26 var off: i64=0 27 while off<nb { 28 let reclen: i64=(db[off+16] as i64)+((db[off+17] as i64)*256) 29 if reclen<=0 { off=nb } else { if starts_with(db, off+19, pre)==1 { total=total+1 } off=off+reclen } 30 } 31 } 32 } 33 sys_close(fd); return total 34} 35// one ledger row: prints HAVE / RESEARCHED / TOOL / NEED ; returns the research count. 36func row(label: *u8, statuslog: *u8, pre: *u8, tool: *u8, need: *u8) -> i64 { 37 g_puts(" "); g_puts(label); g_puts(" HAVE=" as *u8) 38 if statuslog[0]==(0 as u8) { g_puts("(census)" as *u8) } else { if have(statuslog)==1 { g_puts("GREEN " as *u8) } else { g_puts("-- " as *u8) } } 39 let c: i64=count_prefix("knowledge/fetched/" as *u8, pre) 40 g_puts(" RSCH="); g_pn(c); g_puts("("); g_puts(pre); g_puts("*) TOOL="); g_puts(tool); g_puts("\n NEED: "); g_puts(need); g_puts("\n" as *u8) 41 return c 42} 43 44func main() -> i64 { 45 g_puts("nx_research_ledger (INTEGRATED: HAVE vs NEED vs RESEARCHED corpus vs the real speed/capability tools -> iterate to s-class)\n" as *u8) 46 var pass: i64=0; var total: i64=0 47 g_puts(" == per-domain ledger (RSCH = real fetched/*.raw count via getdents64) ==\n" as *u8) 48 var sum: i64=0; var dwith: i64=0 49 let cAI: i64=row("AI / no-float ML " as *u8, "" as *u8, "eff_" as *u8, "Unsloth + MLPerf(bt_mlperf)" as *u8, "own-LLM no-float TRAINING -- the biggest gap" as *u8); sum=sum+cAI; if cAI>0 {dwith=dwith+1} 50 let cSH: i64=row("SHELL " as *u8, "knowledge/status/shell.log" as *u8, "sh_" as *u8, "hyperfine / POSIX suite " as *u8, "substantially HAVE (drivable, benchmarked)" as *u8); sum=sum+cSH; if cSH>0 {dwith=dwith+1} 51 let cRX: i64=row("REGEX " as *u8, "knowledge/status/regex_vm.log" as *u8, "rx_" as *u8, "re2 benchmark set " as *u8, "unify the 2 engines + wire VM into grep" as *u8); sum=sum+cRX; if cRX>0 {dwith=dwith+1} 52 let cOS: i64=row("OS-CORE " as *u8, "knowledge/status/os_compete.log" as *u8, "os_" as *u8, "SPEC CPU + Phoronix(bt_spec)" as *u8, "deeper layers: real-MMU/journaling/liveness" as *u8); sum=sum+cOS; if cOS>0 {dwith=dwith+1} 53 let cGX: i64=row("GRAPHICS " as *u8, "knowledge/status/raster.log" as *u8, "gx_" as *u8, "3DMark / glmark(bt_3dmark) " as *u8, "3D pipeline + parallelism + GPU accel" as *u8); sum=sum+cGX; if cGX>0 {dwith=dwith+1} 54 let cEF: i64=row("EXEC-FORMAT " as *u8, "knowledge/status/nxe.log" as *u8, "ef_" as *u8, "binary size + load-time bench" as *u8, "native .nxe emit + native loader/boot" as *u8); sum=sum+cEF; if cEF>0 {dwith=dwith+1} 55 let cGD: i64=row("GPU-DRIVER " as *u8, "" as *u8, "gd_" as *u8, "glmark / Phoronix(bt_phoronix)" as *u8, "vendor framework + real-hw (NEVER-BRICK)" as *u8); sum=sum+cGD; if cGD>0 {dwith=dwith+1} 56 let cBT: i64=row("BENCH-TOOLS(meta)" as *u8, "" as *u8, "bt_" as *u8, "the yardsticks themselves " as *u8, "wire each tool's metric into its bench" as *u8); sum=sum+cBT; if cBT>0 {dwith=dwith+1} 57 g_puts(" -- tracked research corpus across these domains = "); g_pn(sum); g_puts(" sources; domains with research = "); g_pn(dwith); g_puts("/8\n" as *u8) 58 59 g_puts(" >> NEXT ACTIONS (iterate toward s-class exceed, priority order):\n" as *u8) 60 g_puts(" 1. AI: build own-LLM no-float TRAINING; MEASURE speed vs Unsloth + capability vs MLPerf (the named yardsticks).\n" as *u8) 61 g_puts(" 2. GPU-DRIVER: finish the never-brick vendor framework (nx_gpu_driver) -> MEASURE vs glmark/Phoronix on real hw.\n" as *u8) 62 g_puts(" 3. GRAPHICS: 3D pipeline + parallel raster -> MEASURE vs 3DMark/glmark (fps + determinism).\n" as *u8) 63 g_puts(" 4. OS-CORE: close deeper layers -> MEASURE vs SPEC/Phoronix (real perf, not just feature parity).\n" as *u8) 64 g_puts(" 5. EXEC-FORMAT: native .nxe emit + loader -> MEASURE load-time + size vs ELF.\n" as *u8) 65 g_puts(" RULE: every exceed claim must cite the incumbent's OWN tool/metric (Unsloth/MLPerf/SPEC/3DMark) -- not a hand-rolled number.\n" as *u8) 66 67 var t1: i64=0; if sum>30 { t1=1 } 68 pass=pass+ck("T1: the real fetched corpus is read via getdents64 (sum of domain research > 30)" as *u8, t1); total=total+1 69 var t2: i64=0; if dwith>=6 { t2=1 } 70 pass=pass+ck("T2: >=6 of 8 domains have grounded research (the fetch system spans the OS)" as *u8, t2); total=total+1 71 var t3: i64=0; if cAI>0 { if cBT>0 { t3=1 } } 72 pass=pass+ck("T3: the 'tools that test speed+capabilities' ask is met -- Unsloth (eff_) AND a bench-suite (bt_) are grounded" as *u8, t3); total=total+1 73 74 var okall: i64=0; if pass==total { okall=1 } 75 g_puts("---- nx_research_ledger: passed "); g_pn(pass); g_puts(" / "); g_pn(total); g_puts(" ----\n" as *u8) 76 if okall==1 { 77 let logf: i64=sys_openat_append("knowledge/status/research_ledger.log" as *u8, 420) 78 if logf>=0 { let z: i64=sys_write(logf,"NXRESEARCHLEDGER GREEN: HAVE/NEED/RESEARCHED-corpus/bench-tool integrated; iterate-to-s-class actions; exceed must cite incumbent yardstick\n" as *u8,138); sys_close(logf) } 79 g_puts("verdict=GREEN (the fetch systems are integrated into a HAVE-vs-NEED-vs-research loop, grounded in the real speed/capability tools; next actions prioritized)\n" as *u8); sys_exit(0); return 0 80 } 81 g_puts("verdict=RED\n" as *u8); sys_exit(1); return 1 82}