Esperimenti #114
Persistent megakernel feasibility, synthetic Metal benchmark before any engine change...
done
Il testo degli esperimenti resta in inglese, come l'ha scritto il laboratorio.
Cosa è stato provato
Persistent megakernel feasibility, synthetic Metal benchmark before any engine change (`2026-10-31-mac-engine-audit/megakernel-114.md`): grid-barrier cost on device atomics at 20 to 80 threadgroups and a bounded-spin hang check; 150 dependent uint4 reads at the step's real sizes as separate dispatches, one persistent kernel with grid barriers, and the same with next-read weights staged before each barrier; plus a seam norm recomputed per threadgroup. Build option (a), a per-layer persistent kernel with bit-exact replayed bodies, only if a barrier costs at most 1.5 us and staging saves at least 0.8 ms per 30-layer chain
Modello e configurazione
the best
Guadagno atteso
+4 to +15% The writing phase: the model produces the reply one token at a time. Approfondisci if built (inferred: 0.5 to 1.5 ms of 11.57 at 8k); the benchmark itself is a diagnostic
Da dove viene l'idea
rows 82, 83s, 94, 101s, 105
Esito
done 2026-10-31 (`kb114/`): barrier 0.55 us (Metal 3.1) / 0.74 (3.2), staged chain saves 0.71 / 0.78 ms per 30 layers, verdict SEAM-ONLY (option (c) seam prologue only); Metal 3.1 needs atomic stores for cross-threadgroup data (README § Diagnostic, row 114)
Lezione
on the M4 a device-atomic grid barrier is cheap (0.55 us at Metal 3.1), and a persistent kernel with staged next-level loads takes a weight chain to 95% of peak bandwidth (0.71 to 0.78 ms per 30 layers over separate dispatches), just under the build bar. Data crossing the barrier must be written with atomic stores at Metal 3.1, or fenced at 3.2: a plain store before `threadgroup_barrier(mem_device)` is not published to other threadgroups about half the time.
Adottato
no (diagnostic; SEAM-ONLY verdict).