ONNX Runtime
Loading...
Searching...
No Matches
OrtEpApi Struct Reference

The OrtEpApi struct provides functions that are relevant to the implementation of an execution provider. More...

#include <onnxruntime_ep_c_api.h>

Public Member Functions

OrtStatusCreateEpDevice (OrtEpFactory *ep_factory, const OrtHardwareDevice *hardware_device, const OrtKeyValuePairs *ep_metadata, const OrtKeyValuePairs *ep_options, OrtEpDevice **ep_device)
 Create an OrtEpDevice for the EP and an OrtHardwareDevice.
 
void ReleaseEpDevice (OrtEpDevice *input)
 
OrtStatusEpGraphSupportInfo_AddNodesToFuse (OrtEpGraphSupportInfo *graph_support_info, const OrtNode *const *nodes, size_t num_nodes, const OrtNodeFusionOptions *node_fusion_options)
 Specify nodes that are supported by an OrtEp and should be fused into one node.
 
OrtStatusEpGraphSupportInfo_AddSingleNode (OrtEpGraphSupportInfo *graph_support_info, const OrtNode *node)
 Specify a node that is supported by an OrtEp and should be run with a registered EP kernel.
 
OrtStatusEpDevice_AddAllocatorInfo (OrtEpDevice *ep_device, const OrtMemoryInfo *allocator_memory_info)
 Register an allocator with the OrtEpDevice.
 
OrtStatusCreateHardwareDevice (OrtHardwareDeviceType type, uint32_t vendor_id, uint32_t device_id, const char *vendor_name, const OrtKeyValuePairs *metadata, OrtHardwareDevice **hardware_device)
 Create an OrtHardwareDevice.
 
void ReleaseHardwareDevice (OrtHardwareDevice *input)
 
OrtStatusCreateKernelRegistry (OrtKernelRegistry **kernel_registry)
 Creates an empty kernel registry. A kernel registry contains kernel creation information for every operator kernel supported by an EP.
 
void ReleaseKernelRegistry (OrtKernelRegistry *input)
 
OrtStatusKernelRegistry_AddKernel (OrtKernelRegistry *kernel_registry, const OrtKernelDef *kernel_def, OrtKernelCreateFunc kernel_create_func, void *kernel_create_func_state)
 Adds kernel creation information for a supported operator kernel to the given kernel registry.
 
OrtStatusCreateKernelDefBuilder (OrtKernelDefBuilder **kernel_def_builder_out)
 Creates a kernel definition builder used to create instances of OrtKernelDef.
 
void ReleaseKernelDefBuilder (OrtKernelDefBuilder *input)
 
OrtStatusKernelDefBuilder_SetOperatorType (OrtKernelDefBuilder *kernel_def_builder, const char *op_type)
 Sets the kernel's operator type.
 
OrtStatusKernelDefBuilder_SetDomain (OrtKernelDefBuilder *kernel_def_builder, const char *domain)
 Sets the kernel's domain.
 
OrtStatusKernelDefBuilder_SetSinceVersion (OrtKernelDefBuilder *kernel_def_builder, int since_version_start, int since_version_end)
 Sets the kernel's opset version range that is supported.
 
OrtStatusKernelDefBuilder_SetExecutionProvider (OrtKernelDefBuilder *kernel_def_builder, const char *ep_name)
 Sets the name of the kernel's intended execution provider.
 
OrtStatusKernelDefBuilder_SetInputMemType (OrtKernelDefBuilder *kernel_def_builder, size_t input_index, OrtMemType mem_type)
 Sets the memory type for a kernel input.
 
OrtStatusKernelDefBuilder_SetOutputMemType (OrtKernelDefBuilder *kernel_def_builder, size_t output_index, OrtMemType mem_type)
 Sets the memory type for a kernel output.
 
OrtStatusKernelDefBuilder_AddTypeConstraint (OrtKernelDefBuilder *kernel_def_builder, const char *arg_name, const OrtDataType *const *types, size_t num_types)
 Adds type constraints for a kernel argument represented as a string (e.g., "T").
 
OrtStatusKernelDefBuilder_AddInputOutputAliases (OrtKernelDefBuilder *kernel_def_builder, int const *input_indices, int const *output_indices, size_t num_io_indices)
 Adds aliases for the given input and output pairs.
 
OrtStatusKernelDefBuilder_AddInputOutputMutableAliases (OrtKernelDefBuilder *kernel_def_builder, int const *input_indices, int const *output_indices, size_t num_io_indices)
 Adds mutable aliases for the given input and output pairs.
 
OrtStatusKernelDefBuilder_Build (OrtKernelDefBuilder *kernel_def_builder, OrtKernelDef **kernel_def_out)
 Creates a OrtKernelDef instance from the given kernel definition builder.
 
void ReleaseKernelDef (OrtKernelDef *input)
 
OrtStatusKernelDef_GetSinceVersion (const OrtKernelDef *kernel_def, int *start_version, int *end_version)
 Gets the kernel's opset version range that is supported.
 
OrtStatusKernelDef_GetInputMemType (const OrtKernelDef *kernel_def, size_t input_index, OrtMemType *mem_type)
 Gets the memory type for a kernel input.
 
