nx_gen_adaln_gate_verify.nx
buildroot/runtime/nx_gen_adaln_gate_verify.nx
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
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
structs
| none |
consts
| 36 | const K_ROWS_CHECK: i64 = 4 |
functions
| 38 | func zg_strlen(s: *u8) -> i64 called by 1: main |
| 44 | func main(argc: i64, argv: *i64) -> i64 |