Esperimenti #112
The `(thread T*)&w` pointer pun in mlx-serve's K staging replaced by an `as_type` unpack: on the M3 (macOS...
done
Il testo degli esperimenti resta in inglese, come l'ha scritto il laboratorio.
Cosa è stato provato
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 Prefill: the model reading the whole prompt before it can write the first token. Approfondisci 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
Modello e configurazione
the M3 One concrete set of serving settings tested as an experiment.
Guadagno atteso
the fused prefill kernel back on the M3 (first-token time, inferred)
Da dove viene l'idea
metal14 bisect
Esito
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
Lezione
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 The unit of text a model reads and writes: roughly a short word or a piece of a longer one.), 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).
Adottato
no (correctness fix for the M3 build; level on the M4).