code wiki / _hdl_build / nx_self_tune.nx
nx_self_tune.nx
buildroot/runtime/_hdl_build/nx_self_tune.nx
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
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
| 14 | const ST_MAGIC_65536: i64 = 65536 |
| 16 | const ST_EMIT: *u8 = "_offc/nx_drv_proto_emit.elf" |
| 17 | const ST_SOV: *u8 = "_offc/nx_boot_run_sov.elf" |
| 18 | const ST_OUT: *u8 = "knowledge/registry/driver_registry_tuned_local.tsv" |
| 19 | const ST_LOG: *u8 = "knowledge/status/self_tune.log" |
| 20 | const ST_MAXDEV: i64 = 32 |
functions
| 22 | func 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 } |
| 23 | func 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 } |
| 24 | func 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 } |
| 25 | func st_n(v: i64) -> i64 { st_fn(1, v); return 0 } |
| 27 | func st_run(prog: *u8, a1: *u8, outpath: *u8) -> i64 |
| 48 | func st_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 58 | func st_parse_steps(buf: *u8, n: i64) -> i64 called by 1: main |
| 72 | func st_field(buf: *u8, ls: i64, le: i64, idx: i64) -> i64 called by 1: main |
| 78 | func 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 |
| 79 | func 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 |
| 80 | func 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 |
| 82 | func main(argc: i64, argv: *i64) -> i64 |