An object used to customize how a new compute pipeline state object is compiled.


class MTLComputePipelineDescriptor : NSObject


To create a MTLComputePipelineState object, you create a pipeline descriptor, configure its properties, and pass it to one of the creation methods on a MTLDevice object. See Creating a Compute Pipeline.

Use standard allocation and initialization techniques to create a MTLComputePipelineDescriptor object and configure its properties. The most important property to set is the computeFunction property, which specifies which Metal function to call.


Specifying the Compute Function and Associated Data

var computeFunction: MTLFunction?

The compute function to be compiled into the pipeline state object.

var threadGroupSizeIsMultipleOfThreadExecutionWidth: Bool

A Boolean that indicates whether the threadgroup size must always be a multiple of the thread execution width.

var maxTotalThreadsPerThreadgroup: Int

The maximum number of threads allowed for a threadgroup dispatched to the compute function.

var stageInputDescriptor: MTLStageInputOutputDescriptor?

The organization of input and output data for the compute function.

var buffers: MTLPipelineBufferDescriptorArray

The buffer mutability options for a compute pipeline's kernel function.

class MTLPipelineBufferDescriptor

An object that contains the mutability options for buffers used in a render or compute pass.

Identifying Properties

var label: String?

A string that identifies this object.

Resetting the Compute Pipeline State

func reset()

Resets all compute pipeline descriptor properties to their default values.


Inherits From

See Also

Parallel Computation

Hello Compute

Demonstrates how to perform data-parallel computations using the GPU.

About Threads and Threadgroups

Learn how Metal organizes compute-processing workloads.

Calculating Threadgroup and Grid Sizes

Calculate the optimum sizes for threadgroups and grids when dispatching compute-processing workloads.

protocol MTLComputePipelineState

An object that contains a compiled compute pipeline.

protocol MTLComputeCommandEncoder

An object used to encode commands in a compute pass.