Skip to main content

CoreML Execution Provider

The CoreML Execution Provider enables hardware-accelerated inference on Apple devices by leveraging Core ML, Apple’s machine learning framework. It provides access to the Apple Neural Engine (ANE), GPU, and optimized CPU execution.

When to Use CoreML EP

Use the CoreML Execution Provider when:
  • You’re deploying on iOS, iPadOS, or macOS devices
  • You want to leverage the Apple Neural Engine for maximum efficiency
  • You need low-power inference on mobile devices
  • You’re building apps for iPhone, iPad, Mac, Apple Watch, or Apple TV
  • You want native Apple Silicon (M1/M2/M3) optimization

Key Features

  • Apple Neural Engine: Dedicated hardware for ML inference (16-core on A14+, M1+)
  • Multi-Compute: Automatic dispatch to ANE, GPU, or CPU
  • Low Power: Optimized for battery life on mobile devices
  • Native Integration: Seamless integration with Apple ecosystem
  • ML Program: Support for latest Core ML features (iOS 15+)

Prerequisites

Hardware Requirements

iOS/iPadOS:
  • iPhone 8 and newer (A11 Bionic+) - Basic support
  • iPhone 12 and newer (A14+) - Full ANE support
  • iPad Pro 2018 and newer
macOS:
  • Mac with Apple Silicon (M1/M2/M3/M4) - Best performance
  • Intel Macs with AMD GPU - Limited support
Other Apple Devices:
  • Apple Watch Series 4+
  • Apple TV 4K (2nd gen+)

Software Requirements

  • iOS/iPadOS: 14.0 or newer (15.0+ recommended for ML Program)
  • macOS: 11.0 Big Sur or newer (12.0+ recommended)
  • Xcode: 13.0 or newer
  • ONNX Runtime Mobile or ONNX Runtime for macOS

Installation

iOS (via CocoaPods)

iOS (via Swift Package Manager)

macOS (Python)

macOS (C++)

Basic Usage

Python (macOS)

Objective-C (iOS)

Swift (iOS)

Configuration Options

Python Provider Options

CoreML Flags (C/Objective-C)

Key Configuration Parameters

Compute Units

Control which hardware accelerators to use:

ML Program vs Neural Network

ML Program Benefits:
  • Better operator support
  • Improved performance
  • More optimization opportunities
  • Required for latest features

Model Caching

Cache compiled models for faster startup:

ANE-Only Mode

For maximum efficiency on devices with ANE:

Performance Optimization

Static vs Dynamic Shapes

Batch Size

The Apple Neural Engine works best with small batch sizes:

Model Format

Convert ONNX to Core ML for maximum performance:

Platform-Specific Considerations

iOS/iPadOS

macOS (Apple Silicon)

macOS (Intel)

Supported Operations

CoreML EP supports most common operations. Unsupported ops fall back to CPU:

Platform Support

Troubleshooting

Provider Not Available

Model Compilation Errors

Performance Not as Expected

Performance Comparison

Typical performance on iPhone 13 Pro (A15 Bionic):

Next Steps