code wiki / _hdl_build / nx_fitloop.nx

nx_fitloop.nx

buildroot/runtime/_hdl_build/nx_fitloop.nx

12087 B255 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_fitloop.nx -- THE KEYSTONE: METROLOGY IN THE AUTHORING LOOP (debt 1785967773; operator 2026-08-05: crafting and measuring must grow each other). A generator is driven by a judge in a CLOSED LOOP with an auditable trial trace -- the capability this session proved manually (hand 241->358->258->191->181mm across five hand-run pose trials) and the gap measured in the industry: authoring tools have no metrology in the loop, metrology tools do not author. v1 searches the 2-parameter pose space measured tonight: symmetric shoulder raise s and elbow raise e (degrees, clamped 0..90; left rows get -deg, right +deg; elbow pivot approximation declared valid for small s). Generator = nx_meshpose apply. Judge = nx_meshdist parts; OBJECTIVE = the SUM of all per-part mean distances (pose moves only arms, torso terms are constant, so minimising the sum minimises the arm gap without wrecking anything else -- and a whole-body objective cannot be gamed by improving one part at another's expense). u2605THE VACUOUS-OBJECTIVE GUARD IS THE ORGAN'S FIRST TOOTH: a failed judge run yields an empty capture whose sum is 0 = "perfect". Any trial parsing fewer than 10 part rows is INVALID and scores WORST, never best -- an optimiser that can reward a broken ruler will find the broken ruler immediately. nx_fitloop pose2 <base.nxmesh> <oracle_parts.nxmesh> <out_best.nxmesh> [budget] nx_fitloop selftest Trial trace: one TRIAL row per evaluation (s, e, objective um-sum, parts parsed) -- the optimisation is EVIDENCE, not a black box. license_tier: ORIGINAL expect_exit: 0

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_tool_run.nx nx_fitloop.nx

imports: nx_syscalls.nxnx_tool_run.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main hw sys_write sys_exit fl_selftest hw ↻ fl_pose2 fl_exists sys_openat_rd sys_close fl_refuse hw ↻ sys_mmap hw ↻ pn sys_mmap ↻ sys_write ↻ fl_trial fl_posefile sys_mmap ↻ fl_cat fl_int sys_mmap ↻ fl_wrfile sys_openat_wr sys_write ↻ sys_close ↻ sys_mmap ↻ tr_run_capture sys_mmap ↻ sys_pipe2 sys_fork sys_close ↻ sys_dup3 sys_execve_clean sys_close ↻ sys_execve sys_exit ↻ sys_read sys_wait4

structs

none

consts

24const FL_MAGIC_4096: i64 = 4096
26const FL_CAP: i64 = 262144
27const FL_MAXTRIAL: i64 = 40
28const FL_BAD: i64 = 4611686018427387903
29const FL_MINPARTS: i64 = 10

functions

31func hw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
32func pn(v: i64) -> i64 { let b: *u8=sys_mmap(32) as *u8; var x: i64=v; var ng: i64=0; if x<0{ng=1;x=0-x} var i: i64=31; if x==0{b[i]=48 as u8;i=i-1} while x>0{b[i]=(48+x%10) as u8;x=x/10;i=i-1} if ng==1{b[i]=45 as u8;i=i-1} sys_write(1,(b as i64+i+1) as *u8,31-i); return 0 }
33func fl_refuse(reason: *u8) -> i64 { hw("FITLOOP REFUSED: " as *u8); hw(reason); hw("\n" as *u8); return 0 }
called by 1: fl_pose2 calls 1: hw
34func fl_cat(b: *u8, off: i64, s: *u8) -> i64
called by 1: fl_posefile
40func fl_int(b: *u8, off: i64, v: i64) -> i64
called by 1: fl_posefile calls 1: sys_mmap
51func fl_wrfile(path: *u8, b: *u8, n: i64) -> i64
58func fl_exists(path: *u8) -> i64
called by 1: fl_pose2 calls 2: sys_openat_rdsys_close
65func fl_objective(cap: *u8, n: i64, cnt: *i64) -> i64
called by 2: fl_trialfl_selftest
95func fl_posefile(path: *u8, s: i64, e: i64) -> i64
110func fl_trial(base: *u8, oracle: *u8, s: i64, e: i64, nparts: *i64) -> i64
142func fl_pose2(base: *u8, oracle: *u8, outp: *u8, budget: i64) -> i64
210func fl_selftest() -> i64
229func main(argc: i64, argv: *i64) -> i64