Skip to main content
← Lab

neonswiglu

confirmedC++ · NEON / Apple M4 ProSystems, numerics & scientific librariesJuly 9, 2026

the question

How much does hand-vectorizing SwiGLU on NEON beat scalar libm?

what came out

3.5-4.4x, because the scalar sigmoid needs a non-inlinable expf call per element that blocks vectorization; replacing it with an inlined vector exp poly (~5e-8 accuracy) unblocks it. The gate-multiply fusion barely helps (compute-bound, not memory-bound). asm-confirmed.

method & receipts

  • Result: confirmed
  • Pre-registered: the prediction was written down and committed before the run.
  • Reproducible: one script re-runs the whole thing from scratch.
  • Adversarial self-review: my own skeptic's pass over each claim, kept in the repo.
  • Machine-readable claims: every reported number, in a checkable file.
  • Tested: a correctness/benchmark suite ships alongside the code.

→ read the code and re-run it

github.com/v-code01/neonswiglu