OrtStatusKernelDef_GetOutputMemType (const OrtKernelDef *kernel_def, size_t output_index, OrtMemType *mem_type)
 Gets the memory type for a kernel output.
 
OrtStatusGetTensorDataType (ONNXTensorElementDataType elem_type, const OrtDataType **out)
 Gets the OrtDataType that represents the data type for a tensor of the given element type.
 
OrtStatusEpGraphSupportInfo_LookUpKernel (OrtEpGraphSupportInfo *graph_support_info, const OrtNode *node, const OrtKernelDef **out_kernel_def)
 Gets the kernel definition for a given node, if any exists for the calling execution provider.
 
OrtStatusSharedPrePackedWeightCache_StoreWeightData (OrtSharedPrePackedWeightCache *prepacked_weight_cache, void **buffer_data_ptrs, size_t *buffer_data_sizes, size_t num_buffers)
 Sets one or more data buffers that collectively hold the pre-packed data for a single shared weight.
 
OrtStatusKernelInfo_GetEp (const OrtKernelInfo *info, const OrtEp **ep)
 Get the OrtEp instance to which the node is assigned from the OrtKernelInfo.
 
OrtStatusDeviceEpIncompatibilityDetails_SetDetails (OrtDeviceEpIncompatibilityDetails *details, uint32_t reasons_bitmask, int32_t error_code, const char *notes)
 Set the details of an OrtDeviceEpIncompatibilityDetails instance.
 
OrtStatusCreateIfKernel (const OrtKernelInfo *kernel_info, OrtKernelImpl **kernel_out)
 Creates an OrtKernelImpl instance for an If operator.
 
OrtStatusCreateLoopKernel (const OrtKernelInfo *kernel_info, OrtLoopKernelHelper *helper, OrtKernelImpl **kernel_out)
 Creates an OrtKernelImpl instance for a Loop operator.
 
OrtStatusCreateScanKernel (const OrtKernelInfo *kernel_info, OrtScanKernelHelper *helper, OrtKernelImpl **kernel_out)
 Creates an OrtKernelImpl instance for a Scan operator. Does not support opset versions older than 9.
 
void ReleaseKernelImpl (OrtKernelImpl *input)
 
OrtStatusGetEnvConfigEntries (OrtKeyValuePairs **config_entries)
 Gets a new OrtKeyValuePairs instance containing a copy of all configuration entries set on the environment.
 

Public Attributes

const char *(* NodeComputeContext_NodeName )(const OrtNodeComputeContext *context)
 Query a OrtNodeComputeContext for the name of the node that encapsulates the compiled/fused node.
 
const OrtMemoryDevice *(* MemoryInfo_GetMemoryDevice )(const OrtMemoryInfo *memory_info)
 Get the OrtMemoryDevice from an OrtMemoryInfo instance.
 
const OrtMemoryDevice *(* Value_GetMemoryDevice )(const OrtValue *value)
 Get the OrtMemoryDevice from an OrtValue instance if it contains a Tensor.
 
bool(* MemoryDevice_AreEqual )(const OrtMemoryDevice *a, const OrtMemoryDevice *b)
 Compare two OrtMemoryDevice instances for equality.
 
OrtMemoryInfoDeviceType(* MemoryDevice_GetDeviceType )(const OrtMemoryDevice *memory_device)
 Get the OrtMemoryInfoDeviceType value from an OrtMemoryDevice instance.
 
OrtDeviceMemoryType(* MemoryDevice_GetMemoryType )(const OrtMemoryDevice *memory_device)
 Get the OrtDeviceMemoryType value from an OrtMemoryDevice instance.
 
uint32_t(* MemoryDevice_GetVendorId )(const OrtMemoryDevice *memory_device)
 Get the vendor ID from an OrtMemoryDevice instance.
 
uint32_t(* MemoryDevice_GetDeviceId )(const OrtMemoryDevice *memory_device)
 Get the device ID from an OrtMemoryDevice instance.
 
const OrtSyncStreamImpl *(* SyncStream_GetImpl )(const OrtSyncStream *stream)
 Get the OrtSyncStreamImpl associated with an OrtSyncStream instance.
 
uint64_t(* SyncStream_GetSyncId )(const OrtSyncStream *stream)
 Get the current sync ID for a stream.
 
uint64_t(* GetSyncIdForLastWaitOnSyncStream )(const OrtSyncStream *producer_stream, const OrtSyncStream *consumer_stream)
 Get the sync ID for the last time the consumer_stream waited on the producer_stream.
 
const char *(* KernelDef_GetOperatorType )(const OrtKernelDef *kernel_def)
 Returns the operator type from the kernel definition.
 
const char *(* KernelDef_GetDomain )(const OrtKernelDef *kernel_def)
 Returns the operator's domain from the kernel definition.
 
const char *(* KernelDef_GetExecutionProvider )(const OrtKernelDef *kernel_def)
 Returns the name of the kernel's intended execution provider.
 

Detailed Description

The OrtEpApi struct provides functions that are relevant to the implementation of an execution provider.

Since
Version 1.22.

Member Function Documentation

◆ CreateEpDevice()

OrtStatus * OrtEpApi::CreateEpDevice ( OrtEpFactory ep_factory,
const OrtHardwareDevice hardware_device,
const OrtKeyValuePairs ep_metadata,
const OrtKeyValuePairs ep_options,
OrtEpDevice **  ep_device 
)

