code wiki / (root) / nx_gen_adaln_gate_verify.nx

nx_gen_adaln_gate_verify.nx

buildroot/runtime/nx_gen_adaln_gate_verify.nx

6078 B144 linesdepth 6pulls 14 transitivereach 0 importersview sourcekind tooltopic gen
docsdependenciesstructsconstsfunctions

about

nx_gen_adaln_gate_verify.nx -- SOVEREIGN adaLN gated residual join, verified vs the oracle. out == inner * tanh(gate) + residual where `gate` is one chunk of a block's adaLN modulation vector, broadcast across all tokens. This is the join at the end of each half of a modulated DiT block. Usage: nx_gen_adaln_gate_verify <model> <inner> <adaln> <n_chunks> <gate_idx> <residual> <out> [rows] The three tensors are NAMED, not derived from a scope with fixed op names. The first version hardcoded attn_norm2/blk_in/mid, which meant it could only ever check the ATTENTION half of a block -- the identical join at the end of the FFN half needed a second organ. Naming them makes one organ cover both halves, and any architecture that gates a residual this way. The CHUNK COUNT AND INDEX ARE ARGUMENTS because they are architecture facts, not universal ones: Z-Image packs 4 chunks [scale_msa|gate_msa|scale_mlp|gate_mlp], Flux-style blocks pack 6 [shift|scale|gate] x2. Baking either in would make this organ silently verify the wrong slice the first time it met another model -- and a wrong slice still produces plausible numbers, so it would not announce itself. This organ needs NO model weights: every input is an oracle fixture. That makes it the cheapest possible check of the chunk ORDER, an assumption every downstream organ inherits. 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_f32_exp.nx nx_f32_activations.nx nx_strconv.nx nx_genfix.nx nx_genver.nx nx_gen_adaln_gate_verify.nx

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

imported by: nobody (leaf or entry point)

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

main nx_genver_emit 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_format_i64 sys_write ↻ sys_mmap ↻ nx_strconv_parse_i64 nx_ascii_is_digit zg_strlen nx_genfix_dims sys_mmap ↻ _gf_read_manifest sys_mmap ↻ _gf_cpyz nx_genfix_root sys_openat_rd sys_read sys_close nx_genfix_load _gf_path sys_mmap ↻ _gf_cpyz ↻ nx_genfix_root ↻ _gf_cpy sys_openat_rd ↻ sys_mmap ↻

structs

none

consts

36const K_ROWS_CHECK: i64 = 4

functions

38func zg_strlen(s: *u8) -> i64
called by 1: main
44func main(argc: i64, argv: *i64) -> i64