nx_f32_ffn_path_gate.nx
buildroot/runtime/nx_f32_ffn_path_gate.nx
about
nx_f32_ffn_path_gate.nx -- ISOLATED, host-noise-immune proof that the
F32 packed range-dot cached path beats the scalar threaded matmul_t
at the real FFN decode shape (m=1, k=896, n=4864 = Qwen W_gate).
Both paths run in the SAME loaded conditions, so the RATIO holds even
when the host is noisy (the trap that contaminated the full-forward
profiler). Warms the cache first so the timed cached calls are pure
SIMD dots (the fill is one-time, amortized across all tokens in the
real forward).
Exact-int regime (dense small-int f32) so bit-exact compare across the
two different accumulation orders (scalar sequential vs 8-wide) is
legitimate.
Checks:
1 cached (range-dot) result == scalar matmul_t, bit-exact
2 cached path >= floor x faster than scalar over N reps (both timed
threaded; ratio printed)
lineage_id: f32_ffn_path_gate_v1
dependencies 4 imports · 0 importers
imports: nx_f32_lazy_weight.nxnx_f32_matmul_t.nxnx_f32_cvt.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
| 27 | const FK: i64 = 896 // hidden |
| 28 | const FN: i64 = 4864 // ffn (W_gate n) |
| 29 | const FREPS: i64 = 200 |
| 30 | const FFLOOR_X100: i64 = 150 |
functions
| 32 | func fg_lcg(s: i64) -> i64 called by 1: fg_fill |
| 38 | func fg_fill(p: *i64, count: i64, seed: i64, half: i64) -> i64 |
| 48 | func fg_same(a: *i64, b: *i64, count: i64) -> i64 called by 1: main |
| 53 | func fg_poison(p: *i64, count: i64) -> i64 called by 1: main |
| 58 | func fg_nl() -> i64 { fmt_puts("\n" as *u8); return 0 } |
| 60 | func main() -> i64 |