<!--
{
  "availability" : [
    "iOS: 12.0.0 -",
    "iPadOS: 12.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.14.0 -",
    "tvOS: 12.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 5.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreML",
  "identifier" : "/documentation/CoreML/MLComputeUnits",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Core ML"
    ],
    "preciseIdentifier" : "c:@E@MLComputeUnits"
  },
  "title" : "MLComputeUnits"
}
-->

# MLComputeUnits

The set of processing-unit configurations the model can use to make predictions.

```
enum MLComputeUnits
```

## Overview

Use this enumeration to set or inspect the processing units you allow a model to use when it makes a prediction.

Use `all` to allow the OS to select the best processing unit to use (including the neural engine, if available).

Use [`MLComputeUnits.cpuOnly`](/documentation/CoreML/MLComputeUnits/cpuOnly) to restrict the model to the CPU, if your app might run in the background or runs other GPU intensive tasks.

## Topics

### Processing Unit Configurations

[`MLComputeUnits.all`](/documentation/CoreML/MLComputeUnits/all)

The option you choose to allow the model to use all compute units available, including the neural engine.

[`MLComputeUnits.cpuOnly`](/documentation/CoreML/MLComputeUnits/cpuOnly)

The option you choose to limit the model to only use the CPU.

[`MLComputeUnits.cpuAndGPU`](/documentation/CoreML/MLComputeUnits/cpuAndGPU)

The option you choose to allow the model to use both the CPU and GPU, but not the neural engine.

[`MLComputeUnits.cpuAndNeuralEngine`](/documentation/CoreML/MLComputeUnits/cpuAndNeuralEngine)

The option you choose to allow the model to use both the CPU and neural engine, but not the GPU.

### Creating compute units

[`init(rawValue:)`](/documentation/CoreML/MLComputeUnits/init(rawValue:))



---

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)