Create an OrtEpDevice for the EP and an OrtHardwareDevice.

Parameters
[in]ep_factoryExecution provider factory that is creating the instance.
[in]hardware_deviceHardware device that the EP can utilize.
[in]ep_metadataOptional OrtKeyValuePairs instance for execution provider metadata that may be used during execution provider selection and passed to CreateEp. ep_device will copy this instance and the user should call ReleaseKeyValuePairs.
[in]ep_optionsOptional OrtKeyValuePairs instance for execution provider options that will be added to the Session configuration options if the execution provider is selected. ep_device will copy this instance and the user should call ReleaseKeyValuePairs.
ep_deviceOrtExecutionDevice that is created.
Since
Version 1.22.

◆ CreateHardwareDevice()

OrtStatus * OrtEpApi::CreateHardwareDevice ( OrtHardwareDeviceType  type,
uint32_t  vendor_id,
uint32_t  device_id,
const char *  vendor_name,
const OrtKeyValuePairs metadata,
OrtHardwareDevice **  hardware_device 
)

Create an OrtHardwareDevice.

Note
Called within OrtEpFactory::GetSupportedDevices to create a new hardware device (e.g., virtual).
Parameters
[in]typeThe hardware device type.
[in]vendor_idThe hardware device's vendor identifier.
[in]device_idThe hardware device's identifier.
[in]vendor_nameThe hardware device's vendor name as a null-terminated string. Copied by ORT.
[in]metadataOptional OrtKeyValuePairs instance for hardware device metadata that may be queried by applications via OrtApi::GetEpDevices(). Refer to onnxruntime_ep_device_ep_metadata_keys.h for common OrtHardwareDevice metadata keys.
[out]hardware_deviceOutput parameter set to the new OrtHardwareDevice instance that is created. Must be release with ReleaseHardwareDevice().

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 1.24.

◆ CreateIfKernel()

OrtStatus * OrtEpApi::CreateIfKernel ( const OrtKernelInfo kernel_info,
OrtKernelImpl **  kernel_out 
)

Creates an OrtKernelImpl instance for an If operator.

Control flow operators require access to ORT session internals to orchestrate subgraph operations. This function allows an EP to create a properly configured OrtKernelImpl with access to ORT internals that the EP can add to its kernel registry.

An EP is required to create an OrtKernelDef that keeps input[0] ('cond') on the CPU (i.e., OrtMemTypeCPUInput) as this input is used by CPU logic. The output should remain on the device (i.e., OrtMemTypeDefault), which is the default setting, to avoid copying to/from CPU.

Example kernel definition (CXX API): Ort::KernelDef kernel_def = Ort::KernelDefBuilder() .SetDomain("").SetOperatorType("If").SetSinceVersion(21, 22) .SetExecutionProvider("MyEp") .SetInputMemType(0, OrtMemTypeCPUInput) // 'cond' on CPU .SetOutputMemType(0, OrtMemTypeDefault) // output on EP device .AddTypeConstraint("B", ...) .AddTypeConstraint("V", ...).Build();

Parameters
[in]kernel_infoThe OrtKernelInfo instance for an If node. This function returns error ORT_FAIL if the opset version specified by kernel_info is unsupported.
[out]kernel_outOutput parameter set to the OrtKernelImpl instance for the If node. Must be released via ReleaseKernelImpl, unless ownership is transferred to ORT (see OrtKernelCreateFunc and KernelRegistry_AddKernel()).

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 1.24

◆ CreateKernelDefBuilder()

OrtStatus * OrtEpApi::CreateKernelDefBuilder ( OrtKernelDefBuilder **  kernel_def_builder_out)

Creates a kernel definition builder used to create instances of OrtKernelDef.

Parameters
[out]kernel_def_builder_outOutput parameter set to the new OrtKernelDefBuilder instance. Must be released with OrtEpApi::ReleaseKernelDefBuilder().

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 1.24.

◆ CreateKernelRegistry()

OrtStatus * OrtEpApi::CreateKernelRegistry ( OrtKernelRegistry **  kernel_registry)

Creates an empty kernel registry. A kernel registry contains kernel creation information for every operator kernel supported by an EP.

Remarks
Refer to OrtEp::GetKernelRegistry, which returns an EP's kernel registry to ORT.
Parameters
[out]kernel_registryOutput parameter set to the new OrtKernelRegistry instance. Must be released with OrtEpApi::ReleaseKernelRegistry.

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 1.24.

◆ CreateLoopKernel()

OrtStatus * OrtEpApi::CreateLoopKernel ( const OrtKernelInfo kernel_info,
OrtLoopKernelHelper helper,
OrtKernelImpl **  kernel_out 
)

Creates an OrtKernelImpl instance for a Loop operator.

Control flow operators require access to ORT session internals to orchestrate subgraph operations. This function allows an EP to create a properly configured OrtKernelImpl with access to ORT internals that the EP can add to its kernel registry.

An EP is required to create an OrtKernelDef that keeps input[0] ('M') and input[1] ('cond') on the CPU (i.e., OrtMemTypeCPUInput) as these inputs are used by CPU logic. Input[2] ('v_initial') and the output should remain on the device (i.e., OrtMemTypeDefault), which is the default setting, to avoid copying to/from CPU.

