nx_hifigan_load.nx
buildroot/runtime/nx_hifigan_load.nx
about
nx_hifigan_load.nx -- LOAD real HiFi-GAN weights into our sovereign vocoder (Qwen pattern: 3rd-party weights =
data, OUR engine = sovereign, hardware-rung up). Parses the .bin ZIP into a data/N offset+size table, reads raw
little-endian f32 blobs directly (STORED, no dequant, NO weight-norm -- SpeechT5 fused it), and verifies the
critical new mechanic on conv_pre: sizes match the derived shapes, the values are SANE trained floats (small,
not garbage), and the real-dim (512-ch) conv actually runs finite. Once this is trusted, the full generator is
the same load pattern x158 tensors -> nx_hifigan_gen at real dims. license_tier: ORIGINAL expect_exit: 0
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_f32.nxnx_vocops.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
| 10 | const K_MAGIC_67108864: i64 = 67108864 |
| 11 | const K_MAGIC_286720: i64 = 286720 |
| 12 | const K_MAGIC_1146880: i64 = 1146880 |
| 13 | const K_MAGIC_200000: i64 = 200000 |
functions
| 15 | func p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 16 | func pn(v: i64) -> i64 { if v==0 { sys_write(1,"0" as *u8,1); return 0 } var m: i64=v; if m<0{sys_write(1,"-" as *u8,1);m=0-m} let d: *u8=sys_mmap(24); var k: i64=0; while m>0 {d[k]=(48+(m%10)) as u8; m=m/10; k=k+1} var i: i64=k-1; while i>=0 {let o: *u8=sys_mmap(1); o[0]=d[i]; sys_write(1,o,1); i=i-1} return 0 } |
| 17 | func phx(v: i64) -> i64 { let b: *u8=sys_mmap(8); var i: i64=0; while i<8 { let n: i64=(v>>((7-i)*4))&0xF; if n<10 {b[i]=(48+n) as u8} else {b[i]=(87+n) as u8} i=i+1 } sys_write(1,b,8); return 0 } |
| 18 | func u16le(b: *u8, o: i64) -> i64 { return (b[o]&0xff) | ((b[o+1]&0xff)<<8) } called by 1: main |
| 19 | func u32le(b: *u8, o: i64) -> i64 { return (b[o]&0xff) | ((b[o+1]&0xff)<<8) | ((b[o+2]&0xff)<<16) | ((b[o+3]&0xff)<<24) } |
| 22 | func f32_sub(a: i64, b: i64) -> i64 { return nx_f32_add(a, (b & 0xFFFFFFFF) ^ 0x80000000) } |
| 24 | func load_f32(buf: *u8, boff: i64, count: i64, out: *i64) -> i64 { var i: i64=0; while i<count { out[i] = u32le(buf, boff + 4*i); i=i+1 } return 0 } |
| 27 | func f32_exp(x: i64) -> i64 { return (x>>23)&0xFF } called by 1: main |
| 29 | func main() -> i64 |