code wiki / _hdl_build / nx_lockstep_exceed_gate.nx
nx_lockstep_exceed_gate.nx
buildroot/runtime/_hdl_build/nx_lockstep_exceed_gate.nx
about
nx_lockstep_exceed_gate.nx -- the FIRST measured EXCEEDS for the engine census (P2 lockstep). Honest
head-to-head vs a real incumbent baseline = NAIVE FULL-STATE-SYNC netcode (send the whole world every
tick). Measured axes:
BANDWIDTH: lockstep sends only INPUTS (1 i64/tick) -> bytes = nticks*8, INDEPENDENT of world size;
state-sync sends the full state (2*K i64/tick) -> bytes = nticks*2*K*8, GROWS with K.
DETERMINISM: lockstep is bit-reproducible (reuse nx_lockstep: two runs, same inputs -> same checksum).
EXCEEDS iff lockstep_bytes < statesync_bytes AND the advantage GROWS with world size AND determinism
holds. NEG-CONTROL: the degenerate nticks=0 case (both 0 bytes) must NOT score EXCEEDS (-> PARITY).
This is a fair, MEASURED, no-self-grade exceed on a DEFINED axis -- not a blanket claim. license_tier: ORIGINAL expect_exit: 0
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_lockstep.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
| 13 | const RX_BELOW: i64 = 0 |
| 14 | const RX_PARITY: i64 = 1 |
| 15 | const RX_EXCEEDS: i64 = 2 |
functions
| 17 | func xw(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 xn(v: i64) -> i64 { let bb: *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{bb[i]=t[k-1-i];i=i+1} sys_write(1,bb,k); return 0 } |
| 20 | func ls_bytes(nticks: i64) -> i64 { return nticks * 8 } // inputs only (8 bytes/input) called by 1: main |
| 21 | func ss_bytes(k: i64, nticks: i64) -> i64 { return nticks * (2 * k) * 8 } // full world state each tick called by 1: main |
| 24 | func bw_verdict(ls: i64, ss: i64) -> i64 called by 1: main |
| 30 | func main() -> i64 |