code wiki / (root) / nx_f32_dit_block_simd.nx

nx_f32_dit_block_simd.nx

buildroot/runtime/nx_f32_dit_block_simd.nx

7872 B207 linesdepth 6pulls 9 transitivereach 0 importersview sourcekind tooltopic f32
docsdependenciesstructsconstsfunctions

about

nx_f32_dit_block_simd.nx -- SANA-DiT block with SIMD (__f32x8_dot) projections: the end-to-end fast unit. Bridges the two layouts: activations flow as i64-f32 for the elementwise/attention ops; before each projection they PACK to 4-byte f32 (weights pre-packed once) so dbl_linear_simd runs the compute bulk on AVX vmulps (~10x, measured in nx_f32_linear_simd). Same block as nx_f32_dit_block_linear; only the linears change. adaLN-Zero gate (gt=0 => out==x) proves the wiring survives the layout bridging. Scratch mmap'd inside (block called a handful of times, not a hot loop) to keep the arg list small. license_tier: ORIGINAL

dependencies 6 imports · 0 importers

nx_syscalls.nx nx_le.nx nx_f32.nx nx_f32_div.nx nx_f32_cvt.nx nx_f32_activations.nx nx_f32_dit_block_simd.nx

imports: nx_syscalls.nxnx_le.nxnx_f32.nxnx_f32_div.nxnx_f32_cvt.nxnx_f32_activations.nx

imported by: nobody (leaf or entry point)

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

main sys_mmap nx_f32_div nx_f32_classify nx_f32_exp_field nx_f32_mant_field nx_f32_sign nx_f32_mant_field ↻ nx_f32_exp_field ↻ nx_i32_to_f32 dsb_pack nx_le_write_u32 nx_f32_dit_block_simd sys_mmap ↻ dsb_modulate nx_f32_add nx_f32_classify ↻ nx_f32_sign ↻ nx_f32_mant_field ↻ nx_f32_exp_field ↻ nx_f32_mul nx_f32_classify ↻ nx_f32_sign ↻ nx_f32_mant_field ↻ nx_f32_exp_field ↻ nx_i32_to_f32 ↻ dsb_pack ↻ dsb_linear_simd nx_f32_add ↻ dsb_linattn dsb_phi nx_f32_add ↻ nx_i32_to_f32 ↻ nx_f32_add ↻ nx_f32_mul ↻ nx_f32_div ↻ dsb_gate_res nx_f32_add ↻ nx_f32_mul ↻ nx_f32_mul ↻

structs

none

consts

none

functions

16func dsb_phi(v: i64) -> i64
called by 1: dsb_linattn calls 2: nx_f32_addnx_i32_to_f32
22func dsb_pack(src: *i64, dst: *u8, count: i64) -> i64
28func dsb_linear_simd(inp_p: *u8, W_p: *u8, out: *i64, n: i64, id: i64, od: i64) -> i64
called by 1: nx_f32_dit_block_simd calls 1: nx_f32_add
46func dsb_modulate(x: *i64, sc: *i64, sh: *i64, out: *i64, n: i64, D: i64) -> i64
56func dsb_linattn(Q: *i64, K: *i64, V: *i64, n: i64, D: i64, out: *i64, S: *i64, z: *i64) -> i64
91func dsb_gate_res(x: *i64, y: *i64, gt: *i64, out: *i64, n: i64, D: i64) -> i64
101func nx_f32_dit_block_simd(x: *i64, n: i64, D: i64, dff: i64,
149func main() -> i64