Experiments #103t
Why the GELU-table prefetch of MoE down rows costs 0.4 ms per step in the engine and nothing in the...
done
What was tested
Why the GELU-table prefetch of Mixture of experts: a model made of many specialist sub-networks where only a few run per token. Read more down rows costs 0.4 ms per step in the engine and nothing in the harness: a Metal System Trace of the table kernel in the engine, and a harness variant that maps the expert banks from the safetensors as the engine does
Model and setup
the best
Expected gain
explains a 3.5% harness-to-engine gap (diagnostic)
Where the idea came from
row 103
Outcome
done 2026-10-31: MLX's 50 MB command-buffer billing; the harness bound the whole bank; raising MLX_MAX_MB_PER_BUFFER gave r102 about +5% at 1k (row 105)
Lesson
MLX commits a command buffer whenever the bytes first bound in it pass 50 MB on the M4 Pro, so a kernel that binds a large array moves the commits: a harness must bind exactly the engine's views, and the commit limit itself is a lever on the best (about +5% at 1k in one screen).