ONNX Runtime
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Modules Pages
OrtEpFactory Struct Reference

The OrtEpFactory provides functions to create and manage execution providers. More...

#include <onnxruntime_c_api.h>

Public Attributes

uint32_t ort_version_supported
 The ONNX Runtime version the execution provider was compiled with.
 
const char *(* GetName )(const OrtEpFactory *this_ptr)
 Get the name the of the execution provider that the factory creates.
 
const char *(* GetVendor )(const OrtEpFactory *this_ptr)
 Get the name of vendor who owns the execution provider that the factory creates.
 
OrtStatus *(* GetSupportedDevices )(OrtEpFactory *this_ptr, const OrtHardwareDevice *const *devices, size_t num_devices, OrtEpDevice **ep_devices, size_t max_ep_devices, size_t *num_ep_devices)
 Get information from the execution provider if it supports the OrtHardwareDevice.
 
OrtStatus *(* CreateEp )(OrtEpFactory *this_ptr, const OrtHardwareDevice *const *devices, const OrtKeyValuePairs *const *ep_metadata_pairs, size_t num_devices, const OrtSessionOptions *session_options, const OrtLogger *logger, OrtEp **ep)
 Function to create an OrtEp instance for use in a Session.
 
void(* ReleaseEp )(OrtEpFactory *this_ptr, struct OrtEp *ep)
 Release the OrtEp instance.
 

Detailed Description

The OrtEpFactory provides functions to create and manage execution providers.

Since
Version 1.22.

Member Data Documentation

◆ CreateEp

OrtStatus *( * OrtEpFactory::CreateEp) (OrtEpFactory *this_ptr, const OrtHardwareDevice *const *devices, const OrtKeyValuePairs *const *ep_metadata_pairs, size_t num_devices, const OrtSessionOptions *session_options, const OrtLogger *logger, OrtEp **ep)

Function to create an OrtEp instance for use in a Session.

ORT will call ReleaseEp to release the instance when it is no longer needed.

Parameters
[in]this_ptrThe OrtEpFactory instance.
[in]devicesThe OrtHardwareDevice instances that the execution provider was selected to use.
[in]ep_metadata_pairsExecution provider metadata that was provided to OrtEpApi::CreateEpDevice, for each device.
[in]num_devicesThe number of devices the execution provider was selected for.
[in]session_optionsThe OrtSessionOptions instance that contains the configuration options for the session. This will include ep_options from GetSupportedDevices as well as any user provided overrides. Execution provider options will have been added with a prefix of 'ep.[ep name].'. The OrtSessionOptions instance will NOT be valid after this call and should not be stored for later use.
[in]loggerThe OrtLogger instance for the session that the execution provider should use for logging.
[out]epThe OrtEp instance created by the factory.

Returns
If no error, nullptr will be returned. If there is an error, a pointer to an OrtStatus that contains error details will be returned. Use OrtApi::ReleaseStatus to free this pointer.

Since
Version [coming soon]. This is a placeholder.

◆ GetName

const char *( * OrtEpFactory::GetName) (const OrtEpFactory *this_ptr)

Get the name the of the execution provider that the factory creates.

Parameters
[in]this_ptrThe OrtEpFactory instance.
Returns
The name of the execution provider the factory creates.
Since
Version 1.22.

◆ GetSupportedDevices

OrtStatus *( * OrtEpFactory::GetSupportedDevices) (OrtEpFactory *this_ptr, const OrtHardwareDevice *const *devices, size_t num_devices, OrtEpDevice **ep_devices, size_t max_ep_devices, size_t *num_ep_devices)

Get information from the execution provider if it supports the OrtHardwareDevice.

Parameters
[in]this_ptrThe OrtEpFactory instance. Non-const as the factory is passed through to the CreateEp call via the OrtEpDevice.
[in]devicesThe OrtHardwareDevice instances that are available.
[in]num_devicesThe number of OrtHardwareDevice instances.
[out]ep_devicesOrtEpDevice instances for each OrtHardwareDevice that the EP can use. The implementation should call OrtEpApi::CreateEpDevice to create, and add the OrtEpDevice instances to this pre-allocated array. ORT will take ownership of the values returned. i.e. usage is ep_devices[0] = <ptr to OrtEpDevice created with OrtEpApi::CreateEpDevice>;
[in]max_ep_devicesThe maximum number of OrtEpDevices that can be added to ep_devices. Current default is 8. This can be increased if needed.
[out]num_ep_devicesThe number of EP devices added to ep_devices.
Returns
true if the factory can create an execution provider that uses device.
Note
ORT will take ownership or ep_metadata and/or ep_options if they are not null.
Since
Version 1.22.

◆ GetVendor

const char *( * OrtEpFactory::GetVendor) (const OrtEpFactory *this_ptr)

Get the name of vendor who owns the execution provider that the factory creates.

Parameters
[in]this_ptrThe OrtEpFactory instance.
Returns
vendor The vendor name of the execution provider the factory creates.
Since
Version 1.22.

◆ ort_version_supported

uint32_t OrtEpFactory::ort_version_supported

The ONNX Runtime version the execution provider was compiled with.

Implementation should set to ORT_API_VERSION. ORT will use this to ensure it does not call functions that were not available when the library was compiled.

Since
Version 1.22.

◆ ReleaseEp

void( * OrtEpFactory::ReleaseEp) (OrtEpFactory *this_ptr, struct OrtEp *ep)

Release the OrtEp instance.

Parameters
[in]this_ptrThe OrtEpFactory instance.
[in]epThe OrtEp instance to release.
Since
Version [coming soon]. This is a placeholder.