nx_vitpose_patchembed.nx
buildroot/runtime/nx_vitpose_patchembed.nx
about
nx_vitpose_patchembed.nx -- FIRST assembly rung of the faithful f32 ViTPose forward: load the REAL patch-embed
weights (projection.weight [768,3,16,16] + bias [768]) and position_embeddings [1,193,768] from the downloaded
safetensors (targeted seek+read), run the patch-embed Conv2d(3->768,k16,s16) on a 256x192x3 input, transpose the
[768,16,12] feature map into 192 tokens x 768, and add the position embeddings (index 1.. -> skip the cls slot).
Structural gate: token block is 192x768, finite (no NaN/Inf), non-trivial. (No PyTorch reference in-env -> the
assembly is built rung-by-rung with structural/property gates; final validation = keypoints on a real image.)
expect_exit: 0
dependencies 5 imports · 0 importers
imports: nx_syscalls.nxnx_f32.nxnx_f32_cvt.nxnx_f32_conv2d.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
structs
| none |
consts
| 13 | const K_MAGIC_4096: i64 = 4096 |
| 14 | const K_MAGIC_589824: i64 = 589824 |
| 15 | const K_MAGIC_148224: i64 = 148224 |
| 16 | const K_MAGIC_100000: i64 = 100000 |
functions
| 18 | func w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 19 | func 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 } |
| 20 | func rdfile(path: *u8, buf: *u8, cap: i64) -> i64 { let fd: i64=sys_openat_rd(path); if fd<0{return 0-1} var n: i64=sys_read(fd,buf,cap-1); sys_close(fd); if n<0{return 0-1} var go: i64=1; while go==1{go=0; if n>0{ let c: i64=buf[n-1] as i64; if c==10{n=n-1;go=1} if c==13{n=n-1;go=1} if c==32{n=n-1;go=1} }} buf[n]=0 as u8; return n } |
| 21 | func 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 |
| 24 | func load_named(fd: i64, hbuf: *u8, hlen: i64, data_start: i64, name: *u8, out: *i64) -> i64 |
| 36 | func main() -> i64 |