nx_nofloat_weightconv_gate.nx
buildroot/runtime/nx_nofloat_weightconv_gate.nx
about
nx_nofloat_weightconv_gate.nx -- the BRIDGE: load REAL BF16 model weights -> no-float Q16 integer.
To run a frontier open model (GLM-5 etc.) on the sovereign no-float stack we must convert its BF16/FP8
weights to our integer Q format -- and to keep the WEIGHTS themselves bit-exact reproducible, the
conversion is PURE INTEGER (no float touches them). BF16 = top 16 bits of an f32: sign(1) exp(8) mant(7).
value = (-1)^s * 2^(exp-127) * (1 + mant/128); Q16 = value*2^16 = (-1)^s * (128+mant) << (exp-118).
Decoded with bit-shifts only -> DETERMINISTIC. Verified: synthetic BF16 (1.0/2.0/0.5/1.5/-1.0) convert
EXACTLY, then a REAL BF16 tensor is read from a safetensors on disk (bounded read) + converted + sane.
No hw writes (Rule 26). expect_exit: 0 license_tier: ORIGINAL
dependencies 2 imports · 0 importers
imports: nx_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
structs
| none |
consts
| none |
functions
| 12 | func wc_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 13 | func wc_num(v: i64) -> i64 { let b: *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 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{b[i]=t[k-1-i];i=i+1} sys_write(1,b,k); return 0 } |
| 16 | func bf16_to_q16(bf: i64) -> i64 called by 1: main |
| 30 | func main() -> i64 |