Framework

Metal Performance Shaders

Optimize graphics and compute performance with kernels that are fine-tuned for the unique characteristics of each Metal GPU family.

Overview

The Metal Performance Shaders framework contains a collection of highly optimized compute and graphics shaders that are designed to integrate easily and efficiently into your Metal app. These data-parallel primitives are specially tuned to take advantage of the unique hardware characteristics of each GPU family to ensure optimal performance.

Apps adopting the Metal Performance Shaders framework achieve great performance without needing to create and maintain hand-written shaders for each GPU family. Metal Performance Shaders can be used along with your app’s existing Metal resources (such as the MTLCommandBuffer, MTLTexture, and MTLBuffer objects) and shaders.

The Metal Performance Shaders framework supports the following functionality:

  • Apply high-performance filters to, and extract statistical and histogram data from images.

  • Implement and run neural networks for machine learning training and inference.

  • Solve systems of equations, factorize matrices and multiply matrices and vectors.

  • Accelerate ray tracing with high-performance ray-geometry intersection testing.

Topics

Device Support

func MPSSupportsMTLDevice(MTLDevice?) -> Bool

Determines whether the Metal Performance Shaders framework supports a Metal device.

Image Filters

Image Filters

Apply high-performance filters to, and extract statistical and histogram data from images.

Neural Networks

Implement and run deep learning using previously obtained training data.

class MPSImage

A texture that may have more than four channels for use in convolutional neural networks.

class MPSTemporaryImage

A texture for use in convolutional neural networks that stores transient data to be used and discarded promptly.

Objects that Simplify the Creation of Neural Networks

Simplify the creation of neural networks using networks of filter, image, and state nodes.

Convolutional Neural Network Kernels

Build neural networks with layers.

Recurrent Neural Networks

Create recurrent neural networks.

Matrices and Vectors

Matrices and Vectors

Solve systems of equations, factorize matrices and multiply matrices and vectors.

Ray Tracing

Metal for Accelerating Ray Tracing

Use the Metal Performance Shaders ray intersector to perform ray-traced rendering.

class MPSRayIntersector

A kernel that performs intersection tests between rays and geometry.

class MPSAccelerationStructureGroup

A group of acceleration structures.

class MPSInstanceAccelerationStructure

An acceleration structure built over instances of other acceleration structures.

class MPSTriangleAccelerationStructure

An acceleration structure built over triangles.

class MPSAccelerationStructure

The base class for data structures that are built over geometry and used to accelerate ray tracing.

Kernel Base Classes

class MPSKernel

A standard interface for Metal Performance Shaders kernels.

Keyed Archivers

class NSKeyedArchiver

A coder that stores an object's data to an archive referenced by keys.

class MPSKeyedUnarchiver

A keyed archiver that supports Metal Performance Shaders kernel decoding.

protocol MPSDeviceProvider

An interface that enables the setting of a Metal device for unarchived objects.

See Also