nx_pool_stale_gate.nx
buildroot/runtime/nx_pool_stale_gate.nx
about
nx_pool_stale_gate.nx -- STRESS REPRODUCER for the 2026-07-15 run-to-run greedy divergence (proven by
exact-repeat 1.5B ruler runs: identical binary+args+weights, different outputs at near-tie forks; 0.5B
byte-stable). Hypothesis class: a pooled op's nx_pool_wait(done0+bands) occasionally returns with a band
UNFINISHED (early wake / counter anomaly / ctx hijack) -> the next stage reads a stale band -> perturbed
logits flip ties. This gate hammers the EXACT usage idiom of nx_nofloat_llm's pooled kernels (delta-wait +
shared ctx arena + shared activation scratch, band-parallel disjoint writes) at high op counts and CHECKS
three invariants after EVERY wait:
I1 STAMP every band wrote its per-op serial stamp (no missing/unfinished band)
I2 VALUE every band's dst equals the exact expected sum of THIS op's activations (no stale-input read,
no hijacked-ctx compute)
I3 COUNTER tasks_completed advanced by exactly +bands across the wait (no over/under-count)
Any violation prints op#, band, got/want and the gate goes RED = reproducer captured. A clean 200k-op run
is evidence the race is NOT in this idiom (pool+chan+wait) and the hunt moves up/down a layer.
T1: 200k ops x n_workers bands, zero violations
T2 NEG-CONTROL: sabotage mode (one band deliberately not submitted, wait shortened) MUST be caught by I1
Return from main (pool reap). No hw writes (Rule 26). expect_exit: 0 license_tier: ORIGINAL
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_thread_pool.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
| 20 | const PSG_N: i64 = 4096 // activation length per op |
| 21 | const PSG_OPS: i64 = 200000 // ops (~70 tokens' worth of 1.5B submit volume) |
functions
| 28 | func psg_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 29 | func psg_n(v: i64) -> i64 |
| 45 | func _psg_task(ctx_i: i64) -> i64 |
| 60 | func main() -> i64 |