code wiki / (root) / nx_gen_taedec.nx

nx_gen_taedec.nx

buildroot/runtime/nx_gen_taedec.nx

13583 B360 linesdepth 6pulls 13 transitivereach 0 importersview sourcekind tooltopic gen
docsdependenciesstructsconstsfunctions

about

nx_gen_taedec.nx -- SOVEREIGN TAESD (tiny VAE) decoder: latent -> RGB pixels. The last stage before an image. TAESD is 9.4MB of plain f32 3x3 convolutions where the full VAE is 320MB with attention, so it is the cheapest honest route from a sovereign latent to a sovereign picture. h = tanh(z/3)*3 (the caller's fixture already starts here) conv3x3 16->64 (+bias), relu [TAEBlock x3] upsample2 conv3x3 64->64 (no bias) [TAEBlock x3] upsample2 conv3x3 64->64 (no bias) [TAEBlock x3] upsample2 conv3x3 64->64 (no bias) [TAEBlock x1] conv3x3 64->3 (+bias) TAEBlock: conv0 -> relu -> conv2 -> relu -> conv4, then + input, then relu Usage: nx_gen_taedec <model_id> <taesd.safetensors> [workers] [in] [ref] ⚠WHY THIS DOES NOT CALL nx_f32_conv2d_forward That organ's inner loop uses nx_f32_add / nx_f32_mul -- the SOFTWARE IEEE-754 pair -- not the hardware __f32_* intrinsics beside them. At this decoder's ~20 G MACs that is the difference between ~25 minutes and seconds. Same defect class this lane has now hit four times, here in a pre-existing shared organ (filed separately; fixing it there is a fleet change, not a local one). ★★★★★ WHEN A SOVEREIGN KERNEL IS 10x UNDER PEAK, SUSPECT AN nx_-PREFIXED HELPER. Layout is planar packed f32 [C][H][W], W contiguous -- the same order ggml uses ([W,H,C,N]) and the same order safetensors stores conv weights ([C_out][C_in][KH][KW]). license_tier: ORIGINAL

dependencies 10 imports · 0 importers

nx_syscalls.nx nx_le.nx nx_f32.nx nx_f32_div.nx nx_f32_cvt.nx nx_f16.nx nx_strconv.nx nx_genfix.nx nx_genver.nx nx_safetensors_load.nx nx_gen_taedec.nx

imports: nx_syscalls.nxnx_le.nxnx_f32.nxnx_f32_div.nxnx_f32_cvt.nxnx_f16.nxnx_strconv.nxnx_genfix.nxnx_genver.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 td_puts sys_write sys_mmap nxa_die sys_write ↻ sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ nx_strconv_parse_i64 nx_ascii_is_digit sys_map_file sys_openat_rd sys_lseek sys_close stl_header_len stl_u64le stl_data_start stl_u64le ↻ nx_genver_emit sys_mmap ↻ nx_strconv_format_i64 sys_write ↻ nx_genfix_dims sys_mmap ↻ _gf_read_manifest sys_mmap ↻ _gf_cpyz nx_genfix_root sys_openat_rd ↻ sys_read

structs

none

consts

39const TD_CH: i64 = 64

functions

41func td_puts(s: *u8) -> i64
called by 1: main calls 1: sys_write
46func td_strlen(s: *u8) -> i64
called by 1: main
53func td_conv_band(inp: *u8, out: *u8, w: *u8, bias: *u8,
102func td_conv(inp: *u8, out: *u8, w: *u8, bias: *u8,
121func td_relu(x: *u8, n: i64) -> i64
131func td_add(a: *u8, b: *u8, n: i64) -> i64
140func td_copy(dst: *u8, src: *u8, n: i64) -> i64
147func td_up2(inp: *u8, out: *u8, C: i64, H: i64, W: i64) -> i64
called by 1: main calls 2: nx_le_read_u32nx_le_write_u32
168func td_load(buf: *u8, hlen: i64, dstart: i64, name: *u8, n: i64) -> *u8
186func td_name(out: *u8, layer: i64, suffix: *u8) -> *u8
208func td_layer_conv(a: *u8, b: *u8, layer: i64, C_in: i64, C_out: i64, H: i64, W: i64, has_bias: i64) -> i64
called by 1: main calls 4: sys_mmaptd_loadtd_nametd_conv
222func td_block(x: *u8, t1: *u8, t2: *u8, layer: i64, C: i64, H: i64, W: i64) -> i64
246func main(argc: i64, argv: *i64) -> i64