code wiki / _hdl_build / nx_ssm_gate.nx

nx_ssm_gate.nx

buildroot/runtime/_hdl_build/nx_ssm_gate.nx

8328 B185 linesdepth 6pulls 16 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 3 imports · 0 importers

nx_autograd_tensor.nx nx_syscalls.nx nx_gate_verdict.nx nx_ssm_gate.nx

imports: nx_autograd_tensor.nxnx_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 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 ↻ 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 ↻

structs

none

consts

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

functions

20func 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
21func ss_wn(fd: i64, v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
32func 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
42func 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
48func 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
58func main() -> i64