nx_f32_rectflow_denoise.nx
buildroot/runtime/nx_f32_rectflow_denoise.nx
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
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
structs
| none |
consts
| 21 | const NX_MAGIC_100000: i64 = 100000 |
| 23 | const NX_F32RF_OK: i64 = 0 |
| 24 | const NX_F32RF_ERR: i64 = 1 |
functions
| 26 | func nx_f32_rectflow_denoise(x: *i64, n_tokens: i64, D: i64, d_ff: i64, gamma: *i64, eps: i64, |
| 51 | func main() -> i64 |