Protocol

MTLComputePipelineState

An object that contains a compiled compute pipeline.

Declaration

protocol MTLComputePipelineState

Overview

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.

Topics

Querying Threadgroup Attributes

var maxTotalThreadsPerThreadgroup: Int

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

Required.

var threadExecutionWidth: Int

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

Required.

var staticThreadgroupMemoryLength: Int

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

Required.

Identifying Properties

var device: MTLDevice

The Metal device from which the pipeline state was created.

Required.

var label: String?

A string that identifies the compute pipeline state object.

Required.

Querying Imageblock Length

func imageblockMemoryLength(forDimensions: MTLSize) -> Int

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

Required.

Querying Indirect Command Buffer Support

Relationships

Inherits From

See Also

Parallel Computation

Hello Compute

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

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.