code wiki / _hdl_build / nx_self_tune.nx

nx_self_tune.nx

buildroot/runtime/_hdl_build/nx_self_tune.nx

8910 B164 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic self
docsdependenciesstructsconstsfunctions

about

nx_self_tune.nx -- LOCAL-ONLY DRIVER SELF-TUNE (X-DRV-F3). The privacy-preserving counterpart to the federated registry (X-DRV-F2): a NON-SHARING spore improves its own drivers using the SAME emitter + measurement, but the learnings NEVER leave the device -- no telemetry, no phone-home. It sweeps the candidate configs for each device on its OWN emu, measures emu-steps, and keeps the fastest as its tuned local registry. nx_self_tune [candidates_path] candidates : local_tune_candidates.tsv (deviceid <TAB> config_spec <TAB> config_bin) -> knowledge/registry/driver_registry_tuned_local.tsv (deviceid -> best local config + steps) -> knowledge/status/self_tune.log (SELFTUNE: per-device best, configs swept; NO shared writes) Touches ONLY local files (emit/run/registry/log). Sovereign, no gcc/.sh. license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_self_tune.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 st_p sys_write sys_mmap st_read sys_openat_rd sys_read sys_close sys_exit st_field st_parse_num st_copy st_field_end st_run sys_fork sys_openat_wr sys_dup3 sys_mmap ↻ sys_execve sys_exit ↻ sys_wait4 st_parse_steps st_n st_fn sys_mmap ↻ sys_write ↻ sys_openat_wr ↻ st_fp sys_write ↻ st_fn ↻ sys_close ↻ sys_openat_append sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real

structs

none

consts

14const ST_MAGIC_65536: i64 = 65536
16const ST_EMIT: *u8 = "_offc/nx_drv_proto_emit.elf"
17const ST_SOV: *u8 = "_offc/nx_boot_run_sov.elf"
18const ST_OUT: *u8 = "knowledge/registry/driver_registry_tuned_local.tsv"
19const ST_LOG: *u8 = "knowledge/status/self_tune.log"
20const ST_MAXDEV: i64 = 32

functions

22func st_p(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
23func st_fp(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
24func st_fn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m}; 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 2: st_nmain calls 2: sys_mmapsys_write
25func st_n(v: i64) -> i64 { st_fn(1, v); return 0 }
called by 1: main calls 1: st_fn
27func st_run(prog: *u8, a1: *u8, outpath: *u8) -> i64
48func st_read(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
58func st_parse_steps(buf: *u8, n: i64) -> i64
called by 1: main
72func st_field(buf: *u8, ls: i64, le: i64, idx: i64) -> i64
called by 1: main
78func st_field_end(buf: *u8, s: i64, le: i64) -> i64 { var q: i64 = s; while q < le { if buf[q] == (9 as u8) { return q } q = q + 1 } return le }
called by 1: main
79func st_parse_num(buf: *u8, p: i64, le: i64) -> i64 { var q: i64=p; var v: i64=0; var go: i64=1; while go==1 { if q>=le { go=0 } else { let c: i64=buf[q] as i64; if c>=48 { if c<=57 { v=v*10+(c-48); q=q+1 } else { go=0 } } else { go=0 } } } return v }
called by 1: main
80func st_copy(buf: *u8, s: i64, e: i64, out: *u8) -> i64 { var c: i64=0; var q: i64=s; while q<e { out[c]=buf[q]; c=c+1; q=q+1 } out[c]=0 as u8; return c }
called by 1: main
82func main(argc: i64, argv: *i64) -> i64