code wiki / (root) / nx_f32_rectflow_denoise.nx

nx_f32_rectflow_denoise.nx

buildroot/runtime/nx_f32_rectflow_denoise.nx

5027 B111 linesdepth 8pulls 13 transitivereach 0 importersview sourcekind tooltopic f32
docsdependenciesstructsconstsfunctions

about

nx_f32_rectflow_denoise.nx -- software-f32 rectified-flow (flow-matching) Euler denoise loop. sd-server -> Nishi migration: this REPLACES Z-Image Turbo's exact sampler -- FLOW_PRED (rectified flow) + euler method + discrete scheduler. Z-Image uses it at 6 steps. The loop runs the DiT block as the velocity predictor each step and integrates along the schedule: for s in 0..n_steps: v = DiT_block(x ; weights, conditioning_s) # predicted velocity (flow) dt = sigma[s+1] - sigma[s] # schedule step (rectified-flow: linear in sigma) x = x + dt * v # Euler update Composes the gated `nx_f32_dit_block_tiny` + f32 add/sub/mul. x: flat *i64 f32 bits [n_tokens, D] (mutated in place: noise -> clean latent). sigmas: [n_steps+1] f32 (the noise schedule). Weights are the DiT block's (shared across steps here; real inference varies the adaLN conditioning per timestep). license_tier: ORIGINAL

dependencies 5 imports · 0 importers

nx_syscalls.nx nx_f32.nx nx_f32_div.nx nx_f32_cvt.nx nx_f32_dit_block_tiny.nx nx_f32_rectflow_denoise.nx

imports: nx_syscalls.nxnx_f32.nxnx_f32_div.nxnx_f32_cvt.nxnx_f32_dit_block_tiny.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_i32_to_f32 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_f32_rectflow_denoise sys_mmap ↻ nx_f32_dit_block_tiny sys_mmap ↻ nx_i32_to_f32 ↻ nx_f32_rmsnorm nx_i32_to_f32 ↻ nx_f32_sqrt nx_f32_classify ↻ nx_f32_sign ↻ nx_f32_exp_field ↻ nx_f32_mant_field ↻ _f32_isqrt nx_f32_adaln_modulate nx_i32_to_f32 ↻ 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 ↻ ditb_linear nx_f32_add ↻ nx_f32_mul ↻ nx_f32_attention nx_f32_add ↻

structs

none

consts

21const NX_MAGIC_100000: i64 = 100000
23const NX_F32RF_OK: i64 = 0
24const NX_F32RF_ERR: i64 = 1

functions

26func nx_f32_rectflow_denoise(x: *i64, n_tokens: i64, D: i64, d_ff: i64, gamma: *i64, eps: i64,
51func main() -> i64