Example kernel definition (CXX API): Ort::KernelDef kernel_def = Ort::KernelDefBuilder() .SetDomain("").SetOperatorType("Loop").SetSinceVersion(21, 22) .SetExecutionProvider("MyEp") .SetInputMemType(0, OrtMemTypeCPUInput) // 'M' on CPU .SetInputMemType(1, OrtMemTypeCPUInput) // 'cond' on CPU .SetInputMemType(2, OrtMemTypeDefault) // 'v_initial' on EP device .SetOutputMemType(0, OrtMemTypeDefault) // output on EP device .AddTypeConstraint("I", ...) .AddTypeConstraint("B", ...) .AddTypeConstraint("V", ...).Build();

Parameters
[in]kernel_infoThe OrtKernelInfo instance for a Loop node. This function returns error ORT_FAIL if the opset version specified by kernel_info is unsupported.
[in]helperA OrtLoopKernelHelper instance that contains helper functions that ORT calls during kernel execution to operate on tensors allocated with the EP's device memory. ORT will call OrtLoopKernelHelper::Release() to release the helper and its resources.
[out]kernel_outOutput parameter set to the OrtKernelImpl instance for the Loop node. Must be released via ReleaseKernelImpl, unless ownership is transferred to ORT (see OrtKernelCreateFunc and KernelRegistry_AddKernel()).

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 1.24

◆ CreateScanKernel()

OrtStatus * OrtEpApi::CreateScanKernel ( const OrtKernelInfo kernel_info,
OrtScanKernelHelper helper,
OrtKernelImpl **  kernel_out 
)

Creates an OrtKernelImpl instance for a Scan operator. Does not support opset versions older than 9.

Control flow operators require access to ORT session internals to orchestrate subgraph operations. This function allows an EP to create a properly configured OrtKernelImpl with access to ORT internals that the EP can add to its kernel registry.

It is recommended that an EP create an OrtKernelDef that keeps the inputs and outputs on the EP's device (i.e., OrtMemTypeDefault), which is the default setting, to avoid copying to/from CPU.

Example kernel definition (CXX API): Ort::KernelDef kernel_def = Ort::KernelDefBuilder() .SetDomain("").SetOperatorType("Scan").SetSinceVersion(21, 22) .SetExecutionProvider("MyEp") .SetInputMemType(0, OrtMemTypeDefault) // input[0] on EP device .SetOutputMemType(0, OrtMemTypeDefault) // output[0] on EP device .AddTypeConstraint("V", ...).Build();

Parameters
[in]kernel_infoThe OrtKernelInfo instance for a Scan node. This function returns error ORT_FAIL if the opset version specified by kernel_info is unsupported.
[in]helperA OrtScanKernelHelper instance that contains helper functions that ORT calls during kernel execution to operate on tensors allocated with the EP's device memory. ORT will call OrtScanKernelHelper::Release() to release the helper and its resources.
[out]kernel_outOutput parameter set to the OrtKernelImpl instance for the Scan node. Must be released via ReleaseKernelImpl, unless ownership is transferred to ORT (see OrtKernelCreateFunc and KernelRegistry_AddKernel()).

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 1.24

◆ DeviceEpIncompatibilityDetails_SetDetails()

OrtStatus * OrtEpApi::DeviceEpIncompatibilityDetails_SetDetails ( OrtDeviceEpIncompatibilityDetails details,
uint32_t  reasons_bitmask,
int32_t  error_code,
const char *  notes 
)

Set the details of an OrtDeviceEpIncompatibilityDetails instance.

Used by execution provider factories to set incompatibility details in their GetHardwareDeviceIncompatibilityDetails implementation. ORT creates and initializes the object before passing it to the EP, so calling this function is optional. The EP uses this function to set incompatibility information when the device is not compatible.

Parameters
[in,out]detailsThe OrtDeviceEpIncompatibilityDetails instance to update.
[in]reasons_bitmaskBitmask of OrtDeviceEpIncompatibilityReason values. (0 = no incompatibility).
[in]error_codeOptional EP-specific error code (0 = no error).
[in]notesOptional human-readable notes. Can be null.

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 1.24.

◆ EpDevice_AddAllocatorInfo()

OrtStatus * OrtEpApi::EpDevice_AddAllocatorInfo ( OrtEpDevice ep_device,
const OrtMemoryInfo allocator_memory_info 
)

Register an allocator with the OrtEpDevice.

This allows an EP to provide OrtMemoryInfo for DEFAULT and HOST_ACCESSIBLE memory type as needed. The registered values will be used in calls to OrtEpFactory::CreateAllocator to ensure the required allocator/s are available for EP usage.

Multiple calls for the same entry type will replace a previous entry.

Available entries:

  • OrtDeviceAllocator with type of OrtDeviceMemoryType_DEFAULT
  • OrtDeviceAllocator with type of OrtDeviceMemoryType_HOST_ACCESSIBLE
  • OrtReadOnlyAllocator with type of OrtDeviceMemoryType_DEFAULT
    • if provided this allocator will only be used to copy initializers to the device the EP uses. ORT will use the OrtDeviceAllocator if not provided.
Parameters
[in]ep_deviceThe OrtEpDevice instance to register the OrtMemoryInfo with.
[in]allocator_memory_infoThe OrtMemoryInfo information for the allocator.

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 1.23.

