code wiki / _hdl_build / nx_ssm_gate.nx

nx_ssm_gate.nx

buildroot/runtime/_hdl_build/nx_ssm_gate.nx

7799 B177 linesdepth 6pulls 15 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_ssm_gate.nx -- GATE for SSM-001: the CAUSAL state-space mixer (the autoregressive sub-quadratic lane, vs FNet's bidirectional encoder lane). Proves, by RUNNING: G1 GRADCHECK through the autograd: x[4,2] + learnable decay a[2] -> ta_ssm -> mse(.,target); analytic gradients for BOTH the input dx AND the decay da (backprop-through-time) vs central finite difference (h=1/128, rel<1/32 floor 1/64). Proves the reverse-scan backward is correct. G2 CAUSALITY: perturbing the input at the LAST time step leaves every EARLIER output unchanged, and changes only the last output -- i.e. the operator's Jacobian is lower-triangular (y_t sees only x_<=t). This is what FNet cannot do and what autoregressive generation requires. Evidence -> knowledge/status/ssm.log (SSMGATE authored=organ ... verdict=GREEN). license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_autograd_tensor.nx nx_syscalls.nx nx_ssm_gate.nx

imports: nx_autograd_tensor.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 ta_constf 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 ss_build ta_leaf ta_new ta_ssm ta_new ↻ 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 ↻ ta_mse ta_new ↻ nx_f32_sub nx_f32_add ↻ nx_f32_neg nx_f32_add ↻ nx_f32_mul ↻ nx_f32_div ↻ nx_i32_to_f32 ↻ ta_backward nx_f32_add ↻ nx_f32_mul ↻ nx_f32_gt nx_f32_lt

structs

none

consts

14const SS_N: i64 = 4
15const SS_D: i64 = 2
16const SS_ND: i64 = 8
17const SS_LOG: *u8 = "knowledge/status/ssm.log"

functions

19func ss_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
20func ss_wn(fd: i64, v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
31func ss_build(tape: *i64, vals: *i64, st: *i64, a: *i64, x: *i64, target: *i64, ax: *i64) -> i64
called by 2: ss_lossmain calls 3: ta_leafta_ssmta_mse
41func ss_loss(tape: *i64, vals: *i64, st: *i64, a: *i64, x: *i64, target: *i64) -> i64
called by 1: main calls 3: sys_mmapss_buildta_val
47func ss_forward(tape: *i64, vals: *i64, st: *i64, a: *i64, x: *i64, yout: *i64) -> i64
called by 1: main calls 3: ta_leafta_ssmta_val
57func main() -> i64