metalworking
GitHub (opens in a new tab)
/glossary/machine/neural-accelerators

Neural Accelerators

The M5 generation adds a dedicated matrix unit to every GPU core: the neural accelerators (NAX in MLX's source), reached through Metal 4 tensor ops rather than simdgroup_matrix.

CUDA equivalent: the Tensor Core, finally for real. Earlier pages tell the pre-M5 story on purpose: simdgroup_matrix executes on the regular FP32 pipes, and the reverse-engineered Rigel (opens in a new tab) work confirmed no dedicated matrix datapath as late as M4. On M5 that changed. Apple's own numbers for MLX on M5: 3.3-4.1× time-to-first-token and 1.19-1.27× decode over M4 across six models at a 4,096-token prompt (opens in a new tab), with the prefill gain landing exactly where a matrix unit should land (compute-bound territory; decode stays bandwidth-bound, so it moves with the memory spec instead).

What a CUDA person should map over, and what not to:

  • Fragment shape moves from 8×8 to 16×16. MLX's NAX steel is built on a 16×16 fragment held across the 32 threads:
struct BaseNAXFrag {
  STEEL_CONST short kFragRows = 16;
  STEEL_CONST short kFragCols = 16;

  STEEL_CONST short kElemsPerFrag = (kFragRows * kFragCols) / 32;

Source: MLX steel/gemm/nax.h:27-31 (opens in a new tab), which includes <MetalPerformancePrimitives/MetalPerformancePrimitives.h> at the top of the file: the new hardware arrives through a library, not new intrinsics.

  • The formats are block-scaled floats. The mxfp4/nvfp4/mxfp8 quantization modes arrived with this unit and have NAX kernels, though the pinned ones dequantize to 16-bit before loading tiles; the fp8-is-emulated caveat is an M4-era fact. From macOS 27 a quantized MTLTensor can carry its E8M0 scales as a second plane and TensorOps dequantize on the way in (WWDC26 330 (opens in a new tab)), so that 16-bit step may be a stopgap.
  • It is not programmed like a tensor core. No mma.sync descent: you describe a matmul with a descriptor and cooperative tensors, and the compiler and hardware pick the datapath. The Metal 4 tensor-ops page covers the model; the NAX GEMM case study reads real code.

Ecosystem status: MLX ships a parallel steel fork for it (gemm/nax.h, attn/nax.h, quantized_nax, fp_quantized_nax); llama.cpp has a tensor-API matmul path; and the tuning is young. Recent MLX work is disproportionately NAX-shaped (qmv batch limits raised for M5-class GPUs, NVFP4 QMV optimization, per-expert tile picks in gather_qmm_rhs_nax), which shows how quickly this path is still changing. simdgroup_matrix remains the portable primitive and the one most shipped kernels still use; this page is why the glossary keeps teaching both.