code wiki / _hdl_build / nx_nofloat_serialize_gate.nx
nx_nofloat_serialize_gate.nx
buildroot/runtime/_hdl_build/nx_nofloat_serialize_gate.nx
about
nx_nofloat_serialize_gate.nx -- CAP-NF-SERIALIZE: sovereign model PERSISTENCE (save/load trained weights).
You can't deploy a model you can't save -- this is the missing systems piece. Own binary format:
[magic][n][WN[0..n-1]][weight arrays raw i64][checksum]. Pure integer, sovereign (sys_openat/read/write only).
T1 ROUND-TRIP LOSSLESS: deserialized weights are BIT-IDENTICAL to the originals.
T2 INTEGRITY: checksum recomputed from the loaded weights == the stored checksum.
T3 TEETH: flipping one loaded value makes the recomputed checksum MISMATCH (corruption is detectable).
expect_exit: 0 Sovereign: nx_syscalls only.
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_gate_emit_lib.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
| 10 | const MAGIC: i64 = 6219518 // "NVM1"-ish sovereign model magic |
functions
| 13 | func dini(a: *i64, n: i64, sd: i64) -> i64 { var i: i64=0; while i<n { a[i]=(((i*7+sd*13+1)%97)-48)*131 + sd*7; i=i+1 } return 0 } called by 1: main |
| 14 | func wi64(fd: i64, v: i64) -> i64 { let c: *i64=sys_mmap(8) as *i64; c[0]=v; sys_write(fd, c as *u8, 8); return 0 } |
| 15 | func ri64(fd: i64) -> i64 { let c: *i64=sys_mmap(8) as *i64; sys_read(fd, c as *u8, 8); return c[0] } |
| 16 | func checksum(W: *i64, WN: *i64, n: i64) -> i64 { var s: i64=0; var i: i64=0; while i<n { let a: *i64=W[i] as *i64; let cn: i64=WN[i]; var c: i64=0; while c<cn { s=s+a[c]; c=c+1 } i=i+1 } return s } |
| 18 | func serialize(path: *u8, W: *i64, WN: *i64, n: i64) -> i64 |
| 29 | func deserialize(path: *u8, W2: *i64, WN2: *i64, n_expect: i64) -> i64 |
| 41 | func main() -> i64 |