code wiki / (root) / nx_blockfloat_ddp_gate.nx

nx_blockfloat_ddp_gate.nx

buildroot/runtime/nx_blockfloat_ddp_gate.nx

7512 B146 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind gate/prooftopic blockfloat
docsdependenciesstructsconstsfunctions

about

nx_blockfloat_ddp_gate.nx -- THE CONVERGENCE: block-float weights inside DETERMINISTIC DISTRIBUTED training. Unites this session's two threads: block-float quant (FP8-class dynamic range, deterministic) + the byte-exact integer ring all-reduce (nx_fabric_collective). Each step: quantize W to block-float (per-block power-of-2 scale), FORWARD through the block-float dot, straight-through gradient, ring all-reduce across N data-parallel processes, integer optimizer step. PROVES the trained weights are BIT-IDENTICAL regardless of N -- so the combination quantized + sovereign + distributed + bit-exact-reproducible holds, which nothing in the float world can claim. criteria: 1 N=1 block-float DDP trains (W moves off zero) 2 N=2 -> final W byte-identical to N=1 3 N=4 -> final W byte-identical to N=1 4 N=8 -> final W byte-identical to N=1 (deterministic across ALL shardings WITH block-float in the loop) 5 block-float is REAL: block-float W != full-precision W (the quant changed the training, not a no-op) expect_exit: 0 license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_fabric_collective.nx nx_gate_verdict.nx nx_blockfloat_ddp_gate.nx

imports: nx_fabric_collective.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

main dp train bf_scale_abs bf_abs bf_bitlen dx dy ring_allreduce sys_mmap col_mod printw dp ↻ dn dchk dp ↻ wmoved weq dn ↻ gv_ctr sys_mmap ↻ gv_verdict gv_puts sys_write gv_num sys_mmap ↻ sys_write ↻ sys_munmap gv_journal sys_openat_append sys_mmap ↻ gv_catn sys_mmap ↻ sys_munmap ↻ sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real gv_cat sys_write ↻ sys_close

structs

none

consts

none

functions

17func dp(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: dchkprintwmain
18func dn(v: i64) -> i64
called by 2: printwmain
28func dchk(name: *u8, ok: i64) -> i64
called by 1: main calls 1: dp
32func printw(label: *u8, w: *i64, n: i64) -> i64
called by 1: main calls 2: dpdn
38func dx(s: i64, d: i64) -> i64 { return (s * 3 + d * 7 + 1) % 11 }
called by 1: train
39func dy(s: i64) -> i64 { return (s * 5 + 2) % 13 }
called by 1: train
40func bf_abs(x: i64) -> i64 { if x < 0 { return 0 - x } return x }
called by 1: bf_scale_abs
41func 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
43func bf_scale_abs(W: *i64, off: i64, B: i64, MB: i64) -> i64
called by 1: train calls 2: bf_absbf_bitlen
52func train(N: i64, M: i64, V: i64, T: i64, lr_div: i64, B: i64, MB: i64, do_bf: i64, out_w: *i64) -> i64
called by 1: main calls 4: bf_scale_absdxdyring_allreduce
112func weq(a: *i64, b: *i64, V: i64) -> i64 { var i: i64 = 0; var ok: i64 = 1; while i < V { if a[i] != b[i] { ok = 0 } i = i + 1 } return ok }
called by 1: main
113func wmoved(a: *i64, V: i64) -> i64 { var i: i64 = 0; var mv: i64 = 0; while i < V { if a[i] != 0 { mv = 1 } i = i + 1 } return mv }
called by 1: main
115func main() -> i64