◆ EpGraphSupportInfo_AddNodesToFuse()

OrtStatus * OrtEpApi::EpGraphSupportInfo_AddNodesToFuse ( OrtEpGraphSupportInfo *  graph_support_info,
const OrtNode *const *  nodes,
size_t  num_nodes,
const OrtNodeFusionOptions node_fusion_options 
)

Specify nodes that are supported by an OrtEp and should be fused into one node.

Because the nodes will be fused into one "fused node", there must not exist an unsupported node in a path between two of the provided nodes. Otherwise, the graph will become invalid.

This function can be called multiple times. A subsequent call to this function will force the next set of nodes to be fused into a different node.

Parameters
[in]graph_support_infoOrtEpGraphSupportInfo instance to which to add the supported nodes.
[in]nodesArray of nodes supported by the EP that should be fused/compiled.
[in]num_nodesThe number of supported nodes.
[in]node_fusion_optionsOptional node fusion options. Ignored if set to NULL.

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 1.23.

◆ EpGraphSupportInfo_AddSingleNode()

OrtStatus * OrtEpApi::EpGraphSupportInfo_AddSingleNode ( OrtEpGraphSupportInfo *  graph_support_info,
const OrtNode node 
)

Specify a node that is supported by an OrtEp and should be run with a registered EP kernel.

Parameters
[in]graph_support_infoOrtEpGraphSupportInfo instance to which to add the supported node.
[in]nodeThe supported OrtNode instance.

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 1.23.

◆ EpGraphSupportInfo_LookUpKernel()

OrtStatus * OrtEpApi::EpGraphSupportInfo_LookUpKernel ( OrtEpGraphSupportInfo *  graph_support_info,
const OrtNode node,
const OrtKernelDef **  out_kernel_def 
)

Gets the kernel definition for a given node, if any exists for the calling execution provider.

Used within OrtEp::GetCapability() to get the registered kernel definition for the given node. The kernel definition is set to NULL if there is no registered kernel definition for the node and execution provider.

Parameters
[in]graph_support_infoThe OrtEpGraphSupportInfo instance to query.
[in]nodeThe node for which to look up a kernel definition.
[out]out_kernel_defOutput parameter set to the OrtKernelDef or NULL. Owned by ORT and must not be released.

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 1.24.

◆ GetEnvConfigEntries()

OrtStatus * OrtEpApi::GetEnvConfigEntries ( OrtKeyValuePairs **  config_entries)

Gets a new OrtKeyValuePairs instance containing a copy of all configuration entries set on the environment.

Note
An application provides environment-level configuration options for execution provider libraries by using keys with the prefix 'ep_factory.\<ep_name\>.'. Ex: the key 'ep_factory.my_ep.some_ep_key' represents a key named 'some_ep_key' that is meant to be consumed by an execution provider named 'my_ep'. Refer to the specific execution provider's documentation for valid keys and values.
Refer to onnxruntime_env_config_keys.h for common configuration entry keys and their supported values.
Parameters
[out]config_entriesOutput parameter set to the OrtKeyValuePairs instance containing all configuration entries. Must be released via OrtApi::ReleaseKeyValuePairs.

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 1.24

◆ GetTensorDataType()

OrtStatus * OrtEpApi::GetTensorDataType ( ONNXTensorElementDataType  elem_type,
const OrtDataType **  out 
)

Gets the OrtDataType that represents the data type for a tensor of the given element type.

Parameters
[in]elem_typeThe tensor's element type.
[out]outOutput parameter set to the OrtDataType. Owned by ORT and must not be released.

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 1.24.

◆ KernelDef_GetInputMemType()

OrtStatus * OrtEpApi::KernelDef_GetInputMemType ( const OrtKernelDef *  kernel_def,
size_t  input_index,
OrtMemType mem_type 
)

Gets the memory type for a kernel input.

Parameters
[in]kernel_defThe OrtKernelDef instance.
[in]input_indexThe index of the input.
[out]mem_typeOutput parameter set to the input's memory type.

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 1.24.

◆ KernelDef_GetOutputMemType()

OrtStatus * OrtEpApi::KernelDef_GetOutputMemType ( const OrtKernelDef *  kernel_def,
size_t  output_index,
OrtMemType mem_type 
)

Gets the memory type for a kernel output.

Parameters
[in]kernel_defThe OrtKernelDef instance.
[in]output_indexThe index of the output.
[out]mem_typeOutput parameter set to the output's memory type.

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 1.24.

◆ KernelDef_GetSinceVersion()

OrtStatus * OrtEpApi::KernelDef_GetSinceVersion ( const OrtKernelDef *  kernel_def,
int *  start_version,
int *  end_version 
)

Gets the kernel's opset version range that is supported.

Parameters
[in]kernel_defThe OrtKernelDef instance.
[out]start_versionOutput parameter set to the starting opset version that is supported.
[out]end_versionOutput parameter set to the ending opset version (inclusive) that is supported.

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 1.24.

◆ KernelDefBuilder_AddInputOutputAliases()

OrtStatus * OrtEpApi::KernelDefBuilder_AddInputOutputAliases ( OrtKernelDefBuilder *  kernel_def_builder,
int const *  input_indices,
int const *  output_indices,
size_t  num_io_indices 
)

