code wiki / _hdl_build / nx_fnet_grad_gate.nx

nx_fnet_grad_gate.nx

buildroot/runtime/_hdl_build/nx_fnet_grad_gate.nx

6980 B170 linesdepth 5pulls 7 transitivereach 0 importersview sourcekind gate/prooftopic fnet
docsdependenciesstructsconstsfunctions

about

nx_fnet_grad_gate.nx -- GATE for FNET-002: the FNet mixer's backward pass (VJP). Proves, by RUNNING, that the mixer is SELF-ADJOINT, so dL/dx = fnet_mix(dL/dy) -- backprop is one forward mix, zero stored activations, zero parameters. Three independent proofs (n=8, d=4 -> a 32-dim operator): G1 SYMMETRY extract the operator matrix M by impulse responses (M[:,k] = fnet_mix(S*e_k)); the real-linear FNet operator must be SYMMETRIC (A = A^T) because it is the real part of a Kronecker product of symmetric DFT matrices. Measure max|M[i,j]-M[j,i]|. G2 ADJOINT TEST the relationship backprop relies on: <A x, g> == <x, A* g> with A* = A. Measure |<Ax,g> - <x,Ag>| -- zero (to rounding) IFF using fnet_mix as the backward is the correct VJP. G3 GRADCHECK finite-difference the scalar loss L(x)=sum a*fnet_mix(x): central differences vs the analytic backward fnet_mix_backward(a). Max |fd - analytic|. All three are robust to the Q14 fixed-point rounding (tolerances are a small % of signal, actuals reported). Evidence -> knowledge/status/fnet_grad.log (FNETGRADGATE authored=organ ... verdict=GREEN). license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_fnet_mix.nx nx_syscalls.nx nx_fnet_grad_gate.nx

imports: nx_fnet_mix.nxnx_syscalls.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 fg_forward sys_mmap ↻ fnet_mix sys_mmap ↻ fnet_build_twiddles fnet_q16_to_q14 fx_cos fx_sin_cos fx_normalize_angle fx_cordic_atan fx_sin fx_sin_cos ↻ fnet_fft_fwd nx_fft_log2 nx_fft_bit_reverse fg_abs sys_openat_append fg_w sys_write fg_wn sys_mmap ↻ sys_write ↻ sys_close

structs

none

consts

19const FG_LOG: *u8 = "knowledge/status/fnet_grad.log"

functions

21func fg_w(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 }
called by 1: main calls 1: sys_write
22func fg_wn(fd: i64, v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
32func fg_abs(x: i64) -> i64 { if x < 0 { return 0 - x } return x }
called by 1: main
35func fg_forward(src: *i64, n: i64, d: i64, out: *i64) -> i64
called by 1: main calls 2: sys_mmapfnet_mix
49func main() -> i64