nx_conv2d_mt_gate.nx
buildroot/runtime/nx_conv2d_mt_gate.nx
about
nx_conv2d_mt_gate.nx -- adversarial gate for the multi-threaded
conv2d forward (nx_conv2d_forward_mt / nx_conv2d_forward_pool)
against the serial oracle nx_conv2d_forward.
The MT path is an INDEPENDENT implementation of the same math
(organ policy: the serial path was left untouched), so full-buffer
bit-exact comparison here is a real two-implementation oracle, not
a self-comparison.
Checks (10):
1 serial oracle runs OK on the small shape
2..6 MT bit-exact vs serial for nworkers in {1, 2, 3, 0=auto,
1000=clamped-past-row-count}; output poisoned before each
run so unwritten rows cannot pass
7 no-bias variant bit-exact (nworkers=3)
8..9 caller-owned pool reused across two calls (second call has
different input contents) -- proves the completed-counter
DELTA wait, both bit-exact
10 speedup on a big shape (1x64x128x128, C_out=64), auto
workers: bit-exact AND wall-time speedup >= floor
Small shape uses prime-ish dims (H=17, W=13, C_out=5) so any
stride or band-boundary bug lands off-pattern and fails the
compare.
genealogy_id: substrate_conv2d_v1_direct + nx_conv_speedup_banding
lineage_id: conv2d_mt_gate_v1
dependencies 2 imports · 0 importers
imports: nx_conv2d.nxnx_fmt.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
| 33 | const GT_N: i64 = 2 |
| 34 | const GT_CIN: i64 = 3 |
| 35 | const GT_COUT: i64 = 5 |
| 36 | const GT_H: i64 = 17 |
| 37 | const GT_W: i64 = 13 |
| 40 | const GB_CIN: i64 = 64 |
| 41 | const GB_COUT: i64 = 64 |
| 42 | const GB_H: i64 = 128 |
| 43 | const GB_W: i64 = 128 |
| 50 | const GATE_SPEEDUP_FLOOR_X100: i64 = 200 |
functions
| 52 | func g_lcg(s: i64) -> i64 |
| 60 | func g_fill(p: *i64, count: i64, seed: i64) -> i64 |
| 72 | func g_fill_small(p: *i64, count: i64, seed: i64) -> i64 |
| 85 | func g_poison(p: *i64, count: i64) -> i64 called by 1: main |
| 95 | func g_same(a: *i64, b: *i64, count: i64) -> i64 called by 1: main |
| 104 | func g_t4(d0: i64, d1: i64, d2: i64, d3: i64, err: *nx_int) -> *NxTensor |
| 110 | func g_nl() -> i64 |
| 115 | func main() -> i64 |