Verba/Rapida

Experiments #112

The `(thread T*)&w` pointer pun in mlx-serve's K staging replaced by an `as_type` unpack: on the M3 (macOS...

done

What was tested

The `(thread T*)&w` pointer pun in mlx-serve's K staging replaced by an `as_type` unpack: on the M3 (macOS 14.4) it crashes Metal's backend compiler and forces the fused hd-256 kernel off (`MLX_SERVE_FUSED_256=0`); the bisect on the laptop (`tools/local_chat/metal14/bisect-m3-2026-10-31.txt`) builds with `k_astype` alone; a precompiled metallib crashes the same backend, so no route around it; bit-identical by construction

Model and setup

the M3

Expected gain

the fused prefill kernel back on the M3 (first-token time, inferred)

Where the idea came from

metal14 bisect

Outcome

done 2026-10-31: identical, level on the M4 (paired +0.47%), kernel loads on the M3 (+1.5% prefill); M3 build 2026-10-31-r112-m14-v1

Lesson

fixing the pointer pun brings the fused prefill kernel back on macOS 14 at no cost on the M4, but on the M3 it buys only about 1.5% of prefill (0.2 s per 8k first ), so the M3's first-token time is not in this kernel; the next M3 prefill gain has to come from elsewhere (rows 109 to 111).

Adopted

no (correctness fix for the M3 build; level on the M4).

Want to see what these experiments produced? Lesto, the Gemma 4 inference engine for Apple silicon Macs, is on lestoengine.com

Made by Federico Andrioli, @fedeandri on X A research lab's own measurements, generated from its files. Data built