Adds aliases for the given input and output pairs.

Note
Used for operators like Identity and Reshape to allow ORT to reuse the input buffer for the output without modification.
Parameters
[in]kernel_def_builderThe OrtKernelDefBuilder instance.
[in]input_indicesArray of input indices. Array must contain num_io_indices elements.
[in]output_indicesArray of output indices. Each output index is aliased with a corresponding input index in input_indices. Array must contain num_io_indices elements.
[in]num_io_indicesThe number of input/output index pairs to alias.

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 1.24.

◆ KernelDefBuilder_AddInputOutputMutableAliases()

OrtStatus * OrtEpApi::KernelDefBuilder_AddInputOutputMutableAliases ( OrtKernelDefBuilder *  kernel_def_builder,
int const *  input_indices,
int const *  output_indices,
size_t  num_io_indices 
)

Adds mutable aliases for the given input and output pairs.

Note
Allows ORT to reuse and modify an input buffer (in-place) for the output buffer. This is also known as "MayInplace" within the ORT codebase.
Parameters
[in]kernel_def_builderThe OrtKernelDefBuilder instance.
[in]input_indicesArray of input indices. Array must contain num_io_indices elements.
[in]output_indicesArray of output indices. Each output index is aliased with a corresponding input index in input_indices. Array must contain num_io_indices elements.
[in]num_io_indicesThe number of input/output index pairs to alias.

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 1.24.

◆ KernelDefBuilder_AddTypeConstraint()

OrtStatus * OrtEpApi::KernelDefBuilder_AddTypeConstraint ( OrtKernelDefBuilder *  kernel_def_builder,
const char *  arg_name,
const OrtDataType *const *  types,
size_t  num_types 
)

Adds type constraints for a kernel argument represented as a string (e.g., "T").

Parameters
[in]kernel_def_builderThe OrtKernelDefBuilder instance.
[in]arg_nameA null-terminated string representing the argument to constrain (e.g., "T").
[in]typesArray of OrtDataType instances representing allowed types for the argument. Must contain num_types elements.
[in]num_typesThe number of OrtDataType elements in the types array.

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 1.24.

◆ KernelDefBuilder_Build()

OrtStatus * OrtEpApi::KernelDefBuilder_Build ( OrtKernelDefBuilder *  kernel_def_builder,
OrtKernelDef **  kernel_def_out 
)

Creates a OrtKernelDef instance from the given kernel definition builder.

Parameters
[in]kernel_def_builderThe OrtKernelDefBuilder instance.
[out]kernel_def_outThe new OrtKernelDef instance.

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 1.24.

◆ KernelDefBuilder_SetDomain()

OrtStatus * OrtEpApi::KernelDefBuilder_SetDomain ( OrtKernelDefBuilder *  kernel_def_builder,
const char *  domain 
)

Sets the kernel's domain.

Parameters
[in]kernel_def_builderThe OrtKernelDefBuilder instance.
[in]domainA null-terminated string representing the operator's domain.

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 1.24.

◆ KernelDefBuilder_SetExecutionProvider()

OrtStatus * OrtEpApi::KernelDefBuilder_SetExecutionProvider ( OrtKernelDefBuilder *  kernel_def_builder,
const char *  ep_name 
)

Sets the name of the kernel's intended execution provider.

Parameters
[in]kernel_def_builderThe OrtKernelDefBuilder instance.
[in]ep_nameA null-terminated string representing the execution provider's name.

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 1.24.

◆ KernelDefBuilder_SetInputMemType()

OrtStatus * OrtEpApi::KernelDefBuilder_SetInputMemType ( OrtKernelDefBuilder *  kernel_def_builder,
size_t  input_index,
OrtMemType  mem_type 
)

Sets the memory type for a kernel input.

Parameters
[in]kernel_def_builderThe OrtKernelDefBuilder instance.
[in]input_indexThe index of the input.
[in]mem_typeThe input's memory type.

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 1.24.

◆ KernelDefBuilder_SetOperatorType()

OrtStatus * OrtEpApi::KernelDefBuilder_SetOperatorType ( OrtKernelDefBuilder *  kernel_def_builder,
const char *  op_type 
)

Sets the kernel's operator type.

Parameters
[in]kernel_def_builderThe OrtKernelDefBuilder instance.
[in]op_typeA null-terminated string representing the operator type.

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 1.24.

◆ KernelDefBuilder_SetOutputMemType()

OrtStatus * OrtEpApi::KernelDefBuilder_SetOutputMemType ( OrtKernelDefBuilder *  kernel_def_builder,
size_t  output_index,
OrtMemType  mem_type 
)

Sets the memory type for a kernel output.

Parameters
[in]kernel_def_builderThe OrtKernelDefBuilder instance.
[in]output_indexThe index of the output.
[in]mem_typeThe output's memory type.

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 1.24.

◆ KernelDefBuilder_SetSinceVersion()

OrtStatus * OrtEpApi::KernelDefBuilder_SetSinceVersion ( OrtKernelDefBuilder *  kernel_def_builder,
int  since_version_start,
int  since_version_end 
)

Sets the kernel's opset version range that is supported.

