code wiki / (root) / nx_vitpose_loadtest.nx

nx_vitpose_loadtest.nx

buildroot/runtime/nx_vitpose_loadtest.nx

5411 B96 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind tooltopic vitpose
docsdependenciesstructsconstsfunctions

about

nx_vitpose_loadtest.nx -- prove nx_safetensors_load reads REAL tensor values from the downloaded 343MB ViTPose file, via TARGETED reads (header + seek to one tensor's bytes) so it never loads the whole body. Loads head.conv.bias [17] and patch_embeddings.projection.bias [768], prints the count + first values as a sanity that the assembly's weight-load path works on the real model. expect_exit: 0

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_f32.nx nx_f32_cvt.nx nx_safetensors_load.nx nx_vitpose_loadtest.nx

imports: nx_syscalls.nxnx_f32.nxnx_f32_cvt.nxnx_safetensors_load.nx

imported by: nobody (leaf or entry point)

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

main sys_mmap readfile sys_openat_rd sys_read sys_close w sys_write sys_exit sys_openat_rd ↻ sys_read ↻ u64le wn w ↻ sys_mmap ↻ sys_write ↻ load_one sys_mmap ↻ stl_tensor stl_find sys_mmap ↻ stl_parse_int sys_lseek sys_read ↻ stl_read_f32 stl_streq stl_u32le nx_f16_to_f32 stl_u16le wf nx_f32_mul nx_f32_classify nx_f32_exp_field nx_f32_mant_field nx_f32_sign nx_f32_mant_field ↻ nx_f32_exp_field ↻ nx_i32_to_f32 nx_f32_lt nx_f32_is_nan

structs

none

consts

9const K_MAGIC_10000: i64 = 10000
10const K_MAGIC_4096: i64 = 4096
11const K_MAGIC_1024: i64 = 1024

functions

13func w(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 3: wnwfmain calls 1: sys_write
14func wn(v: i64) -> i64 { var m: i64=v; if m<0{w("-" as *u8);m=0-m} let t:*u8=sys_mmap(24); var k:i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i:i64=0; let o:*u8=sys_mmap(24); while i<k{o[i]=t[k-1-i];i=i+1} sys_write(1,o,k); return 0 }
called by 2: wfmain calls 3: wsys_mmapsys_write
16func wf(x: i64) -> i64
36func f32_to_i64_trunc(x: i64) -> i64
called by 1: wf calls 1: nx_f32_is_zero
45func readfile(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
52func u64le(buf: *u8, off: i64) -> i64 { var v: i64=0; var i: i64=0; while i<8 { v = v | ((buf[off+i]&0xff) << (i*8)); i=i+1 } return v }
called by 1: main
55func load_one(fd: i64, hbuf: *u8, hlen: i64, data_start: i64, name: *u8, out: *i64) -> i64
68func main() -> i64