code wiki / (root) / nx_f32_resblock.nx

nx_f32_resblock.nx

buildroot/runtime/nx_f32_resblock.nx

4610 B102 linesdepth 6pulls 10 transitivereach 1 importersview sourcekind tooltopic f32
docsdependenciesstructsconstsfunctions

about

nx_f32_resblock.nx -- software-f32 ResBlock (GroupNorm->SiLU->Conv 3x3, twice, + residual), R3/R7 rung. sd-server -> Nishi migration: the canonical conv ResBlock is the repeating unit of the VAE decoder and the SD/UNet stages. This composes the now-gated sovereign f32 bricks: nx_f32_groupnorm + nx_f32_silu (nx_f32_activations) + nx_f32_conv2d into: out = x + Conv2( SiLU( GN2( Conv1( SiLU( GN1(x) ) ) ) ) ) v1: C_in == C_out, 3x3 convs (pad 1, stride 1), same spatial dims, no time-embedding (the i64 ref nx_unet_block also omits it; time-embed injection is the next addition). Real dequantized weights flow. Buffers: flat *i64 of f32 bits. x [N,C,H,W] (preserved), out [N,C,H,W] (result), scratch [N,C,H,W] (caller-provided intermediate). x, out, scratch MUST be three distinct buffers. gamma/beta [C], conv weights [C,C,3,3], conv bias [C] (nullable=0). license_tier: ORIGINAL

dependencies 6 imports · 1 importers

nx_syscalls.nx nx_f32.nx nx_f32_cvt.nx nx_f32_groupnorm.nx nx_f32_conv2d.nx nx_f32_activations.nx nx_f32_resblock.nx nx_f32_vae_decode_tiny.nx

imports: nx_syscalls.nxnx_f32.nxnx_f32_cvt.nxnx_f32_groupnorm.nxnx_f32_conv2d.nxnx_f32_activations.nx

imported by: nx_f32_vae_decode_tiny.nx

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

main sys_mmap nx_i32_to_f32 nx_f32_resblock_forward nx_f32_groupnorm_forward nx_i32_to_f32 ↻ nx_f32gn_eps 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 ↻ nx_f32_add nx_f32_classify ↻ nx_f32_sign ↻ nx_f32_mant_field ↻ nx_f32_exp_field ↻ nx_f32_div ↻ nx_f32_sub nx_f32_add ↻ nx_f32_neg nx_f32_mul nx_f32_classify ↻ nx_f32_sign ↻ nx_f32_mant_field ↻ nx_f32_exp_field ↻ nx_f32_sqrt nx_f32_classify ↻ nx_f32_sign ↻ nx_f32_exp_field ↻ nx_f32_mant_field ↻ _f32_isqrt nx_f32rb_silu_inplace nx_f32_silu nx_f32_sigmoid nx_f32_neg ↻ nx_f32_exp

structs

none

consts

21const NX_F32RB_OK: i64 = 0

functions

24func nx_f32rb_silu_inplace(buf: *i64, nel: i64) -> i64
called by 1: nx_f32_resblock_forward calls 1: nx_f32_silu
30func nx_f32_resblock_forward(x: *i64, N: i64, C: i64, H: i64, W: i64, n_groups: i64,
58func main() -> i64