code wiki / (root) / nx_gen_prenorm_mod_verify.nx

nx_gen_prenorm_mod_verify.nx

buildroot/runtime/nx_gen_prenorm_mod_verify.nx

6207 B161 linesdepth 6pulls 12 transitivereach 0 importersview sourcekind tooltopic gen
docsdependenciesstructsconstsfunctions

about

nx_gen_prenorm_mod_verify.nx -- SOVEREIGN DiT pre-norm + adaLN modulate, verified vs the oracle. y[t][i] = ( x[t][i] / sqrt(mean_i(x[t]^2) + eps) * w[i] ) * (1 + scale[i]) This is the entry half of every modulated DiT block: RMSNorm, then scale-modulation broadcast from one chunk of the adaLN vector. Z-Image, Flux and SD3/MMDiT all use this shape; only the chunk COUNT and INDEX differ, so both are arguments. Usage: nx_gen_prenorm_mod_verify <model> <x> <norm_w> <adaln> <n_chunks> <scale_idx> <y> [rows] [eps_recip] It is a TWO-op composite on purpose. RMSNorm is already verified standalone by nx_gen_rmsnorm_verify, so if this organ is RED while that one is GREEN the fault is isolated to the modulate half or to the chunk index -- which is the only reason a composite is acceptable here rather than a fixture for the intermediate. Hardware __f32_* intrinsics in the hot loop, never the nx_f32_* software twins. license_tier: ORIGINAL

dependencies 8 imports · 0 importers

nx_syscalls.nx nx_le.nx nx_f32.nx nx_f32_div.nx nx_f32_cvt.nx nx_strconv.nx nx_genfix.nx nx_genver.nx nx_gen_prenorm_mod_verify.nx

imports: nx_syscalls.nxnx_le.nxnx_f32.nxnx_f32_div.nxnx_f32_cvt.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 zp_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

28const K_MAGIC_1000000: i64 = 1000000

functions

30func zp_strlen(s: *u8) -> i64
called by 1: main
36func main(argc: i64, argv: *i64) -> i64