Skip to main content
← Lab

neonswiglu

confirmedC++ · NEON / Apple M4Systems & data structuresJuly 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, independently verified.

method & receipts

→ read the code and re-run it

github.com/v-code01/neonswiglu