---
title: "Apple Metal: graphics and compute API for iOS, macOS and Apple Silicon"
description: "Apple Metal as a low-overhead graphics and compute API: WWDC 2014 announcement (iOS 8), Metal 2 (2017), Metal 3 (WWDC 2022, macOS Ventura). Metal Shading Language, Metal Performance Shaders (MPS), MPSGraph, Core ML on GPU, Apple Silicon unified memory."
url: "https://www.noze.it/en/insights/apple-metal-api/"
lang: "en"
alternate: "https://www.noze.it/insights/apple-metal-api/"
published: "2022-06-06"
author: "noze S.r.l."
keywords: "R&D, AI, Hardware, Apple, Metal, MSL, MPS, MPSGraph, Core ML, Apple Silicon, GPU, macOS, iOS"
---

# Apple Metal: graphics and compute API for iOS, macOS and Apple Silicon

Apple Metal as a low-overhead graphics and compute API: WWDC 2014 announcement (iOS 8), Metal 2 (2017), Metal 3 (WWDC 2022, macOS Ventura). Metal Shading Language, Metal Performance Shaders (MPS), MPSGraph, Core ML on GPU, Apple Silicon unified memory.

6 June 2022

## Context: why Metal

Until 2014, Apple platforms used **OpenGL/OpenGL ES** for rendering and **OpenCL** for GPU compute — APIs conceived in the 1990s, with high-overhead driver models, implicit state management and serial submission paths. On contemporary mobile GPUs, the CPU cost of each _draw call_ was significant relative to available resources.

Apple announced **Metal** at **WWDC 2014** (**2 June 2014**) as a low-overhead graphics API for **iOS 8** on **A7/A8** devices. The stated technical goals: cut CPU submission cost, make state and resource management explicit, and move closer to the models later published as Vulkan and Direct3D 12 (2015–2016).

## Metal architecture

Metal exposes a programming model built around explicit objects:

- **MTLDevice** — the GPU
- **MTLCommandQueue / MTLCommandBuffer** — command queue and batch
- **MTLRenderCommandEncoder / MTLComputeCommandEncoder / MTLBlitCommandEncoder** — encoders for the three workload types
- **MTLRenderPipelineState / MTLComputePipelineState** — pre-compiled, immutable pipelines
- **MTLBuffer / MTLTexture / MTLHeap** — resources with explicit _storage modes_ (shared, managed, private, memoryless)

Submission is explicit: the app builds command buffers, commits them to the queue and manages synchronisation via _fences_, _events_ and _shared events_. No driver guessing at state.

## Metal Shading Language (MSL)

**MSL** is the shader language, derived from **C++14** with GPU extensions. It is the single language for vertex, fragment, _tile_, _compute_ and _mesh_ shaders (introduced in Metal 3). The compiler is the **Metal Compiler** (`metal`), based on LLVM, which emits **AIR** (Apple Intermediate Representation) intermediate binaries packed into **metallib**. At runtime, the driver produces machine code for the target GPU.

```
kernel void saxpy(
    device const float* x [[buffer(0)]],
    device float*       y [[buffer(1)]],
    constant float&     a [[buffer(2)]],
    uint                i [[thread_position_in_grid]])
{
    y[i] = a * x[i] + y[i];
}
```

## Metal 2 (2017) and Metal 3 (2022)

- **Metal 2** — WWDC 2017 (macOS High Sierra, iOS 11). Adds _Argument Buffers_ (binding large resource sets in a single buffer), _Raster Order Groups_, external GPU (eGPU) support and integration with the **Metal Performance Shaders** framework.
- **Metal 3** — WWDC **6 June 2022** (macOS Ventura, iOS 16). Introduces **MetalFX Upscaling** (_spatial_ and _temporal_, analogue to DLSS/FSR), **mesh shaders**, _Fast Resource Loading_ (asynchronous loading directly from the filesystem into textures), _Offline Shader Compilation_ to cut first-use stutter.

## Metal Performance Shaders and MPSGraph

**Metal Performance Shaders (MPS)** is a framework of compute kernels tuned for each Apple GPU family: convolutions, matrices, FFT, image filters, neural networks. On top of it, **MPSGraph** is a graph-based compute API aimed at machine learning — a high-level equivalent of XLA or of cuDNN + TensorRT.

Apple’s ML stack sits on MPS/MPSGraph:

- **Core ML** uses MPS as the GPU execution backend
- **PyTorch** has exposed the `mps` device since 2022 (Apple + Meta collaboration), mapping operations onto MPSGraph
- **TensorFlow** runs via the **tensorflow-metal** backend on MPS
- **JAX** on Apple Silicon via IREE/MPS (experimental)

## Compute and ML on Apple Silicon

With the move to **Apple Silicon** (M1 in November 2020), memory is **unified**: CPU, GPU and Neural Engine share the same DRAM pool without explicit copies. In Metal, resources with `shared` storage mode reside in unified memory; `private` enables internal-VRAM copies. The dedicated **Neural Engine** (separate NPU) drives a split in ML workloads: generic kernels on the GPU via MPS, supported kernels on the Neural Engine via Core ML.

## Comparison with Vulkan and Direct3D 12

Metal shares with **Vulkan** and **Direct3D 12** the _low-overhead_ and _explicit state_ philosophy. Practical differences:

- Metal is **platform-locked** (Apple only). Vulkan is cross-vendor on Linux, Android, Windows; D3D12 is Windows/Xbox.
- MSL is closer to standard C++ than **HLSL** and **GLSL/SPIR-V** — though SPIR-V is an interchangeable binary IR.
- Metal synchronisation is generally considered more ergonomic than Vulkan’s (more driver-hidden from the developer).

Projects such as **MoltenVK** (KhronosGroup) and **DXVK** / **D3DMetal** translate Vulkan and D3D12 to Metal in userspace, enabling Windows/Linux games on macOS.

## The noze context

noze evaluates Apple Silicon as a local inference platform for mid-sized models and as a development environment: unified memory makes M1 Max/Ultra workstations suitable for prototyping ML pipelines without a discrete GPU. For healthcare production workloads, however, the reference stack remains CUDA/NVIDIA: Apple offers no server-class hardware, porting custom CUDA kernels to Metal requires rewriting, and no Apple GPUs exist in data-centre configurations with InfiniBand or NVLink-equivalent fabrics.

Update — 2024

The Apple Silicon family continues with **M2** (June 2022), **M3** (October 2023) and **M4** (2024), in Pro/Max/Ultra variants. For reduced-precision LLMs (INT4/INT8, GGUF), **llama.cpp** gains a Metal backend from 2023: on M2/M3 Max with 64-128 GB of unified memory, local inference of 30-70B quantised models becomes practical — a relevant use case for AI labs and workstations without a discrete GPU. Also emerging is **MLX** (Apple, 2023), a native array/ML framework on Metal designed for training and inference on Apple Silicon.

---

_References: Metal announced at WWDC on 2 June 2014 (iOS 8). Metal 2 announced at WWDC on 5 June 2017 (macOS High Sierra, iOS 11). Metal 3 announced at WWDC on 6 June 2022 (macOS Ventura, iOS 16). Apple M1 announced 10 November 2020. PyTorch `mps` backend since PyTorch 1.12 (June 2022). Sources: Apple Developer Documentation (Metal, Metal Shading Language, Metal Performance Shaders), WWDC keynotes._
