An object that contains a compiled compute pipeline.


protocol MTLComputePipelineState


A MTLComputePipelineState object is a lightweight object used to refer to a compiled compute program. A MTLComputePipelineState object is fully thread-safe and can be used by many MTLComputeCommandEncoder objects at once.

Creating compute pipeline state objects can be expensive, so you usually create these pipeline objects when your app is initialized and reuse them throughout its lifetime. You do not use standard allocation and initialization techniques to create a MTLComputePipelineState object. Instead, you create these objects by calling methods on a MTLDevice object. For a list of creation methods, see Creating a Compute Pipeline.


Querying Threadgroup Attributes

var maxTotalThreadsPerThreadgroup: Int

The maximum number of threads in a threadgroup that can be dispatched using the pipeline.


var threadExecutionWidth: Int

The number of threads that are executed simultaneously by the GPU.


var staticThreadgroupMemoryLength: Int

The length, in bytes, of threadgroup memory that is statically allocated.


Identifying Properties

var device: MTLDevice

The Metal device from which the pipeline state was created.


var label: String?

A string that identifies the compute pipeline state object.


Querying Imageblock Length

func imageblockMemoryLength(forDimensions: MTLSize) -> Int

Returns the imageblock memory length, in bytes, for the given imageblock dimensions.


Querying Indirect Command Buffer Support


Inherits From

See Also

Parallel Computation

Processing a Texture in a Compute Function

Perform data-parallel computations on texture data.

Creating 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.

class MTLComputePipelineDescriptor

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

protocol MTLComputeCommandEncoder

An object used to encode commands in a compute pass.