code wiki / _hdl_build / _autograd_authored.nx
_autograd_authored.nx
buildroot/runtime/_hdl_build/_autograd_authored.nx
about
AUTHORED BY THE NISHI BUILDER (nx_module_author autograd template) -- L1 training substrate rung 1.
Tape reverse-mode autograd on the sovereign f32 tower; tutoring: specs/2026-06-09-tutoring-training-substrate-rung1.md
dependencies 4 imports · 0 importers
imports: nx_syscalls.nxnx_f32.nxnx_f32_div.nxnx_f32_cvt.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
| none |
functions
| 7 | func _ag_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 8 | func _ag_num(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;k=1}; while m>0{t[k]=48+(m%10);m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(1,bb,k); return 0 } |
| 9 | func ag_q(n: i64, d: i64) -> i64 { return nx_f32_div(nx_i32_to_f32(n), nx_i32_to_f32(d)) } |
| 10 | func ag_milli(v: i64) -> i64 |
| 24 | func ag_node(tape: *i64, nb: *i64, op: i64, ai: i64, bi: i64, v: i64) -> i64 |
| 34 | func ag_leaf(tape: *i64, nb: *i64, v: i64) -> i64 { return ag_node(tape, nb, 0, 0, 0, v) } |
| 35 | func ag_add(tape: *i64, nb: *i64, x: i64, y: i64) -> i64 { return ag_node(tape, nb, 1, x, y, nx_f32_add(tape[x*5+3], tape[y*5+3])) } |
| 36 | func ag_mul(tape: *i64, nb: *i64, x: i64, y: i64) -> i64 { return ag_node(tape, nb, 2, x, y, nx_f32_mul(tape[x*5+3], tape[y*5+3])) } |
| 37 | func ag_sub(tape: *i64, nb: *i64, x: i64, y: i64) -> i64 { return ag_node(tape, nb, 3, x, y, nx_f32_sub(tape[x*5+3], tape[y*5+3])) } |
| 38 | func ag_relu(tape: *i64, nb: *i64, x: i64) -> i64 |
| 43 | func ag_backward(tape: *i64, nt: i64, root: i64) -> i64 |
| 72 | func gc_fwd(w1: i64, b1: i64, w2: i64, b2: i64, x: i64) -> i64 |
| 78 | func gate_a(tape: *i64, nb: *i64) -> i64 |
| 119 | func ag_train(tape: *i64, nb: *i64, out: *i64) -> i64 |
| 162 | func main() -> i64 |