nx_blockfloat_ddp_gate.nx
buildroot/runtime/nx_blockfloat_ddp_gate.nx
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
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
structs
| none |
consts
| none |
functions
| 17 | func dp(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 dn(v: i64) -> i64 |
| 28 | func dchk(name: *u8, ok: i64) -> i64 |
| 32 | func printw(label: *u8, w: *i64, n: i64) -> i64 |
| 38 | func dx(s: i64, d: i64) -> i64 { return (s * 3 + d * 7 + 1) % 11 } called by 1: train |
| 39 | func dy(s: i64) -> i64 { return (s * 5 + 2) % 13 } called by 1: train |
| 40 | func bf_abs(x: i64) -> i64 { if x < 0 { return 0 - x } return x } called by 1: bf_scale_abs |
| 41 | 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 |
| 43 | func bf_scale_abs(W: *i64, off: i64, B: i64, MB: i64) -> i64 |
| 52 | func train(N: i64, M: i64, V: i64, T: i64, lr_div: i64, B: i64, MB: i64, do_bf: i64, out_w: *i64) -> i64 |
| 112 | func 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 |
| 113 | func 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 |
| 115 | func main() -> i64 |