TECHNOLOGY

M1 AMX prefill: packing gains, precision and a longer-input reversal

In this article
THE QUICK TAKE

The 128-token FP32 integration improved prefill, but longer inputs reversed the gain and the tested path does not cover arbitrary quantized models.

The gain comes above the inner loop

The June 24, 2026 paper Above the Inner Loop investigates direct programming of Apple’s M1 AMX matrix coprocessor for LLM prefill. Its central finding is not a new universally faster multiply instruction sequence. The author attributes useful gains to distributing fine-grained panels across the chip’s matrix resources and packing constant model weights before repeated execution.

AMX here is the Apple mechanism investigated through reverse-engineered instruction descriptions. It is not Intel AMX, the Apple GPU or the Neural Engine. The experiment also does not establish the same scheduling behavior on later Apple chips with a different matrix architecture.

Packing changes what is paid per call

A stateless matrix-multiply interface can repeatedly prepare the same constant weight. The proposed path instead retains a packed form for reuse. That is a legitimate deployment optimization, but the packing work and extra representation have not ceased to exist: they move outside the repeated timed region.

Fine column panels expose enough independent work to use the M1’s resources more effectively than the tested coarser arrangement. The paper supports that explanation with per-core activity probes rather than a public AMX utilization counter. Such probes provide indirect evidence tied to this processor’s organization, not a generally available hardware metric for all Macs.

Baseline precision matters

Across twelve prefill matrix shapes at sequence length 128, the author reports geometric-mean speedups of about 2.0× over cblas_sgemm, 1.58× over BNNSMatMul and 1.17× over BNNS Graph. These are different baselines and should not collapse into one claim about Accelerate.

The proposed outputs are reported bit-identical to the chosen Accelerate reference. BNNS Graph matches that reference at only three tested square shapes; the paper observes different results at the rectangular shapes and attributes them to reduced precision. Restricting the comparison to those bit-matching shapes gives a smaller 1.09× margin. A buffer stored as FP32 therefore does not alone establish identical internal arithmetic or an equivalent precision trade-off.

A full-forward result has a narrow workload

The llama.cpp integration uses TinyLlama-1.1B FP32 weights, four threads and 128-token prefill. Its reported steady-state full-forward rate rises from 291 to 420 tokens/s, or 1.44×, with matching output. This is separate from the standalone sequence of matrix multiplies, which omits attention and other forward-pass work.

The first iteration is excluded because it includes weight packing and thread-pool startup. More importantly, the advantage narrows to 1.10× at 256 tokens and reverses to 0.82× at 512. Activation-transpose costs and the reference’s scaling change the result. The substituted FP32 matrix path does not target llama.cpp’s fused dequantization kernels, so this is not a demonstrated acceleration for an arbitrary quantized GGUF.

Keep the artifact and method together

The author’s repository contains the direct-AMX investigation alongside a separate ONNX inference engine. Its broader engine benchmarks are not independent reproductions of the paper’s kernel results. The paper measures one M1 unit under specified macOS and compiler versions and uses repeated isolated invocations; device-to-device thermal variation remains outside that evidence.

The CPU thread guide explains why prefill and decoding need separate controls, while the llama-bench guide distinguishes phase measurements from a serving request. This study adds a useful, shape-resolved optimization result with a documented reversal. Its lesson is to account for packing, arithmetic precision and integration overhead before treating a fast kernel as a generally faster local model.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles