code wiki / (root) / nx_gen_ditfull.nx

nx_gen_ditfull.nx

buildroot/runtime/nx_gen_ditfull.nx

16535 B379 linesdepth 9pulls 24 transitivereach 0 importersview sourcekind tooltopic gen
docsdependenciesstructsconstsfunctions

about

nx_gen_ditfull.nx -- the COMPLETE sovereign Z-Image DiT forward, weights from the GGUF. txt_embed --[context_refiner x2, UNMODULATED]--> txt img_embed --[noise_refiner x2, modulated ]--> img concat(txt, img) --[layers x30, modulated]--> h --[final layer]--> [64, L] Everything after the text encoder and the latent embedding. No oracle tensor in the loop: weights are read from the model file, adaLN is computed per block, and every activation is the previous stage's own output. Usage: nx_gen_ditfull <model_id> <gguf_path> [workers] [reference] THE FINAL LAYER IS NOT A BLOCK and does not reuse br_block: scale = W_ada1 . silu(t_emb) + b <- silu HERE, unlike the blocks' adaLN x = LayerNorm(x) <- LayerNorm (mean-centred), NOT RMSNorm, no affine x = x * (1 + scale) x = W_lin . x + b Both differences were read out of FinalLayer::forward, not assumed. Reusing the block's adaLN path here would apply no silu and subtract no mean, and would still produce a finite tensor. ⚠TOKEN PADDING IS NOT IMPLEMENTED: this shape needs none (512 text and 256 image tokens are both multiples of SEQ_MULTI_OF=32, so n_pad=0). A shape that needs padding must append the learned cap_pad_token / x_pad_token first; this organ REFUSES rather than silently skipping it. license_tier: ORIGINAL

dependencies 13 imports · 0 importers

nx_syscalls.nx nx_le.nx nx_f32.nx nx_f32_div.nx nx_f32_cvt.nx nx_f16.nx nx_f32_exp.nx nx_f32_activations.nx nx_strconv.nx nx_genfix.nx nx_gen_ditfull.nx

diagram shows first 10 each side; +3 more imports, +0 more importers in the complete lists below.

imports: nx_syscalls.nxnx_le.nxnx_f32.nxnx_f32_div.nxnx_f32_cvt.nxnx_f16.nxnx_f32_exp.nxnx_f32_activations.nxnx_strconv.nxnx_genfix.nxnx_genver.nxnx_genweights.nxnx_genblock.nx

imported by: nobody (leaf or entry point)

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

main df_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 nx_gw_open sys_mmap ↻ sys_map_file sys_openat_rd sys_lseek sys_close stl_header_len stl_u64le stl_data_start stl_u64le ↻ nx_gguf_parse nx_le_read_u32 nx_le_read_u64 nx_le_read_u32 ↻ _gguf_skip_value nx_le_read_u64 ↻ nx_le_read_u32 ↻ _gguf_skip_value ↻ sys_mmap ↻ br_arch_bind

structs

none

consts

40const DF_SEQ_MULTI: i64 = 32
41const DF_EMB: i64 = 256

functions

43func df_puts(s: *u8) -> i64 {
called by 1: main calls 1: sys_write
50func df_final(gw: *i64, x: *u8, t_emb: *u8, out: *u8, T: i64, D: i64, OUTD: i64, NW: i64) -> i64 {
129func main(argc: i64, argv: *i64) -> i64 {