code wiki / _hdl_build / nx_mhbench.nx
nx_mhbench.nx source
↩ module page · 362 lines · 15628 B
1// nx_mhbench.nx -- the BEYOND-METAHUMAN capability ruler (Phase 0 of the beyond-metahuman program).
2// MetaHuman-PARITY axes + sovereign EXCEED axes; verdicts are COMPUTED against on-disk artifacts on
3// EVERY call (a missing artifact DOWNGRADES its axis to GAP, flagged) -- never hand-asserted coverage.
4// gap_queue (weight-desc over non-HAVE axes) IS the build order. Coverage is BREADTH, never realism:
5// the honest block carries the perceptual truth (CLAY ~175 solo, ~130 beside a photo) in-band.
6// Verbs: (none|board) emit JSON | <rootOverride> emit vs alternate artifact root | selftest = gv gate.
7// license_tier: ORIGINAL expect_exit: 0 No hw writes (Rule 26).
8import "nx_gate_verdict.nx"
9
10const MH_BUF: i64 = 65536
11const MH_ARR: i64 = 4096
12const MH_PATH: i64 = 512
13const MH_STATB: i64 = 160
14const MH_STOFF: i64 = 48
15const MH_STRIDE: i64 = 8
16const MH_MAXAX: i64 = 24
17const MH_PERMIL: i64 = 1000
18const MH_QCAP: i64 = 12
19const MH_TMIN: i64 = 1500
20const MH_MINPAR: i64 = 13
21const MH_MINEXC: i64 = 6
22
23func ocat(o: *u8, at: i64, s: *u8) -> i64 { var i: i64=0; var a: i64=at; while s[i]!=(0 as u8){o[a]=s[i]; a=a+1; i=i+1} return a }
24func onum(o: *u8, at: i64, v: i64) -> i64 {
25 var a: i64=at; var m: i64=v
26 if m==0 { o[a]=48 as u8; return a+1 }
27 if m<0 { o[a]=45 as u8; a=a+1; m=0-m }
28 let t: *u8 = sys_mmap(32); var k: i64=0
29 while m>0 { t[k]=(48+(m%10)) as u8; m=m/10; k=k+1 }
30 var q: i64=k-1
31 while q>=0 { o[a]=t[q]; a=a+1; q=q-1 }
32 return a
33}
34func js(jb: *u8, jo: *i64, s: *u8) -> i64 {
35 jo[0] = ocat(jb, jo[0], s)
36 return 0
37}
38func jn(jb: *u8, jo: *i64, v: i64) -> i64 {
39 jo[0] = onum(jb, jo[0], v)
40 return 0
41}
42// file size; -1 on stat error (st_size at +48 in x86_64 struct stat)
43func mh_fsize(path: *u8) -> i64 {
44 let sb: *u8 = sys_mmap(MH_STATB)
45 if sys_fstatat(path, sb) != 0 { return 0 - 1 }
46 let szp: *i64 = ((sb as i64) + MH_STOFF) as *i64
47 return szp[0]
48}
49func mh_has(h: *u8, hl: i64, nd: *u8) -> i64 {
50 var nl: i64 = 0
51 while nd[nl] != (0 as u8) { nl = nl + 1 }
52 if nl == 0 { return 0 }
53 var i: i64 = 0
54 var hit: i64 = 0
55 while i + nl <= hl {
56 if hit == 0 {
57 var k: i64 = 0
58 var ok: i64 = 1
59 while k < nl {
60 if h[i+k] != nd[k] { ok = 0; k = nl } else { k = k + 1 }
61 }
62 if ok == 1 { hit = 1 }
63 }
64 i = i + 1
65 }
66 return hit
67}
68func mh_streq(a: *u8, b: *u8) -> i64 {
69 var i: i64 = 0
70 var go: i64 = 1
71 var eq: i64 = 1
72 while go == 1 {
73 if a[i] != b[i] { eq = 0; go = 0 } else {
74 if a[i] == (0 as u8) { go = 0 } else { i = i + 1 }
75 }
76 }
77 return eq
78}
79func vs(v: i64) -> *u8 {
80 if v == 2 { return "HAVE" as *u8 }
81 if v == 1 { return "PARTIAL" as *u8 }
82 return "GAP" as *u8
83}
84// register one axis: tier 0=PARITY 1=EXCEED; decl 0=GAP 1=PARTIAL 2=HAVE; ev may be null (0 as *u8)
85func ax(st: *i64, name: *u8, tier: i64, decl: i64, w: i64, ev: *u8) -> i64 {
86 let n: i64 = st[0]
87 if n >= MH_MAXAX { return 0 - 1 }
88 let b: i64 = 1 + n*MH_STRIDE
89 st[b+0] = name as i64
90 st[b+1] = tier
91 st[b+2] = decl
92 st[b+3] = w
93 st[b+4] = ev as i64
94 st[b+5] = decl
95 st[b+6] = 0
96 st[b+7] = 0
97 st[0] = n + 1
98 return n
99}
100// the axes. Weights = MetaHuman-signature demand for the gap_queue. Artifacts verified to exist at
101// authoring time; the compute pass re-verifies EVERY call so the board can never quietly rot.
102func mh_reg() -> *i64 {
103 let st: *i64 = sys_mmap(MH_ARR) as *i64
104 st[0] = 0
105 ax(st, "head-identity-geometry" as *u8, 0, 0, 9, "sites/nishifamily/world/mh_head_ours.png" as *u8)
106 // ★DECLARATION CORRECTED 2026-07-31, and the REASON matters more than the row. This axis was
107 // declared GAP when the ruler was authored on 07-25, and that was TRUE THEN. nx_fascia shipped
108 // AFTER (F1137/seq994): it binds nx_softdyn to the emitted muscle+fat layers, gate 7/7 GREEN,
109 // registered, 760,032 soft vertices deformed with verts_moved_bone EXACTLY 0 because the lattice is
110 // layer-aware (bone rigid by construction, muscle 520, skin/fat 1000), and the displacement is
111 // VISIBLE and measured -- max_disp 4 -> 35, render 83,789 -> 81,195 lit px = 2,594 px of real
112 // soft-tissue movement. Its rest/flex evidence renders are ON DISK and re-verified every call below.
113 // ★PARTIAL, NOT HAVE, and the residual is why: the lattice is 24 bands over Y ONLY with no lateral or
114 // AP resolution, and the drive is a SYNTHETIC footfall rather than rig-driven animation. Stage 3 is
115 // proven and visible, not finished. Declaring HAVE here would be exactly the coverage-gaming this
116 // ecosystem convicts.
117 ax(st, "soft-tissue-form" as *u8, 0, 1, 9, "sites/nishifamily/world/mh_tissue_flex.png" as *u8)
118 ax(st, "strand-hair-groom" as *u8, 0, 0, 8, 0 as *u8)
119 ax(st, "facial-rig-animation" as *u8, 0, 0, 8, "sites/nishifamily/world/nx_face_expr.png" as *u8)
120 ax(st, "skin-material-sss" as *u8, 0, 1, 7, "sites/nishifamily/world/gx24_micro_skin.png" as *u8)
121 ax(st, "eye-shader" as *u8, 0, 1, 7, "sites/nishifamily/world/gx_eye.png" as *u8)
122 ax(st, "teeth-mouth-interior" as *u8, 0, 0, 6, 0 as *u8)
123 ax(st, "lod-realtime" as *u8, 0, 0, 6, "sites/nishifamily/world/nx_engine_lod.png" as *u8)
124 ax(st, "light-transport-gi" as *u8, 0, 1, 6, "sites/nishifamily/world/gx31_fixed.png" as *u8)
125 ax(st, "body-rig-skinning" as *u8, 0, 1, 6, "sites/nishifamily/world/rig_strip.png" as *u8)
126 ax(st, "body-anthropometrics" as *u8, 0, 1, 5, "knowledge/canon_fit.dat" as *u8)
127 ax(st, "wardrobe-cloth-render" as *u8, 0, 0, 5, 0 as *u8)
128 ax(st, "creation-customizer" as *u8, 0, 1, 4, "sites/nishifamily/world/gx24_customizer.png" as *u8)
129 ax(st, "procedural-village" as *u8, 1, 0, 9, 0 as *u8)
130 ax(st, "beauty-manifold-scored" as *u8, 1, 0, 8, 0 as *u8)
131 ax(st, "inside-out-anatomy" as *u8, 1, 1, 8, "sites/nishifamily/world/gx31_layers.png" as *u8)
132 ax(st, "bit-determinism" as *u8, 1, 2, 6, "knowledge/status/graphics_gate.log" as *u8)
133 ax(st, "sovereign-no-license-lock" as *u8, 1, 2, 5, "nx_bodybench.elf" as *u8)
134 ax(st, "species-agnostic-canon" as *u8, 1, 1, 4, "knowledge/canon_male.dat" as *u8)
135 return st
136}
137// the liar-kill: declared HAVE/PARTIAL whose artifact is missing on disk becomes GAP, downgraded=1
138func mh_compute(st: *i64, root: *u8) -> i64 {
139 var i: i64 = 0
140 while i < st[0] {
141 let b: i64 = 1 + i*MH_STRIDE
142 var eff: i64 = st[b+2]
143 var fnd: i64 = 0
144 let evp: i64 = st[b+4]
145 if evp != 0 {
146 let p: *u8 = sys_mmap(MH_PATH)
147 var o: i64 = 0
148 if (root as i64) != 0 { o = ocat(p, o, root) }
149 o = ocat(p, o, evp as *u8)
150 p[o] = 0 as u8
151 if mh_fsize(p) > 0 { fnd = 1 }
152 }
153 if eff > 0 { if fnd == 0 { eff = 0; st[b+7] = 1 } }
154 st[b+5] = eff
155 st[b+6] = fnd
156 i = i + 1
157 }
158 return 0
159}
160// gap_queue = non-HAVE axes, weight-descending (repeated max-scan; no sort lib). Emits first
161// MH_QCAP, declares the total (no silent caps).
162func mh_queue(st: *i64, jb: *u8, jo: *i64) -> i64 {
163 let used: *i64 = sys_mmap(MH_ARR) as *i64
164 var emitted: i64 = 0
165 var total: i64 = 0
166 var t: i64 = 0
167 while t < st[0] {
168 let bt: i64 = 1 + t*MH_STRIDE
169 if st[bt+5] < 2 { total = total + 1 }
170 t = t + 1
171 }
172 js(jb, jo, ",\x22gap_queue\x22:[" as *u8)
173 var go: i64 = 1
174 while go == 1 {
175 var best: i64 = 0 - 1
176 var bw: i64 = 0 - 1
177 var q: i64 = 0
178 while q < st[0] {
179 let bq: i64 = 1 + q*MH_STRIDE
180 if st[bq+5] < 2 {
181 if used[q] == 0 {
182 if st[bq+3] > bw { bw = st[bq+3]; best = q }
183 }
184 }
185 q = q + 1
186 }
187 if best < 0 { go = 0 } else {
188 used[best] = 1
189 if emitted < MH_QCAP {
190 if emitted > 0 { js(jb, jo, "," as *u8) }
191 let bb: i64 = 1 + best*MH_STRIDE
192 js(jb, jo, "{\x22axis\x22:\x22" as *u8)
193 let nmq: i64 = st[bb+0]
194 js(jb, jo, nmq as *u8)
195 js(jb, jo, "\x22,\x22w\x22:" as *u8)
196 jn(jb, jo, st[bb+3])
197 js(jb, jo, "}" as *u8)
198 }
199 emitted = emitted + 1
200 }
201 }
202 js(jb, jo, "],\x22gap_queue_total\x22:" as *u8)
203 jn(jb, jo, total)
204 return 0
205}
206func mh_emit(st: *i64, jb: *u8, jo: *i64) -> i64 {
207 js(jb, jo, "{\x22v\x22:1,\x22organ\x22:\x22nx_mhbench\x22,\x22domain\x22:\x22beyond-metahuman\x22,\x22title\x22:\x22Beyond-MetaHuman capability ruler -- MetaHuman-parity axes + sovereign exceed axes, verdicts computed from on-disk artifacts\x22,\x22axes\x22:[" as *u8)
208 var i1: i64 = 0
209 while i1 < st[0] {
210 let b1: i64 = 1 + i1*MH_STRIDE
211 if i1 > 0 { js(jb, jo, "," as *u8) }
212 js(jb, jo, "{\x22axis\x22:\x22" as *u8)
213 let nm1: i64 = st[b1+0]
214 js(jb, jo, nm1 as *u8)
215 js(jb, jo, "\x22,\x22tier\x22:\x22" as *u8)
216 if st[b1+1] == 0 { js(jb, jo, "PARITY" as *u8) } else { js(jb, jo, "EXCEED" as *u8) }
217 js(jb, jo, "\x22,\x22verdict\x22:\x22" as *u8)
218 js(jb, jo, vs(st[b1+5]))
219 js(jb, jo, "\x22,\x22w\x22:" as *u8)
220 jn(jb, jo, st[b1+3])
221 js(jb, jo, ",\x22ev\x22:\x22" as *u8)
222 let ev1: i64 = st[b1+4]
223 if ev1 != 0 { js(jb, jo, ev1 as *u8) }
224 js(jb, jo, "\x22,\x22found\x22:" as *u8)
225 jn(jb, jo, st[b1+6])
226 js(jb, jo, ",\x22downgraded\x22:" as *u8)
227 jn(jb, jo, st[b1+7])
228 js(jb, jo, "}" as *u8)
229 i1 = i1 + 1
230 }
231 js(jb, jo, "]" as *u8)
232 var np: i64 = 0
233 var ph: i64 = 0
234 var pp: i64 = 0
235 var pg: i64 = 0
236 var ne: i64 = 0
237 var eh: i64 = 0
238 var ep: i64 = 0
239 var eg: i64 = 0
240 var i2: i64 = 0
241 while i2 < st[0] {
242 let b2: i64 = 1 + i2*MH_STRIDE
243 if st[b2+1] == 0 {
244 np = np + 1
245 if st[b2+5] == 2 { ph = ph + 1 }
246 if st[b2+5] == 1 { pp = pp + 1 }
247 if st[b2+5] == 0 { pg = pg + 1 }
248 } else {
249 ne = ne + 1
250 if st[b2+5] == 2 { eh = eh + 1 }
251 if st[b2+5] == 1 { ep = ep + 1 }
252 if st[b2+5] == 0 { eg = eg + 1 }
253 }
254 i2 = i2 + 1
255 }
256 var cov: i64 = 0
257 if np > 0 { cov = (ph*2 + pp) * MH_PERMIL / (2*np) }
258 js(jb, jo, ",\x22parity\x22:{\x22n\x22:" as *u8)
259 jn(jb, jo, np)
260 js(jb, jo, ",\x22have\x22:" as *u8)
261 jn(jb, jo, ph)
262 js(jb, jo, ",\x22partial\x22:" as *u8)
263 jn(jb, jo, pp)
264 js(jb, jo, ",\x22gap\x22:" as *u8)
265 jn(jb, jo, pg)
266 js(jb, jo, ",\x22coverage_permil\x22:" as *u8)
267 jn(jb, jo, cov)
268 js(jb, jo, "},\x22exceed\x22:{\x22n\x22:" as *u8)
269 jn(jb, jo, ne)
270 js(jb, jo, ",\x22have\x22:" as *u8)
271 jn(jb, jo, eh)
272 js(jb, jo, ",\x22partial\x22:" as *u8)
273 jn(jb, jo, ep)
274 js(jb, jo, ",\x22gap\x22:" as *u8)
275 jn(jb, jo, eg)
276 js(jb, jo, "}" as *u8)
277 mh_queue(st, jb, jo)
278 js(jb, jo, ",\x22above_metahuman_means\x22:\x22(a) PARITY: no parity axis at GAP, every verdict artifact-backed; (b) EXCEED: at least 3 HAVE axes MetaHuman structurally lacks (inside-out anatomy, bit-determinism, procedural village, sovereignty); (c) the perceptual side-by-side number climbing and PUBLISHED every rung -- measured, never asserted\x22" as *u8)
279 js(jb, jo, ",\x22honest\x22:\x22coverage is BREADTH of capability presence -- NEVER a realism percent and NEVER a MetaHuman-parity claim. OUTPUT REALITY: perceptual ~175 solo = CLAY, ~130 beside a photograph (photo bar ~950); sovereign bodybench headline = MIN(front,side,shape,detail,quarter,head) ~ 227-240 permil; the FACE is the measured worst region -- and at HEAD SCALE (nx_headcrop band 870-1000, head fills the frame) our face measures detail 79 (front 44, back 115, quarter 65) against the cadaver oracle, NOT the 227 a whole-body frame reports: the body-frame head judge was flattering the face ~3x. Silhouette holds (828/832/856) = head-SHAPED, surface FEATURELESS. Eyeballed: ours is a smooth egg carrying PAINTED rectangles (brow bars, mouth bar) and surface-mounted eyes, with NO NOSE AT ALL, no lips, no chin, no orbital depth; the oracle carries all of it as GEOMETRY. Presence != fidelity.\x22" as *u8)
280 js(jb, jo, ",\x22north_star\x22:\x22procedurally generated and OURS: a village of people, beautiful by MEASURED manifold not chance, anatomically real inside and out -- a bar MetaHuman does not attempt\x22" as *u8)
281 js(jb, jo, ",\x22plan\x22:\x22memory project-nishi-beyond-metahuman-plan (07-25); build order = gap_queue; face first (head judge 227 = worst region), then soft-tissue FORM, then the village trio; light transport LAST (it pays only once relief exists)\x22" as *u8)
282 js(jb, jo, ",\x22env\x22:\x22verdicts re-computed against on-disk artifacts EVERY call; a missing artifact DOWNGRADES its axis to GAP with downgraded=1; argv: board|<rootOverride>|selftest; out-hard-64k\x22}" as *u8)
283 return 0
284}
285func mh_board(root: *u8) -> i64 {
286 let st: *i64 = mh_reg()
287 mh_compute(st, root)
288 let jb: *u8 = sys_mmap(MH_BUF)
289 let jo: *i64 = sys_mmap(16) as *i64
290 jo[0] = 0
291 mh_emit(st, jb, jo)
292 sys_write(1, jb, jo[0])
293 sys_write(1, "\n" as *u8, 1)
294 return 0
295}
296func mh_gate() -> i64 {
297 let ctr: *i64 = gv_ctr()
298 gv_head("nx_mhbench selftest -- the ruler is honest by construction" as *u8)
299 let st: *i64 = mh_reg()
300 mh_compute(st, 0 as *u8)
301 let jb: *u8 = sys_mmap(MH_BUF)
302 let jo: *i64 = sys_mmap(16) as *i64
303 jo[0] = 0
304 mh_emit(st, jb, jo)
305 let jl: i64 = jo[0]
306 var t1: i64 = 0
307 if jl > MH_TMIN { if mh_has(jb, jl, "coverage_permil" as *u8) == 1 { t1 = 1 } }
308 gv_check("T1 board emits computed JSON" as *u8, t1, ctr)
309 var dcount: i64 = 0
310 var g2: i64 = 0
311 while g2 < st[0] {
312 let bg2: i64 = 1 + g2*MH_STRIDE
313 dcount = dcount + st[bg2+7]
314 g2 = g2 + 1
315 }
316 var t2: i64 = 0
317 if dcount == 0 { t2 = 1 }
318 gv_check("T2 every HAVE-PARTIAL artifact present on disk (zero downgrades)" as *u8, t2, ctr)
319 let st2: *i64 = mh_reg()
320 mh_compute(st2, "/tmp/nx_mh_absent_zz/" as *u8)
321 var esum: i64 = 0
322 var g3: i64 = 0
323 while g3 < st2[0] {
324 let bg3: i64 = 1 + g3*MH_STRIDE
325 esum = esum + st2[bg3+5]
326 g3 = g3 + 1
327 }
328 var t3: i64 = 0
329 if esum == 0 { t3 = 1 }
330 gv_check("T3 verdicts derive from disk: absent root forces all-GAP" as *u8, t3, ctr)
331 var np4: i64 = 0
332 var ne4: i64 = 0
333 var g4: i64 = 0
334 while g4 < st[0] {
335 let bg4: i64 = 1 + g4*MH_STRIDE
336 if st[bg4+1] == 0 { np4 = np4 + 1 } else { ne4 = ne4 + 1 }
337 g4 = g4 + 1
338 }
339 var t4: i64 = 0
340 if np4 >= MH_MINPAR { if ne4 >= MH_MINEXC { t4 = 1 } }
341 gv_check("T4 non-vacuity: parity and exceed axes both present" as *u8, t4, ctr)
342 var t5: i64 = 0
343 if mh_has(jb, jl, "BREADTH" as *u8) == 1 {
344 if mh_has(jb, jl, "CLAY" as *u8) == 1 {
345 if mh_has(jb, jl, "MIN(" as *u8) == 1 { t5 = 1 }
346 }
347 }
348 gv_check("T5 honesty strings cannot rot" as *u8, t5, ctr)
349 return gv_verdict("MHBENCH-GATE" as *u8, ctr, "computed-not-asserted; liar-kill live" as *u8)
350}
351func main(argc: i64, argv: *i64) -> i64 {
352 var mode: *u8 = 0 as *u8
353 if argc >= 2 { mode = argv[1] as *u8 }
354 if (mode as i64) != 0 {
355 if mh_streq(mode, "selftest" as *u8) == 1 { return mh_gate() }
356 }
357 var root: *u8 = 0 as *u8
358 if (mode as i64) != 0 {
359 if mh_streq(mode, "board" as *u8) == 0 { root = mode }
360 }
361 return mh_board(root)
362}