code wiki / (root) / nx_fwddiff_equiv_gate.nx

nx_fwddiff_equiv_gate.nx

buildroot/runtime/nx_fwddiff_equiv_gate.nx

11345 B216 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_fwddiff_equiv_gate.nx -- THE ARITHMETIC CORE OF THE FORWARD-DIFFERENCED CONIC EVALUATION, PROVEN INDEPENDENT OF THE RENDERER. WHY THIS GATE EXISTS. The splat rasterizer's inner loop evaluated, per pixel per splat: pnum = cc*dx*dx - 2*cb*dx*dy + ca*dy*dy ; k = pnum * MUL / det which is six multiplies and ONE 64-BIT INTEGER DIVISION on the hottest path in the estate -- measured at 25.9 ns per conic evaluation, an idiv's price rather than a multiply's. The published remedy (SHARP-GS, SIGGRAPH 2026: "Forward Differencing, which replaces expensive probability density function evaluations with efficient incremental updates") is to walk the quadratic by its constant second difference and to carry the quotient in a bracket instead of dividing. THAT REWRITE IS ONLY ADMISSIBLE IF IT IS EXACT. A renderer that is faster and changes one pixel is a broken renderer. Two identities carry the whole change, and this gate proves BOTH over a swept domain rather than asserting them from the algebra: IDENTITY 1 (forward difference): walking P by P += D ; D += DD reproduces P(dx) = MUL*(cc*dx^2 - 2*cb*dx*dy + ca*dy^2) exactly, because P is quadratic in dx and DD = 2*cc*MUL is its constant second difference. Integer arithmetic, so "exactly" means bit-for-bit, not "to within rounding". IDENTITY 2 (bracket = division): maintaining k*det <= P < (k+1)*det by stepping k yields exactly floor(P/det) = the integer the division produced, for every P >= 0 and det >= 1. THE SUBJECT IS THE IDENTITY, NOT THE RENDERER, so this gate deliberately imports NO renderer constants: it sweeps the multiplier, the LUT cut and the covariance terms, and our shipped values are one point inside that sweep. A gate that mirrored GLUTU/GEXPN would be a second copy of them -- this one is strictly stronger and owns nothing it could drift from. THE SWEEP IS DERIVED FROM THE GEOMETRY IT MODELS, never picked: ca and cc are built as e^2 + e^2 + 1 exactly as the projector builds them, cb is swept across the Cauchy-Schwarz bound that makes the form positive definite, and the pixel rectangle is the 3-sigma box the rasterizer actually walks.

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_fwddiff_equiv_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

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

main gv_ctr 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 ↻ gv_head gv_puts sys_write ↻ fd_e_at fd_isqrt fd_mul_at gv_puts ↻ gv_num sys_mmap ↻ sys_write ↻ sys_munmap gv_check gv_puts ↻ gv_bite gv_puts ↻ gv_verdict gv_note_bare_rate gv_bare_rate gv_at gv_obj_has_n gv_at ↻ gv_puts ↻ gv_num ↻

structs

none

consts

41const FD_NE: i64 = 6 // distinct projected-axis magnitudes
42const FD_NCB: i64 = 5 // cross-term steps across the positive-definite range
43const FD_NDY: i64 = 7 // scanline offsets from the splat centre
44const FD_NMUL: i64 = 3 // LUT sub-step multipliers (ours is one of these)
45const FD_SIGMA: i64 = 3 // AABB half-extent in sigma -- the box the rasterizer walks

functions

47func fd_isqrt(v: i64) -> i64
called by 1: main
55func fd_e_at(i: i64) -> i64
called by 1: main
63func fd_mul_at(i: i64) -> i64
called by 1: main
69func main() -> i64