![]() |
ONNX Runtime
|
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 | |
| OrtStatus * | 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. | |
| void | ReleaseEpDevice (OrtEpDevice *input) |
| OrtStatus * | 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. | |
| OrtStatus * | 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. | |
| OrtStatus * | EpDevice_AddAllocatorInfo (OrtEpDevice *ep_device, const OrtMemoryInfo *allocator_memory_info) |
| Register an allocator with the OrtEpDevice. | |
| OrtStatus * | CreateHardwareDevice (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) |
| OrtStatus * | CreateKernelRegistry (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) |
| OrtStatus * | 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. | |
| OrtStatus * | CreateKernelDefBuilder (OrtKernelDefBuilder **kernel_def_builder_out) |
| Creates a kernel definition builder used to create instances of OrtKernelDef. | |
| void | ReleaseKernelDefBuilder (OrtKernelDefBuilder *input) |
| OrtStatus * | KernelDefBuilder_SetOperatorType (OrtKernelDefBuilder *kernel_def_builder, const char *op_type) |
| Sets the kernel's operator type. | |
| OrtStatus * | KernelDefBuilder_SetDomain (OrtKernelDefBuilder *kernel_def_builder, const char *domain) |
| Sets the kernel's domain. | |
| OrtStatus * | KernelDefBuilder_SetSinceVersion (OrtKernelDefBuilder *kernel_def_builder, int since_version_start, int since_version_end) |
| Sets the kernel's opset version range that is supported. | |
| OrtStatus * | KernelDefBuilder_SetExecutionProvider (OrtKernelDefBuilder *kernel_def_builder, const char *ep_name) |
| Sets the name of the kernel's intended execution provider. | |
| OrtStatus * | KernelDefBuilder_SetInputMemType (OrtKernelDefBuilder *kernel_def_builder, size_t input_index, OrtMemType mem_type) |
| Sets the memory type for a kernel input. | |
| OrtStatus * | KernelDefBuilder_SetOutputMemType (OrtKernelDefBuilder *kernel_def_builder, size_t output_index, OrtMemType mem_type) |
| Sets the memory type for a kernel output. | |
| OrtStatus * | 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"). | |
| OrtStatus * | 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. | |
| OrtStatus * | 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. | |
| OrtStatus * | KernelDefBuilder_Build (OrtKernelDefBuilder *kernel_def_builder, OrtKernelDef **kernel_def_out) |
| Creates a OrtKernelDef instance from the given kernel definition builder. | |
| void | ReleaseKernelDef (OrtKernelDef *input) |
| OrtStatus * | KernelDef_GetSinceVersion (const OrtKernelDef *kernel_def, int *start_version, int *end_version) |
| Gets the kernel's opset version range that is supported. | |
| OrtStatus * | KernelDef_GetInputMemType (const OrtKernelDef *kernel_def, size_t input_index, OrtMemType *mem_type) |
| Gets the memory type for a kernel input. | |
| OrtStatus * | KernelDef_GetOutputMemType (const OrtKernelDef *kernel_def, size_t output_index, OrtMemType *mem_type) |
| Gets the memory type for a kernel output. | |
| OrtStatus * | GetTensorDataType (ONNXTensorElementDataType elem_type, const OrtDataType **out) |
| Gets the OrtDataType that represents the data type for a tensor of the given element type. | |
| OrtStatus * | 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. | |
| OrtStatus * | 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. | |
| OrtStatus * | KernelInfo_GetEp (const OrtKernelInfo *info, const OrtEp **ep) |
| Get the OrtEp instance to which the node is assigned from the OrtKernelInfo. | |
| OrtStatus * | DeviceEpIncompatibilityDetails_SetDetails (OrtDeviceEpIncompatibilityDetails *details, uint32_t reasons_bitmask, int32_t error_code, const char *notes) |
| Set the details of an OrtDeviceEpIncompatibilityDetails instance. | |
| OrtStatus * | CreateIfKernel (const OrtKernelInfo *kernel_info, OrtKernelImpl **kernel_out) |
| Creates an OrtKernelImpl instance for an If operator. | |
| OrtStatus * | CreateLoopKernel (const OrtKernelInfo *kernel_info, OrtLoopKernelHelper *helper, OrtKernelImpl **kernel_out) |
| Creates an OrtKernelImpl instance for a Loop operator. | |
| OrtStatus * | 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. | |
| void | ReleaseKernelImpl (OrtKernelImpl *input) |
| OrtStatus * | GetEnvConfigEntries (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. | |
The OrtEpApi struct provides functions that are relevant to the implementation of an execution provider.
| 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.
| [in] | ep_factory | Execution provider factory that is creating the instance. |
| [in] | hardware_device | Hardware device that the EP can utilize. |
| [in] | ep_metadata | Optional 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_options | Optional 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_device | OrtExecutionDevice that is created. |
| 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.
| [in] | type | The hardware device type. |
| [in] | vendor_id | The hardware device's vendor identifier. |
| [in] | device_id | The hardware device's identifier. |
| [in] | vendor_name | The hardware device's vendor name as a null-terminated string. Copied by ORT. |
| [in] | metadata | Optional 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_device | Output parameter set to the new OrtHardwareDevice instance that is created. Must be release with ReleaseHardwareDevice(). |
| 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();
| [in] | kernel_info | The OrtKernelInfo instance for an If node. This function returns error ORT_FAIL if the opset version specified by kernel_info is unsupported. |
| [out] | kernel_out | Output 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()). |
| OrtStatus * OrtEpApi::CreateKernelDefBuilder | ( | OrtKernelDefBuilder ** | kernel_def_builder_out | ) |
Creates a kernel definition builder used to create instances of OrtKernelDef.
| [out] | kernel_def_builder_out | Output parameter set to the new OrtKernelDefBuilder instance. Must be released with OrtEpApi::ReleaseKernelDefBuilder(). |
| 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.
| [out] | kernel_registry | Output parameter set to the new OrtKernelRegistry instance. Must be released with OrtEpApi::ReleaseKernelRegistry. |
| 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();
| [in] | kernel_info | The OrtKernelInfo instance for a Loop node. This function returns error ORT_FAIL if the opset version specified by kernel_info is unsupported. |
| [in] | helper | A 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_out | Output 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()). |
| 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();
| [in] | kernel_info | The OrtKernelInfo instance for a Scan node. This function returns error ORT_FAIL if the opset version specified by kernel_info is unsupported. |
| [in] | helper | A 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_out | Output 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()). |
| 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.
| [in,out] | details | The OrtDeviceEpIncompatibilityDetails instance to update. |
| [in] | reasons_bitmask | Bitmask of OrtDeviceEpIncompatibilityReason values. (0 = no incompatibility). |
| [in] | error_code | Optional EP-specific error code (0 = no error). |
| [in] | notes | Optional human-readable notes. Can be null. |
| 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:
| [in] | ep_device | The OrtEpDevice instance to register the OrtMemoryInfo with. |
| [in] | allocator_memory_info | The OrtMemoryInfo information for the allocator. |
| 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.
| [in] | graph_support_info | OrtEpGraphSupportInfo instance to which to add the supported nodes. |
| [in] | nodes | Array of nodes supported by the EP that should be fused/compiled. |
| [in] | num_nodes | The number of supported nodes. |
| [in] | node_fusion_options | Optional node fusion options. Ignored if set to NULL. |
| 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.
| [in] | graph_support_info | OrtEpGraphSupportInfo instance to which to add the supported node. |
| [in] | node | The supported OrtNode instance. |
| 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.
| [in] | graph_support_info | The OrtEpGraphSupportInfo instance to query. |
| [in] | node | The node for which to look up a kernel definition. |
| [out] | out_kernel_def | Output parameter set to the OrtKernelDef or NULL. Owned by ORT and must not be released. |
| OrtStatus * OrtEpApi::GetEnvConfigEntries | ( | OrtKeyValuePairs ** | config_entries | ) |
Gets a new OrtKeyValuePairs instance containing a copy of all configuration entries set on the environment.
| [out] | config_entries | Output parameter set to the OrtKeyValuePairs instance containing all configuration entries. Must be released via OrtApi::ReleaseKeyValuePairs. |
| 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.
| [in] | elem_type | The tensor's element type. |
| [out] | out | Output parameter set to the OrtDataType. Owned by ORT and must not be released. |
| OrtStatus * OrtEpApi::KernelDef_GetInputMemType | ( | const OrtKernelDef * | kernel_def, |
| size_t | input_index, | ||
| OrtMemType * | mem_type | ||
| ) |
Gets the memory type for a kernel input.
| [in] | kernel_def | The OrtKernelDef instance. |
| [in] | input_index | The index of the input. |
| [out] | mem_type | Output parameter set to the input's memory type. |
| OrtStatus * OrtEpApi::KernelDef_GetOutputMemType | ( | const OrtKernelDef * | kernel_def, |
| size_t | output_index, | ||
| OrtMemType * | mem_type | ||
| ) |
Gets the memory type for a kernel output.
| [in] | kernel_def | The OrtKernelDef instance. |
| [in] | output_index | The index of the output. |
| [out] | mem_type | Output parameter set to the output's memory type. |
| OrtStatus * OrtEpApi::KernelDef_GetSinceVersion | ( | const OrtKernelDef * | kernel_def, |
| int * | start_version, | ||
| int * | end_version | ||
| ) |
Gets the kernel's opset version range that is supported.
| [in] | kernel_def | The OrtKernelDef instance. |
| [out] | start_version | Output parameter set to the starting opset version that is supported. |
| [out] | end_version | Output parameter set to the ending opset version (inclusive) that is supported. |
| 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.
| [in] | kernel_def_builder | The OrtKernelDefBuilder instance. |
| [in] | input_indices | Array of input indices. Array must contain num_io_indices elements. |
| [in] | output_indices | Array 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_indices | The number of input/output index pairs to alias. |
| 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.
| [in] | kernel_def_builder | The OrtKernelDefBuilder instance. |
| [in] | input_indices | Array of input indices. Array must contain num_io_indices elements. |
| [in] | output_indices | Array 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_indices | The number of input/output index pairs to alias. |
| 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").
| [in] | kernel_def_builder | The OrtKernelDefBuilder instance. |
| [in] | arg_name | A null-terminated string representing the argument to constrain (e.g., "T"). |
| [in] | types | Array of OrtDataType instances representing allowed types for the argument. Must contain num_types elements. |
| [in] | num_types | The number of OrtDataType elements in the types array. |
| OrtStatus * OrtEpApi::KernelDefBuilder_Build | ( | OrtKernelDefBuilder * | kernel_def_builder, |
| OrtKernelDef ** | kernel_def_out | ||
| ) |
Creates a OrtKernelDef instance from the given kernel definition builder.
| [in] | kernel_def_builder | The OrtKernelDefBuilder instance. |
| [out] | kernel_def_out | The new OrtKernelDef instance. |
| OrtStatus * OrtEpApi::KernelDefBuilder_SetDomain | ( | OrtKernelDefBuilder * | kernel_def_builder, |
| const char * | domain | ||
| ) |
Sets the kernel's domain.
| [in] | kernel_def_builder | The OrtKernelDefBuilder instance. |
| [in] | domain | A null-terminated string representing the operator's domain. |
| OrtStatus * OrtEpApi::KernelDefBuilder_SetExecutionProvider | ( | OrtKernelDefBuilder * | kernel_def_builder, |
| const char * | ep_name | ||
| ) |
Sets the name of the kernel's intended execution provider.
| [in] | kernel_def_builder | The OrtKernelDefBuilder instance. |
| [in] | ep_name | A null-terminated string representing the execution provider's name. |
| OrtStatus * OrtEpApi::KernelDefBuilder_SetInputMemType | ( | OrtKernelDefBuilder * | kernel_def_builder, |
| size_t | input_index, | ||
| OrtMemType | mem_type | ||
| ) |
Sets the memory type for a kernel input.
| [in] | kernel_def_builder | The OrtKernelDefBuilder instance. |
| [in] | input_index | The index of the input. |
| [in] | mem_type | The input's memory type. |
| OrtStatus * OrtEpApi::KernelDefBuilder_SetOperatorType | ( | OrtKernelDefBuilder * | kernel_def_builder, |
| const char * | op_type | ||
| ) |
Sets the kernel's operator type.
| [in] | kernel_def_builder | The OrtKernelDefBuilder instance. |
| [in] | op_type | A null-terminated string representing the operator type. |
| OrtStatus * OrtEpApi::KernelDefBuilder_SetOutputMemType | ( | OrtKernelDefBuilder * | kernel_def_builder, |
| size_t | output_index, | ||
| OrtMemType | mem_type | ||
| ) |
Sets the memory type for a kernel output.
| [in] | kernel_def_builder | The OrtKernelDefBuilder instance. |
| [in] | output_index | The index of the output. |
| [in] | mem_type | The output's memory type. |
| 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.
| [in] | kernel_def_builder | The OrtKernelDefBuilder instance. |
| [in] | since_version_start | The starting opset version that is supported. |
| [in] | since_version_end | The ending opset version (inclusive) that is supported. Can be set equal to the starting version to indicate that only one version is supported. |
| OrtStatus * OrtEpApi::KernelInfo_GetEp | ( | const OrtKernelInfo * | info, |
| const OrtEp ** | ep | ||
| ) |
Get the OrtEp instance to which the node is assigned from the OrtKernelInfo.
| [in] | info | The OrtKernelInfo instance. |
| [out] | ep | Output parameter set to the OrtEp instance associated with the OrtKernelInfo. |
| 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.
| [in] | kernel_registry | The OrtKernelRegistry instance. |
| [in] | kernel_def | The kernel definition, which includes operator type, version, EP name, type constraints, etc. |
| [in] | kernel_create_func | Function that creates an instance of the operator kernel as a OrtKernelImpl instance. |
| [in] | kernel_create_func_state | Custom state passed to the kernel creation function. Can be null. |
| void OrtEpApi::ReleaseEpDevice | ( | OrtEpDevice * | input | ) |
| void OrtEpApi::ReleaseHardwareDevice | ( | OrtHardwareDevice * | input | ) |
| void OrtEpApi::ReleaseKernelDef | ( | OrtKernelDef * | input | ) |
| void OrtEpApi::ReleaseKernelDefBuilder | ( | OrtKernelDefBuilder * | input | ) |
| void OrtEpApi::ReleaseKernelImpl | ( | OrtKernelImpl * | input | ) |
| void OrtEpApi::ReleaseKernelRegistry | ( | OrtKernelRegistry * | input | ) |
| 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.
| [in] | prepacked_weight_cache | The OrtSharedPrePackedWeightCache instance. |
| [in] | buffer_data_ptrs | An 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_sizes | An array of buffer byte sizes, one per element in buffer_data_ptrs. |
| [in] | num_buffers | The 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. |
| 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.
| [in] | producer_stream | The OrtSyncStream that produced the data. |
| [in] | consumer_stream | The OrtSyncStream that waited on the producer_stream. |
| const char *( * OrtEpApi::KernelDef_GetDomain) (const OrtKernelDef *kernel_def) |
Returns the operator's domain from the kernel definition.
| [in] | kernel_def | The OrtKernelDef instance. |
| const char *( * OrtEpApi::KernelDef_GetExecutionProvider) (const OrtKernelDef *kernel_def) |
Returns the name of the kernel's intended execution provider.
| [in] | kernel_def | The OrtKernelDef instance. |
| const char *( * OrtEpApi::KernelDef_GetOperatorType) (const OrtKernelDef *kernel_def) |
Returns the operator type from the kernel definition.
| [in] | kernel_def | The OrtKernelDef instance. |
| 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.
| [in] | a | The first OrtMemoryDevice instance to compare. |
| [in] | b | The second OrtMemoryDevice instance to compare. |
| uint32_t( * OrtEpApi::MemoryDevice_GetDeviceId) (const OrtMemoryDevice *memory_device) |
Get the device ID from an OrtMemoryDevice instance.
| [in] | memory_device | OrtMemoryDevice instance. |
| OrtMemoryInfoDeviceType( * OrtEpApi::MemoryDevice_GetDeviceType) (const OrtMemoryDevice *memory_device) |
Get the OrtMemoryInfoDeviceType value from an OrtMemoryDevice instance.
| [in] | memory_device | OrtMemoryDevice instance. |
| OrtDeviceMemoryType( * OrtEpApi::MemoryDevice_GetMemoryType) (const OrtMemoryDevice *memory_device) |
Get the OrtDeviceMemoryType value from an OrtMemoryDevice instance.
| [in] | memory_device | OrtMemoryDevice instance. |
| 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.
| [in] | memory_device | OrtMemoryDevice instance. |
| 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.
| [in] | memory_info | The OrtMemoryInfo instance to get the memory device from. |
| 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().
| [in] | context | The OrtNodeComputeContext instance to query. |
| 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.
| [in] | stream | The OrtSyncStream instance to find an OrtSyncStreamImpl for. |
| uint64_t( * OrtEpApi::SyncStream_GetSyncId) (const OrtSyncStream *stream) |
Get the current sync ID for a stream.
| [in] | stream | The OrtSyncStream to get the sync ID for. |
| const OrtMemoryDevice *( * OrtEpApi::Value_GetMemoryDevice) (const OrtValue *value) |
Get the OrtMemoryDevice from an OrtValue instance if it contains a Tensor.
| [in] | value | The OrtValue instance to get the memory device from. |