<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLComputePipelineState",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLComputePipelineState"
  },
  "title" : "MTLComputePipelineState"
}
-->

# MTLComputePipelineState

An interface that represents a GPU pipeline configuration for running kernels in a compute pass.

```
protocol MTLComputePipelineState : MTLAllocation, Sendable
```

## Overview

The [`MTLComputePipelineState`](/documentation/Metal/MTLComputePipelineState) protocol is an interface that represents a specific configuration for the GPU pipeline for a compute pass. Use a pipeline state to configure a compute pass by calling the [`setComputePipelineState(_:)`](/documentation/Metal/MTLComputeCommandEncoder/setComputePipelineState(_:)) method of an [`MTLComputeCommandEncoder`](/documentation/Metal/MTLComputeCommandEncoder) instance.

To create a pipeline state, call the appropriate [`MTLDevice`](/documentation/Metal/MTLDevice) method (see [Pipeline state creation](/documentation/Metal/pipeline-state-creation)). You typically make pipeline states at a noncritical time, like when your app first launches. This is because graphics drivers may need time to evaluate and build each pipeline state. However, you can quickly use and reuse each pipeline state throughout your app’s lifetime.

## Topics

### Identifying a pipeline state

[`var device: any MTLDevice`](/documentation/Metal/MTLComputePipelineState/device)

The device instance that created the pipeline state.

[`var gpuResourceID: MTLResourceID`](/documentation/Metal/MTLComputePipelineState/gpuResourceID)

An unique identifier that represents the pipeline state, which you can add to an argument buffer.

[`var label: String?`](/documentation/Metal/MTLComputePipelineState/label)

A string that helps you identify the compute pipeline state during debugging.

### Checking threadgroup attributes

[`var maxTotalThreadsPerThreadgroup: Int`](/documentation/Metal/MTLComputePipelineState/maxTotalThreadsPerThreadgroup)

The maximum number of threads in a threadgroup that you can dispatch to the pipeline.

[`var threadExecutionWidth: Int`](/documentation/Metal/MTLComputePipelineState/threadExecutionWidth)

The number of threads that the GPU executes simultaneously.

[`var staticThreadgroupMemoryLength: Int`](/documentation/Metal/MTLComputePipelineState/staticThreadgroupMemoryLength)

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

### Checking imageblock attributes

[`func imageblockMemoryLength(forDimensions: MTLSize) -> Int`](/documentation/Metal/MTLComputePipelineState/imageblockMemoryLength(forDimensions:))

Returns the length of reserved memory for an imageblock of a given size.

### Checking indirect command buffer support

[`var supportIndirectCommandBuffers: Bool`](/documentation/Metal/MTLComputePipelineState/supportIndirectCommandBuffers)

A Boolean value that indicates whether the compute pipeline supports indirect command buffers.

### Checking shader validation

[`var shaderValidation: MTLShaderValidation`](/documentation/Metal/MTLComputePipelineState/shaderValidation)

The current state of shader validation for the pipeline.

### Creating function handles

[`func functionHandle(function: any MTLFunction) -> (any MTLFunctionHandle)?`](/documentation/Metal/MTLComputePipelineState/functionHandle(function:)-7d523)

Creates a function handle for a visible function.

### Adding visible functions

[`func makeComputePipelineStateWithAdditionalBinaryFunctions(functions: [any MTLFunction]) throws -> any MTLComputePipelineState`](/documentation/Metal/MTLComputePipelineState/makeComputePipelineStateWithAdditionalBinaryFunctions(functions:))

Creates a new pipeline state object with additional callable functions.

### Creating function tables

[`func makeVisibleFunctionTable(descriptor: MTLVisibleFunctionTableDescriptor) -> (any MTLVisibleFunctionTable)?`](/documentation/Metal/MTLComputePipelineState/makeVisibleFunctionTable(descriptor:))

Creates a new visible function table.

[`func makeIntersectionFunctionTable(descriptor: MTLIntersectionFunctionTableDescriptor) -> (any MTLIntersectionFunctionTable)?`](/documentation/Metal/MTLComputePipelineState/makeIntersectionFunctionTable(descriptor:))

Creates a new intersection function table.

### Instance Properties

[`var forwardProgressUsage: MTLForwardProgressUsage`](/documentation/Metal/MTLComputePipelineState/forwardProgressUsage)

[`var reflection: MTLComputePipelineReflection?`](/documentation/Metal/MTLComputePipelineState/reflection)

The compute pipeline’s reflection information, if available.

[`var requiredThreadsPerThreadgroup: MTLSize`](/documentation/Metal/MTLComputePipelineState/requiredThreadsPerThreadgroup)

### Instance Methods

[`func functionHandle(function: any MTL4BinaryFunction) -> (any MTLFunctionHandle)?`](/documentation/Metal/MTLComputePipelineState/functionHandle(function:)-8spaa)

Gets the function handle for a function this pipeline links at the binary level.

[`func functionHandle(withName: String) -> (any MTLFunctionHandle)?`](/documentation/Metal/MTLComputePipelineState/functionHandle(withName:))

Gets the function handle for a function this pipeline links at the Metal IR level by name.

[`func makeComputePipelineState(additionalBinaryFunctions: [any MTL4BinaryFunction]) throws -> any MTLComputePipelineState`](/documentation/Metal/MTLComputePipelineState/makeComputePipelineState(additionalBinaryFunctions:))

Allocates a new compute pipeline state by adding binary functions to this pipeline state.

[`func recommendedPersistentThreadgroupsPerGrid(forThreadsPerThreadgroup: MTLSize) -> Int`](/documentation/Metal/MTLComputePipelineState/recommendedPersistentThreadgroupsPerGrid(forThreadsPerThreadgroup:))

## Relationships

### Inherits From

[`MTLAllocation`](/documentation/Metal/MTLAllocation)

[`Sendable`](/documentation/Swift/Sendable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)