Parameters
[in]kernel_def_builderThe OrtKernelDefBuilder instance.
[in]since_version_startThe starting opset version that is supported.
[in]since_version_endThe ending opset version (inclusive) that is supported. Can be set equal to the starting version to indicate that only one version is supported.

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 1.24.

◆ KernelInfo_GetEp()

OrtStatus * OrtEpApi::KernelInfo_GetEp ( const OrtKernelInfo info,
const OrtEp **  ep 
)

Get the OrtEp instance to which the node is assigned from the OrtKernelInfo.

Note
Used within OrtKernelImpl implementations to obtain a reference to the OrtEp.
Parameters
[in]infoThe OrtKernelInfo instance.
[out]epOutput parameter set to the OrtEp instance associated with the OrtKernelInfo.

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 1.24

◆ KernelRegistry_AddKernel()

OrtStatus * OrtEpApi::KernelRegistry_AddKernel ( OrtKernelRegistry *  kernel_registry,
const OrtKernelDef *  kernel_def,
OrtKernelCreateFunc  kernel_create_func,
void *  kernel_create_func_state 
)

Adds kernel creation information for a supported operator kernel to the given kernel registry.

Remarks
Refer to OrtEp::GetKernelRegistry, which returns an EP's kernel registry to ORT.
Parameters
[in]kernel_registryThe OrtKernelRegistry instance.
[in]kernel_defThe kernel definition, which includes operator type, version, EP name, type constraints, etc.
[in]kernel_create_funcFunction that creates an instance of the operator kernel as a OrtKernelImpl instance.
[in]kernel_create_func_stateCustom state passed to the kernel creation function. Can be null.

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 1.24.

◆ ReleaseEpDevice()

void OrtEpApi::ReleaseEpDevice ( OrtEpDevice input)

◆ ReleaseHardwareDevice()

void OrtEpApi::ReleaseHardwareDevice ( OrtHardwareDevice input)

◆ ReleaseKernelDef()

void OrtEpApi::ReleaseKernelDef ( OrtKernelDef *  input)

◆ ReleaseKernelDefBuilder()

void OrtEpApi::ReleaseKernelDefBuilder ( OrtKernelDefBuilder *  input)

◆ ReleaseKernelImpl()

void OrtEpApi::ReleaseKernelImpl ( OrtKernelImpl input)

◆ ReleaseKernelRegistry()

void OrtEpApi::ReleaseKernelRegistry ( OrtKernelRegistry *  input)

◆ SharedPrePackedWeightCache_StoreWeightData()

OrtStatus * OrtEpApi::SharedPrePackedWeightCache_StoreWeightData ( OrtSharedPrePackedWeightCache *  prepacked_weight_cache,
void **  buffer_data_ptrs,
size_t *  buffer_data_sizes,
size_t  num_buffers 
)

Sets one or more data buffers that collectively hold the pre-packed data for a single shared weight.

Note
Used within the implementation of OrtKernelImpl::PrePackWeight() when the kernel wants to share pre-packed weight data with other kernels. The buffer data MUST be allocated with the OrtAllocator provided to OrtKernelImpl::PrePack.
Ownership of weight data transfers to the OrtSharedPrePackedWeightCache instance on success. If this function returns an error status, the caller retains ownership of the weight data.
Subsequent calls with the same OrtSharedPrePackedWeightCache instance release and replace the old data.
Parameters
[in]prepacked_weight_cacheThe OrtSharedPrePackedWeightCache instance.
[in]buffer_data_ptrsAn array of buffer data pointers that collectively hold the pre-packed data for a single shared weight. Note that sometimes a single weight may have multiple pre-packed buffers and it is up to the kernel implementation to determine how to split the data into multiple buffers (if desired).
[in]buffer_data_sizesAn array of buffer byte sizes, one per element in buffer_data_ptrs.
[in]num_buffersThe number of buffers used to store the data for the shared pre-packed weight. Specifies the number of elements in the buffer_data_ptrs and buffer_data_sizes arrays.

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 1.24.

Member Data Documentation

◆ GetSyncIdForLastWaitOnSyncStream

uint64_t( * OrtEpApi::GetSyncIdForLastWaitOnSyncStream) (const OrtSyncStream *producer_stream, const OrtSyncStream *consumer_stream)

Get the sync ID for the last time the consumer_stream waited on the producer_stream.

When two streams are synchronized, the sync id represents the event used in that synchronization.

Parameters
[in]producer_streamThe OrtSyncStream that produced the data.
[in]consumer_streamThe OrtSyncStream that waited on the producer_stream.
Returns
ID for last sync. 0 if no sync has occurred between the two streams.
Since
Version 1.23.

◆ KernelDef_GetDomain

const char *( * OrtEpApi::KernelDef_GetDomain) (const OrtKernelDef *kernel_def)

Returns the operator's domain from the kernel definition.

Parameters
[in]kernel_defThe OrtKernelDef instance.
Returns
A null-terminated string representing the operator's domain.
Since
Version 1.24.

◆ KernelDef_GetExecutionProvider

const char *( * OrtEpApi::KernelDef_GetExecutionProvider) (const OrtKernelDef *kernel_def)

Returns the name of the kernel's intended execution provider.

Parameters
[in]kernel_defThe OrtKernelDef instance.
Returns
A null-terminated string representing the name of the execution provider.
Since
Version 1.24.

