code wiki / _hdl_build / nx_nofloat_generate_gate.nx

nx_nofloat_generate_gate.nx

buildroot/runtime/_hdl_build/nx_nofloat_generate_gate.nx

5649 B88 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind gate/prooftopic nofloat
docsdependenciesstructsconstsfunctions

about

nx_nofloat_generate_gate.nx -- AUTOREGRESSIVE TEXT GENERATION from a trained no-float LM, integer Q16 (CAP-NF-GENERATE). Train an attention-only char-LM to memorize a short string, then argmax-decode it back: seed the first char, run the model on the generated-so-far prefix, take the last position's argmax, append, repeat. Reproducing the text = the model generates. Lean (nx_cc .s ceiling): 2 clm_fwd sites (train, gen). expect_exit: 0 Sovereign: nx_nofloat_autograd + nx_syscalls.

dependencies 3 imports · 0 importers

nx_nofloat_autograd.nx nx_g_puts_lib.nx nx_syscalls.nx nx_nofloat_generate_gate.nx

imports: nx_nofloat_autograd.nxnx_g_puts_lib.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 g_puts sys_write slen sys_mmap dini clm_fwd nfa_leaf nfa_new nfa_embed nfa_new ↻ nfa_rmsnorm_rows nfa_new ↻ nfa_qmul nfa_isqrt nfa_matmul nfa_new ↻ nfa_rope nfa_new ↻ nfa_fxexp nfa_cosf nfa_reduce2pi nfa_cosq nfa_qmul ↻ nfa_sinf nfa_reduce2pi ↻ nfa_sinq nfa_qmul ↻ nfa_qmul ↻ nfa_matmul_nt nfa_new ↻ nfa_cmul nfa_new ↻ nfa_qmul ↻ nfa_softmax_rows nfa_new ↻ nfa_fxexp ↻ nfa_vadd nfa_new ↻ nfa_softce_rows

structs

none

consts

none

functions

9func g_pn(v: i64) -> i64 { let b: *u8=sys_mmap(28); var x: i64=v; if x<0{b[0]=45;sys_write(1,b,1);x=0-x} if x==0{b[0]=48;sys_write(1,b,1);return 0} var d: i64=0; var y: i64=x; while y>0{d=d+1;y=y/10} var i: i64=d-1; y=x; while i>=0{b[i]=(48+(y%10)) as u8;y=y/10;i=i-1} sys_write(1,b,d); return 0 }
called by 1: main calls 2: sys_mmapsys_write
10func slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 1: main
11func allmatch(gen: *i64, seq: *i64, L: i64) -> i64 { var ok: i64=1; var i: i64=0; while i<L { if gen[i]!=seq[i] { ok=0 } i=i+1 } return ok }
called by 1: main
12func dini(a: *i64, n: i64, sd: i64) -> i64 { var i: i64=0; while i<n { a[i]=(((i*7+sd*13+1)%11)-5)*13107; i=i+1 } return 0 }
called by 1: main
13func amx(tape: *i64, vals: *i64, logn: i64, r: i64, V: i64) -> i64 { let o: i64=tape[7*logn+5]; var b: i64=0; var bv: i64=vals[o+r*V]; var j: i64=1; while j<V { if vals[o+r*V+j]>bv { bv=vals[o+r*V+j]; b=j } j=j+1 } return b }
called by 1: main
14func clm_fwd(tape: *i64, vals: *i64, st: *i64, W: *i64, ids: *i64, tgt: *i64, T: i64, dm: i64, V: i64, scale: i64, leaves: *i64) -> i64
42func step_all(tape: *i64, grads: *i64, W: *i64, WN: *i64, leaves: *i64, nW: i64, lr: i64, clip: i64, gb: *i64) -> i64
called by 1: main calls 2: nfa_gradnfa_sgd
47func main() -> i64