code wiki / _hdl_build / nx_research_flip_scale_gate.nx

nx_research_flip_scale_gate.nx

buildroot/runtime/_hdl_build/nx_research_flip_scale_gate.nx

10325 B180 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind gate/prooftopic research
docsdependenciesstructsconstsfunctions

about

nx_research_flip_scale_gate.nx -- does the sovereign flip-graph discoverer SCALE past the 2x2 toy case? Generalize the engine to arbitrary <m,n,p> matmul (multiply mxn by nxp) and DISCOVER a non-trivial rank reduction in a NEW shape: <2,2,3> has naive rank 12 and proven optimum 11 (Hopcroft-Kerr). The flip/reduce mechanics are dimension-agnostic (GF(2) mask XORs); only the tensor + naive builder + Brent loop need the dims. Anchored on <2,2,2> (known: 8->7) to prove the generalized engine still works, then attempts <2,2,3> (12->11). HONEST: 7 and 11 are the proven optima for these shapes (cited); discovered sovereignly, no AlphaTensor-record claim. GREEN iff 7/7. license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_research_flip_scale_gate.nx

imports: nx_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 g_w sys_write build_t build_naive brent_gf2 bitof discover sys_mmap ↻ run_search sys_mmap ↻ build_naive ↻ copy_scheme do_flip rpos xrng reduce_pass copy_scheme ↻ copy_scheme ↻ g_n g_w ↻ sys_mmap ↻ sys_write ↻ g_row g_w ↻ sys_exit

structs

none

consts

none

functions

10func g_w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 3: g_ng_rowmain calls 1: sys_write
11func g_n(v: i64) -> i64 { var m: i64=v; if m<0{g_w("-");m=0-m} let t:*u8=sys_mmap(24); var k:i64=0; if m==0{t[0]=48 as u8;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var i:i64=0; let o:*u8=sys_mmap(24); while i<k{o[i]=t[k-1-i];i=i+1}; sys_write(1,o,k); return 0 }
called by 1: main calls 3: g_wsys_mmapsys_write
12func g_row(id: *u8, ok: i64, pass: *i64) -> i64 { g_w(" "); g_w(id); g_w(": "); if ok==1 { g_w("OK\n"); pass[0]=pass[0]+1 } else { g_w("FAIL\n") } return 0 }
called by 1: main calls 1: g_w
14func bitof(x: i64, i: i64) -> i64 { return (x>>i)&1 }
called by 1: brent_gf2
15func xrng(s: *i64) -> i64 { var x: i64=s[0]; x = x ^ (x << 13); x = x ^ (x >> 7); x = x ^ (x << 17); s[0]=x; return x }
called by 1: rpos
16func rpos(s: *i64) -> i64 { let v: i64 = xrng(s); return v & 0x3FFFFFFFFFFFFFFF }
called by 1: do_flip calls 1: xrng
19func build_t(t: *i64, m: i64, n: i64, p: i64) -> i64
called by 1: main
31func build_naive(U: *i64, V: *i64, W: *i64, m: i64, n: i64, p: i64) -> i64
called by 2: run_searchmain
40func brent_gf2(U: *i64, V: *i64, W: *i64, R: i64, t: *i64, da: i64, db: i64, dc: i64) -> i64
called by 1: main calls 1: bitof
53func copy_scheme(sU: *i64, sV: *i64, sW: *i64, dU: *i64, dV: *i64, dW: *i64, R: i64) -> i64 { var i: i64=0; while i<R { dU[i]=sU[i]; dV[i]=sV[i]; dW[i]=sW[i]; i=i+1 } return 0 }
55func reduce_pass(U: *i64, V: *i64, W: *i64, rp: *i64) -> i64
called by 1: run_search
84func do_flip(U: *i64, V: *i64, W: *i64, rp: *i64, st: *i64, cand: *i64) -> i64
called by 1: run_search calls 1: rpos
123func discover(m: i64, n: i64, p: i64, da: i64, db: i64, dc: i64, t: *i64, dU: *i64, dV: *i64, dW: *i64, drp: *i64, steps: i64, target: i64, nseeds: i64) -> i64
called by 1: main calls 3: sys_mmaprun_searchcopy_scheme
139func main() -> i64