◆ KernelDef_GetOperatorType

const char *( * OrtEpApi::KernelDef_GetOperatorType) (const OrtKernelDef *kernel_def)

Returns the operator type from the kernel definition.

Parameters
[in]kernel_defThe OrtKernelDef instance.
Returns
A null-terminated string representing the operator type.
Since
Version 1.24.

◆ MemoryDevice_AreEqual

bool( * OrtEpApi::MemoryDevice_AreEqual) (const OrtMemoryDevice *a, const OrtMemoryDevice *b)

Compare two OrtMemoryDevice instances for equality.

This is used to check if two memory devices are the same. Used to implement DataTransferImpl::CanCopy.

Parameters
[in]aThe first OrtMemoryDevice instance to compare.
[in]bThe second OrtMemoryDevice instance to compare.
Returns
True if the two OrtMemoryDevice instances are equal, false otherwise.
Since
Version 1.23.

◆ MemoryDevice_GetDeviceId

uint32_t( * OrtEpApi::MemoryDevice_GetDeviceId) (const OrtMemoryDevice *memory_device)

Get the device ID from an OrtMemoryDevice instance.

Parameters
[in]memory_deviceOrtMemoryDevice instance.
Returns
The device ID.
Since
Version 1.23.

◆ MemoryDevice_GetDeviceType

OrtMemoryInfoDeviceType( * OrtEpApi::MemoryDevice_GetDeviceType) (const OrtMemoryDevice *memory_device)

Get the OrtMemoryInfoDeviceType value from an OrtMemoryDevice instance.

Parameters
[in]memory_deviceOrtMemoryDevice instance.
Returns
The OrtMemoryInfoDeviceType value.
Since
Version 1.23.

◆ MemoryDevice_GetMemoryType

OrtDeviceMemoryType( * OrtEpApi::MemoryDevice_GetMemoryType) (const OrtMemoryDevice *memory_device)

Get the OrtDeviceMemoryType value from an OrtMemoryDevice instance.

Parameters
[in]memory_deviceOrtMemoryDevice instance.
Returns
The OrtDeviceMemoryType value.
Since
Version 1.23.

◆ MemoryDevice_GetVendorId

uint32_t( * OrtEpApi::MemoryDevice_GetVendorId) (const OrtMemoryDevice *memory_device)

Get the vendor ID from an OrtMemoryDevice instance.

The vendor ID is used to identify the vendor of the device, and is typically set to the PCI vendor ID.

If the device is not vendor specific (e.g. CPU memory) the vendor ID is set to 0.

Parameters
[in]memory_deviceOrtMemoryDevice instance.
Returns
The vendor ID value.
Since
Version 1.23.

◆ MemoryInfo_GetMemoryDevice

const OrtMemoryDevice *( * OrtEpApi::MemoryInfo_GetMemoryDevice) (const OrtMemoryInfo *memory_info)

Get the OrtMemoryDevice from an OrtMemoryInfo instance.

This is required for OrtDataTransferImpl (which implements onnxruntime::IDataTransfer) where the OrtMemoryDevice is used in the CanCopy and CopyTensors functions.

Parameters
[in]memory_infoThe OrtMemoryInfo instance to get the memory device from.
Returns
The OrtMemoryDevice associated with the OrtMemoryInfo instance.
Since
Version 1.23.

◆ NodeComputeContext_NodeName

const char *( * OrtEpApi::NodeComputeContext_NodeName) (const OrtNodeComputeContext *context)

Query a OrtNodeComputeContext for the name of the node that encapsulates the compiled/fused node.

Used in OrtNodeComputeInfo::CreateComputeState().

Parameters
[in]contextThe OrtNodeComputeContext instance to query.
Returns
The node's name.
Note
Returned string is owned by ORT and valid only while OrtNodeComputeInfo::CreateComputeState() is called.
Since
Version 1.23.

◆ SyncStream_GetImpl

const OrtSyncStreamImpl *( * OrtEpApi::SyncStream_GetImpl) (const OrtSyncStream *stream)

Get the OrtSyncStreamImpl associated with an OrtSyncStream instance.

This allows an the plugin library to connect its OrtSyncStreamImpl instance with an OrtSyncStream if needed.

Parameters
[in]streamThe OrtSyncStream instance to find an OrtSyncStreamImpl for.
Returns
The associated OrtSyncStreamImpl if found. nullptr otherwise.
Since
Version 1.23.
Remarks
There should always be an OrtSyncStreamImpl associated with an OrtSyncStream instance that the EP gets.

◆ SyncStream_GetSyncId

uint64_t( * OrtEpApi::SyncStream_GetSyncId) (const OrtSyncStream *stream)

Get the current sync ID for a stream.

Parameters
[in]streamThe OrtSyncStream to get the sync ID for.
Returns
Current sync ID.
Since
Version 1.23.

◆ Value_GetMemoryDevice

const OrtMemoryDevice *( * OrtEpApi::Value_GetMemoryDevice) (const OrtValue *value)

Get the OrtMemoryDevice from an OrtValue instance if it contains a Tensor.

Parameters
[in]valueThe OrtValue instance to get the memory device from.
Returns
Memory device if OrtValue contains a Tensor, nullptr otherwise.
Since
Version 1.23.