nx_blockfloat_block_gate.nx
buildroot/runtime/nx_blockfloat_block_gate.nx
about
nx_blockfloat_block_gate.nx -- BLOCK-FLOAT weights through the REAL no-float TRANSFORMER BLOCK. Composes the
gradcheck-verified pre-norm block forward (blk_fwd/blk_out, from nx_nofloat_block_gate: RMSNorm -> Q/K/V -> RoPE
-> scaled causal-softmax attention -> out-proj -> residual -> SwiGLU-FFN -> residual) UNCHANGED, but runs it with
the weight matrices (Wq,Wk,Wv,Wo,Wg,Wu,Wd) BLOCK-FLOAT quantized (per-row-per-block power-of-2 scale). Proves a
real transformer component runs on block-float, and that block-float weights beat per-tensor INT8 at the BLOCK
output level while staying bit-exact deterministic. Mixed-magnitude weights (outlier rows) make the range matter.
1 the real block RUNS with block-float weights (non-trivial output)
2 EXCEED (MEASURED): block output error vs full-precision < per-tensor INT8 weights
3 DETERMINISTIC: the block-float block run twice == bit-identical
4 block-float weights are REAL (block output != full-precision output)
expect_exit: 0 license_tier: ORIGINAL
dependencies 3 imports · 0 importers
imports: nx_nofloat_autograd.nxnx_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
| 16 | const Q16: i64 = 65536 |
functions
| 18 | func bb_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 19 | func bb_pn(v: i64) -> i64 |
| 29 | func bb_chk(name: *u8, ok: i64) -> i64 |
| 33 | func bb_abs(x: i64) -> i64 { if x < 0 { return 0 - x } return x } |
| 34 | func bf_bitlen(x: i64) -> i64 { var b: i64 = 0; var m: i64 = x; while m > 0 { m = m >> 1; b = b + 1 } return b } called by 1: bf_scale_abs |
| 35 | func bf_scale_abs(W: *i64, off: i64, B: i64, MB: i64) -> i64 |
| 43 | func bf_quant_mat(W: *i64, rows: i64, cols: i64, B: i64, MB: i64, out: *i64) -> i64 |
| 60 | func bf_quant_pt(W: *i64, n: i64, MB: i64, out: *i64) -> i64 |
| 68 | func blk_fwd(tape: *i64, vals: *i64, st: *i64, X: *i64, Wq: *i64, Wk: *i64, Wv: *i64, Wo: *i64, Wg: *i64, Wu: *i64, Wd: *i64, T: i64, dm: i64, ffn: i64, scale: i64, leaves: *i64) -> i64 |
| 100 | func blk_out(tape: *i64, vals: *i64, st: *i64, X: *i64, Wq: *i64, Wk: *i64, Wv: *i64, Wo: *i64, Wg: *i64, Wu: *i64, Wd: *i64, T: i64, dm: i64, ffn: i64, scale: i64, outY: *i64) -> i64 |
| 108 | func main() -> i64 |