Skip to main content
Execution Providers (EPs) are the interfaces that enable ONNX Runtime to execute models on different hardware platforms. They provide hardware-specific optimizations and acceleration capabilities.

What are Execution Providers?

Execution Providers abstract the hardware-specific implementation details, allowing ONNX Runtime to:
  • Accelerate inference using specialized hardware (GPUs, NPUs, etc.)
  • Optimize operators for specific hardware architectures
  • Manage memory efficiently on target devices
  • Handle data transfer between different memory spaces
Think of Execution Providers as “backends” or “device drivers” for ONNX Runtime, similar to how TensorFlow has device placements or PyTorch has device types.

Architecture Overview

How EPs Work

1

Registration

Execution providers are registered with the session during initialization
2

Capability Query

Each EP reports which nodes/subgraphs it can execute via GetCapability()
3

Graph Partitioning

ONNX Runtime partitions the graph across available EPs based on their capabilities
4

Kernel Execution

Each node is executed by its assigned EP using hardware-specific kernels

Available Execution Providers

CPUExecutionProvider

The default execution provider, always available:

Platforms

  • Windows, Linux, macOS
  • x86_64, ARM64, ARM32
  • WebAssembly

Features

  • Comprehensive operator coverage
  • SIMD optimizations (SSE, AVX, NEON)
  • Multi-threading support
  • Reference implementation

CUDAExecutionProvider

NVIDIA GPU acceleration using CUDA:

TensorRTExecutionProvider

Optimized inference using NVIDIA TensorRT:
TensorRT builds optimized engines at runtime. The first inference run will be slower as engines are built and cached.

DirectMLExecutionProvider

Hardware acceleration on Windows using DirectML:

Advantages

  • Works with any DirectX 12 GPU
  • AMD, Intel, NVIDIA support
  • Built into Windows

Use Cases

  • Windows client applications
  • Cross-vendor GPU support
  • Integrated graphics

CoreMLExecutionProvider

Apple Silicon and iOS acceleration:

Additional Execution Providers

Intel CPU, GPU, VPU, and FPGA acceleration:
Android Neural Networks API:
ARM Compute Library for ARM CPUs:
AMD GPU acceleration:

EP Selection and Fallback

Provider Priority

Execution providers are tried in the order specified:
If a provider cannot execute a node, it falls back to the next provider in the list. CPU is typically the last fallback.

Checking Active Providers

Graph Partitioning

ONNX Runtime partitions the graph across execution providers:

Capability Query

Each EP implements GetCapability() to report which nodes it can execute:
Use verbose logging to see how nodes are partitioned:

Data Transfer

Execution providers manage data transfer between memory spaces:

Memory Locations

  • CPU memory: Host memory accessible by CPU
  • GPU memory: Device memory on GPU
  • Shared memory: Accessible by both CPU and GPU

IOBinding for Efficient Transfer

Use IOBinding to avoid unnecessary data copies:

Custom Execution Providers

You can implement custom execution providers for specialized hardware:
Building custom execution providers requires compiling ONNX Runtime from source. See the Custom Operators Guide for details.

Performance Considerations

Choose the right provider for your hardware:
  • CPU: Good for small models, low latency, or no GPU available
  • CUDA: Best for NVIDIA GPUs, good operator coverage
  • TensorRT: Maximum performance on NVIDIA GPUs, longer warmup
  • DirectML: Cross-vendor on Windows, good for client applications
Minimize data transfer between providers:
  • Prefer EPs that can execute entire subgraphs
  • CPU-GPU transfers are expensive
  • Use IOBinding to reduce copies
Configure memory limits appropriately:
First inference may be slower due to:
  • Kernel compilation
  • Memory allocation
  • Engine building (TensorRT)
Run warmup inferences before measuring performance:

Troubleshooting

Provider Not Available

Mixed Precision Issues

Some providers support different precisions:
FP16 may produce different results than FP32. Always validate accuracy when using reduced precision.

Memory Errors

Reduce memory usage:

Best Practices

Always Include CPU

Always include CPUExecutionProvider as fallback:

Test on Target Hardware

Performance varies significantly across hardware. Always profile on deployment targets.

Use IOBinding

Use IOBinding for better performance when doing multiple inferences.

Cache Engines

Enable engine caching for TensorRT:

Next Steps

Sessions

Learn about InferenceSession configuration and management

Graph Optimizations

Understand how graph optimizations improve performance

Performance Tuning

Optimize inference performance for your use case

Quantization

Reduce model size and improve speed with quantization