nx_nofloat_q6k_gate.nx
buildroot/runtime/nx_nofloat_q6k_gate.nx
about
nx_nofloat_q6k_gate.nx -- sovereign Q6_K -> Q16 integer dequant (unlocks Qwen embeddings + LM head).
Q4_K_M stores token_embd.weight and output.weight as Q6_K, which the substrate didn't ship -- so a faithful
no-float forward needs this dequant. GGML Q6_K super-block = 256 values in 210 bytes: ql[128] (low 4 bits),
qh[64] (high 2 bits), scales[16] (int8 per-16 sub-scale), d (f16 super-scale). value = d * scale * (q-32),
q the assembled 6-bit quant -- done PURE INTEGER (f16->Q16 by bit-decode, then integer mults) so no float
touches the weights (deterministic). Proven: (a) KAT scale path (scales=0 -> 0; scales=1 -> uniform -32);
(b) KAT 6-bit unpack (ql=0x0F,qh=0x03 -> q=31 at y[0]); (c) the REAL Qwen Q6_K tensor dequants to sane
integer weights; (d) deterministic. No hw writes (Rule 26). expect_exit: 0 license_tier: ORIGINAL
dependencies 7 imports · 0 importers
imports: nx_syscalls.nxnx_tier.nxnx_le.nxnx_tensor.nxnx_gguf.nxnx_gguf_load.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
| 17 | func q6_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 18 | func q6_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 } |
| 21 | func q6_f16_to_q16(h: i64) -> i64 called by 1: q6k_block_to_q16 |
| 31 | func q6_i8(buf: *u8, off: i64) -> i64 { let v: i64 = nx_le_read_u8(buf, off); if v>=128 { return v-256 } return v } |
| 34 | func q6k_block_to_q16(buf: *u8, super_off: i64, n_values: i64, out: *i64) -> i64 |
| 67 | func main() -> i64 |