6#if defined(__DOXYGEN__)
8#include "onnxruntime_c_api.h"
18ORT_RUNTIME_CLASS(EpFactory);
19ORT_RUNTIME_CLASS(EpGraphSupportInfo);
20ORT_RUNTIME_CLASS(MemoryDevice);
21ORT_RUNTIME_CLASS(NodeComputeContext);
23ORT_RUNTIME_CLASS(DataTransferImpl);
24ORT_RUNTIME_CLASS(SyncNotificationImpl);
25ORT_RUNTIME_CLASS(SyncStreamImpl);
27ORT_RUNTIME_CLASS(ExternalResourceImporterImpl);
86ORT_RUNTIME_CLASS(KernelRegistry);
87ORT_RUNTIME_CLASS(KernelDefBuilder);
88ORT_RUNTIME_CLASS(KernelDef);
89ORT_RUNTIME_CLASS(DataType);
90ORT_RUNTIME_CLASS(SharedPrePackedWeightCache);
120 _In_
const OrtMemoryDevice* src_memory_device, _In_
const OrtMemoryDevice* dst_memory_device);
139 _In_reads_(num_tensors)
const OrtValue** src_tensors,
140 _In_reads_(num_tensors)
OrtValue** dst_tensors,
142 _In_
size_t num_tensors);
390 _In_ uint64_t value);
410 _In_ uint64_t value);
492 _In_ OrtNodeComputeContext* compute_context,
493 _Outptr_
void** compute_state);
604 _In_opt_ OrtSharedPrePackedWeightCache* prepacked_weight_cache, _Out_
bool* is_packed);
641 _In_reads_(num_buffers)
const void*
const* buffer_data_ptrs,
642 _In_reads_(num_buffers)
const size_t* buffer_data_sizes,
643 _In_
size_t num_buffers, _In_
int input_index);
659typedef OrtStatus*(ORT_API_CALL* OrtKernelCreateFunc)(_In_
void* kernel_create_func_state,
701 _In_reads_(num_per_iteration_outputs)
const OrtValue*
const* per_iteration_outputs,
702 _In_
size_t num_per_iteration_outputs, _Out_writes_bytes_all_(output_size_in_bytes)
void* output,
703 _In_
size_t output_size_in_bytes);
742 _In_reads_(num_permutation_elems)
const size_t* permutation, _In_
size_t num_permutation_elems,
771 ORT_CLASS_RELEASE(EpDevice);
791 _In_reads_(num_nodes)
const OrtNode*
const* nodes, _In_
size_t num_nodes,
972 _In_ uint32_t vendor_id,
973 _In_ uint32_t device_id,
974 _In_
const char* vendor_name,
978 ORT_CLASS_RELEASE(HardwareDevice);
994 ORT_CLASS_RELEASE(KernelRegistry);
1010 _In_
const OrtKernelDef* kernel_def, _In_ OrtKernelCreateFunc kernel_create_func,
1011 _In_
void* kernel_create_func_state);
1024 ORT_CLASS_RELEASE(KernelDefBuilder);
1036 _In_
const char* op_type);
1062 _In_
int since_version_start, _In_
int since_version_end);
1074 _In_
const char* ep_name);
1115 _In_
const char* arg_name, _In_reads_(num_types)
const OrtDataType*
const* types,
1116 _In_
size_t num_types);
1134 _In_reads_(num_io_indices)
int const* input_indices,
1135 _In_reads_(num_io_indices)
int const* output_indices,
1136 _In_
size_t num_io_indices);
1154 _In_reads_(num_io_indices)
int const* input_indices,
1155 _In_reads_(num_io_indices)
int const* output_indices,
1156 _In_
size_t num_io_indices);
1168 _Outptr_ OrtKernelDef** kernel_def_out);
1170 ORT_CLASS_RELEASE(KernelDef);
1201 _Out_
int* start_version, _Out_
int* end_version);
1248 _Outptr_
const OrtDataType** out);
1266 _In_
const OrtNode* node, _Outptr_result_maybenull_
const OrtKernelDef** out_kernel_def);
1293 _In_ OrtSharedPrePackedWeightCache* prepacked_weight_cache,
1294 _In_reads_(num_buffers)
void** buffer_data_ptrs, _In_reads_(num_buffers)
size_t* buffer_data_sizes,
1295 _In_
size_t num_buffers);
1326 _In_ uint32_t reasons_bitmask,
1327 _In_ int32_t error_code,
1328 _In_opt_z_
const char* notes);
1429 ORT_CLASS_RELEASE(KernelImpl);
1457typedef enum OrtEpDataLayout {
1458 OrtEpDataLayout_NCHW = 0,
1459 OrtEpDataLayout_NHWC,
1461 OrtEpDataLayout_Default = OrtEpDataLayout_NCHW,
1506 _Inout_ OrtEpGraphSupportInfo* graph_support_info);
1549 _In_
const OrtNode** fused_nodes, _In_
size_t count,
1566 _In_
size_t num_node_compute_infos);
1605 _In_z_
const char* domain, _In_z_
const char* op_type,
1606 _In_ OrtEpDataLayout target_data_layout,
1607 _Outptr_
int* should_convert);
1626 _In_reads_(num_options)
const char*
const* option_keys,
1627 _In_reads_(num_options)
const char*
const* option_values,
1628 _In_
size_t num_options);
1694 _In_
const OrtMemoryDevice* memory_device,
1729 _Outptr_result_maybenull_
const OrtKernelRegistry** kernel_registry);
1765typedef OrtStatus* (*CreateEpApiFactoriesFn)(_In_
const char* registered_name, _In_
const OrtApiBase* ort_api_base,
1767 _Inout_
OrtEpFactory** factories, _In_
size_t max_factories,
1768 _Out_
size_t* num_factories);
1837 _In_
size_t num_devices,
1839 _In_
size_t max_ep_devices,
1840 _Out_
size_t* num_ep_devices);
1869 _In_
size_t num_devices,
1928 _In_
size_t num_devices,
1929 _In_
const char* compatibility_info,
1996 _In_
const OrtMemoryDevice* memory_device,
struct OrtMemoryInfo OrtMemoryInfo
Definition onnxruntime_c_api.h:299
struct OrtHardwareDevice OrtHardwareDevice
Definition onnxruntime_c_api.h:331
struct OrtKernelInfo OrtKernelInfo
Definition onnxruntime_c_api.h:459
struct OrtNode OrtNode
Definition onnxruntime_c_api.h:327
OrtMemoryInfoDeviceType
This mimics OrtDevice type constants so they can be returned in the API.
Definition onnxruntime_c_api.h:494
OrtExternalMemoryHandleType
External memory handle type for importing GPU resources.
Definition onnxruntime_c_api.h:981
OrtCompiledModelCompatibility
Definition onnxruntime_c_api.h:1043
struct OrtCustomOpDomain OrtCustomOpDomain
Definition onnxruntime_c_api.h:310
OrtExternalSemaphoreType
External semaphore type for GPU synchronization.
Definition onnxruntime_c_api.h:1006
struct OrtKernelContext OrtKernelContext
Definition onnxruntime_c_api.h:461
struct OrtEpDevice OrtEpDevice
Definition onnxruntime_c_api.h:332
struct OrtRunOptions OrtRunOptions
Definition onnxruntime_c_api.h:303
OrtHardwareDeviceType
Definition onnxruntime_c_api.h:501
struct OrtGraph OrtGraph
Definition onnxruntime_c_api.h:328
struct OrtSyncStream OrtSyncStream
Definition onnxruntime_c_api.h:334
struct OrtSessionOptions OrtSessionOptions
Definition onnxruntime_c_api.h:309
OrtDeviceMemoryType
This matches OrtDevice::MemoryType values.
Definition onnxruntime_c_api.h:487
struct OrtValue OrtValue
Definition onnxruntime_c_api.h:302
struct OrtKeyValuePairs OrtKeyValuePairs
Definition onnxruntime_c_api.h:333
OrtMemType
Memory types for allocated memory, execution provider specific types should be extended in each provi...
Definition onnxruntime_c_api.h:475
struct OrtStatus OrtStatus
Definition onnxruntime_c_api.h:298
struct OrtDeviceEpIncompatibilityDetails OrtDeviceEpIncompatibilityDetails
Definition onnxruntime_c_api.h:339
struct OrtLogger OrtLogger
Definition onnxruntime_c_api.h:323
ONNXTensorElementDataType
Definition onnxruntime_c_api.h:184
Memory allocation interface.
Definition onnxruntime_c_api.h:355
The helper interface to get the right version of OrtApi.
Definition onnxruntime_c_api.h:910
Struct that an EP implements for IDataTransfer to copy between devices it uses and CPU.
Definition onnxruntime_ep_c_api.h:96
OrtStatus * CopyTensors(OrtDataTransferImpl *this_ptr, const OrtValue **src_tensors, OrtValue **dst_tensors, OrtSyncStream **streams, size_t num_tensors)
Copy tensors from src_tensors to dst_tensors using the provided streams.
bool(* CanCopy)(const OrtDataTransferImpl *this_ptr, const OrtMemoryDevice *src_memory_device, const OrtMemoryDevice *dst_memory_device)
Check if the implementation can copy between the source and destination memory devices.
Definition onnxruntime_ep_c_api.h:120
uint32_t ort_version_supported
Must be initialized to ORT_API_VERSION.
Definition onnxruntime_ep_c_api.h:97
void(* Release)(OrtDataTransferImpl *this_ptr)
Release the OrtDataTransferImpl instance.
Definition onnxruntime_ep_c_api.h:108
The OrtEpApi struct provides functions that are relevant to the implementation of an execution provid...
Definition onnxruntime_ep_c_api.h:751
const char *(* KernelDef_GetDomain)(const OrtKernelDef *kernel_def)
Returns the operator's domain from the kernel definition.
Definition onnxruntime_ep_c_api.h:1188
uint32_t(* MemoryDevice_GetVendorId)(const OrtMemoryDevice *memory_device)
Get the vendor ID from an OrtMemoryDevice instance.
Definition onnxruntime_ep_c_api.h:907
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.
Definition onnxruntime_ep_c_api.h:951
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.
OrtMemoryInfoDeviceType(* MemoryDevice_GetDeviceType)(const OrtMemoryDevice *memory_device)
Get the OrtMemoryInfoDeviceType value from an OrtMemoryDevice instance.
Definition onnxruntime_ep_c_api.h:885
const char *(* NodeComputeContext_NodeName)(const OrtNodeComputeContext *context)
Query a OrtNodeComputeContext for the name of the node that encapsulates the compiled/fused node.
Definition onnxruntime_ep_c_api.h:817
OrtStatus * CreateIfKernel(const OrtKernelInfo *kernel_info, OrtKernelImpl **kernel_out)
Creates an OrtKernelImpl instance for an If operator.
bool(* MemoryDevice_AreEqual)(const OrtMemoryDevice *a, const OrtMemoryDevice *b)
Compare two OrtMemoryDevice instances for equality.
Definition onnxruntime_ep_c_api.h:876
const OrtMemoryDevice *(* MemoryInfo_GetMemoryDevice)(const OrtMemoryInfo *memory_info)
Get the OrtMemoryDevice from an OrtMemoryInfo instance.
Definition onnxruntime_ep_c_api.h:854
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_SetExecutionProvider(OrtKernelDefBuilder *kernel_def_builder, const char *ep_name)
Sets the name of the kernel's intended execution provider.
OrtStatus * CreateKernelDefBuilder(OrtKernelDefBuilder **kernel_def_builder_out)
Creates a kernel definition builder used to create instances of OrtKernelDef.
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.
const OrtSyncStreamImpl *(* SyncStream_GetImpl)(const OrtSyncStream *stream)
Get the OrtSyncStreamImpl associated with an OrtSyncStream instance.
Definition onnxruntime_ep_c_api.h:929
OrtStatus * KernelDef_GetInputMemType(const OrtKernelDef *kernel_def, size_t input_index, OrtMemType *mem_type)
Gets the memory type for a kernel input.
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 * CreateLoopKernel(const OrtKernelInfo *kernel_info, OrtLoopKernelHelper *helper, OrtKernelImpl **kernel_out)
Creates an OrtKernelImpl instance for a Loop operator.
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.
OrtStatus * DeviceEpIncompatibilityDetails_SetDetails(OrtDeviceEpIncompatibilityDetails *details, uint32_t reasons_bitmask, int32_t error_code, const char *notes)
Set the details of an OrtDeviceEpIncompatibilityDetails instance.
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 * CreateKernelRegistry(OrtKernelRegistry **kernel_registry)
Creates an empty kernel registry. A kernel registry contains kernel creation information for every op...
uint32_t(* MemoryDevice_GetDeviceId)(const OrtMemoryDevice *memory_device)
Get the device ID from an OrtMemoryDevice instance.
Definition onnxruntime_ep_c_api.h:916
OrtDeviceMemoryType(* MemoryDevice_GetMemoryType)(const OrtMemoryDevice *memory_device)
Get the OrtDeviceMemoryType value from an OrtMemoryDevice instance.
Definition onnxruntime_ep_c_api.h:894
OrtStatus * KernelDefBuilder_SetDomain(OrtKernelDefBuilder *kernel_def_builder, const char *domain)
Sets the kernel's domain.
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 * 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_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 * GetTensorDataType(ONNXTensorElementDataType elem_type, const OrtDataType **out)
Gets the OrtDataType that represents the data type for a tensor of the given element type.
OrtStatus * KernelDefBuilder_SetOperatorType(OrtKernelDefBuilder *kernel_def_builder, const char *op_type)
Sets the kernel's operator type.
const char *(* KernelDef_GetOperatorType)(const OrtKernelDef *kernel_def)
Returns the operator type from the kernel definition.
Definition onnxruntime_ep_c_api.h:1179
OrtStatus * KernelDefBuilder_SetOutputMemType(OrtKernelDefBuilder *kernel_def_builder, size_t output_index, OrtMemType mem_type)
Sets the memory type for a kernel output.
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.
OrtStatus * KernelDefBuilder_Build(OrtKernelDefBuilder *kernel_def_builder, OrtKernelDef **kernel_def_out)
Creates a OrtKernelDef instance from the given kernel definition builder.
const OrtMemoryDevice *(* Value_GetMemoryDevice)(const OrtValue *value)
Get the OrtMemoryDevice from an OrtValue instance if it contains a Tensor.
Definition onnxruntime_ep_c_api.h:863
OrtStatus * KernelDef_GetOutputMemType(const OrtKernelDef *kernel_def, size_t output_index, OrtMemType *mem_type)
Gets the memory type for a kernel output.
OrtStatus * KernelDef_GetSinceVersion(const OrtKernelDef *kernel_def, int *start_version, int *end_version)
Gets the kernel's opset version range that is supported.
OrtStatus * GetEnvConfigEntries(OrtKeyValuePairs **config_entries)
Gets a new OrtKeyValuePairs instance containing a copy of all configuration entries set on the enviro...
OrtStatus * KernelDefBuilder_SetInputMemType(OrtKernelDefBuilder *kernel_def_builder, size_t input_index, OrtMemType mem_type)
Sets the memory type for a kernel input.
const char *(* KernelDef_GetExecutionProvider)(const OrtKernelDef *kernel_def)
Returns the name of the kernel's intended execution provider.
Definition onnxruntime_ep_c_api.h:1210
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 * KernelDefBuilder_SetSinceVersion(OrtKernelDefBuilder *kernel_def_builder, int since_version_start, int since_version_end)
Sets the kernel's opset version range that is supported.
uint64_t(* SyncStream_GetSyncId)(const OrtSyncStream *stream)
Get the current sync ID for a stream.
Definition onnxruntime_ep_c_api.h:938
OrtStatus * EpDevice_AddAllocatorInfo(OrtEpDevice *ep_device, const OrtMemoryInfo *allocator_memory_info)
Register an allocator with the OrtEpDevice.
The OrtEpFactory provides functions to create and manage execution providers.
Definition onnxruntime_ep_c_api.h:1786
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.
bool(* IsStreamAware)(const OrtEpFactory *this_ptr)
Check if execution providers created by the factory are stream aware.
Definition onnxruntime_ep_c_api.h:1979
uint32_t(* GetVendorId)(const OrtEpFactory *this_ptr)
Get the vendor id who owns the execution provider that the factory creates.
Definition onnxruntime_ep_c_api.h:1891
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 about OrtHardwareDevice support.
OrtStatus * GetHardwareDeviceIncompatibilityDetails(OrtEpFactory *this_ptr, const OrtHardwareDevice *hw, OrtDeviceEpIncompatibilityDetails *details)
Check for known incompatibility reasons between a hardware device and this execution provider.
const char *(* GetVendor)(const OrtEpFactory *this_ptr)
Get the name of vendor who owns the execution provider that the factory creates.
Definition onnxruntime_ep_c_api.h:1816
OrtStatus * CreateExternalResourceImporterForDevice(OrtEpFactory *this_ptr, const OrtEpDevice *ep_device, OrtExternalResourceImporterImpl **out_importer)
Create an OrtExternalResourceImporterImpl for external resource import.
OrtStatus * CreateSyncStreamForDevice(OrtEpFactory *this_ptr, const OrtMemoryDevice *memory_device, const OrtKeyValuePairs *stream_options, OrtSyncStreamImpl **stream)
Create a synchronization stream for the given memory device.
OrtStatus * GetNumCustomOpDomains(OrtEpFactory *this_ptr, size_t *num_domains)
Returns the number of OrtCustomOpDomains that this factory provides.
OrtStatus * CreateDataTransfer(OrtEpFactory *this_ptr, OrtDataTransferImpl **data_transfer)
Create an OrtDataTransferImpl instance for the factory.
OrtStatus * ValidateCompiledModelCompatibilityInfo(OrtEpFactory *this_ptr, const OrtHardwareDevice *const *devices, size_t num_devices, const char *compatibility_info, OrtCompiledModelCompatibility *model_compatibility)
Validate the compatibility of a compiled model with the execution provider factory for one or more de...
const char *(* GetVersion)(const OrtEpFactory *this_ptr)
Get the version of the execution provider that the factory creates.
Definition onnxruntime_ep_c_api.h:1905
void(* ReleaseAllocator)(OrtEpFactory *this_ptr, OrtAllocator *allocator)
Release an OrtAllocator created by the factory.
Definition onnxruntime_ep_c_api.h:1955
uint32_t ort_version_supported
The ONNX Runtime version the execution provider was compiled with.
Definition onnxruntime_ep_c_api.h:1794
void(* ReleaseEp)(OrtEpFactory *this_ptr, struct OrtEp *ep)
Release the OrtEp instance.
Definition onnxruntime_ep_c_api.h:1880
OrtStatus * GetCustomOpDomains(OrtEpFactory *this_ptr, OrtCustomOpDomain **domains, size_t num_domains)
Gets the EP-specific OrtCustomOpDomains.
OrtStatus * CreateAllocator(OrtEpFactory *this_ptr, const OrtMemoryInfo *memory_info, const OrtKeyValuePairs *allocator_options, OrtAllocator **allocator)
Create an OrtAllocator that can be shared across sessions for the given OrtMemoryInfo.
const char *(* GetName)(const OrtEpFactory *this_ptr)
Get the name of the execution provider that the factory creates.
Definition onnxruntime_ep_c_api.h:1805
The OrtEp struct provides functions to implement for an execution provider.
Definition onnxruntime_ep_c_api.h:1468
void(* ReleaseNodeComputeInfos)(OrtEp *this_ptr, OrtNodeComputeInfo **node_compute_infos, size_t num_node_compute_infos)
Release OrtNodeComputeInfo instances.
Definition onnxruntime_ep_c_api.h:1566
OrtStatus * GetPreferredDataLayout(OrtEp *this_ptr, OrtEpDataLayout *preferred_data_layout)
Get the EP's preferred data layout.
const char *(* GetCompiledModelCompatibilityInfo)(OrtEp *this_ptr, const OrtGraph *graph)
Get a string with details about the EP stack used to produce a compiled model.
Definition onnxruntime_ep_c_api.h:1713
OrtStatus * CreateAllocator(OrtEp *this_ptr, const OrtMemoryInfo *memory_info, OrtAllocator **allocator)
Create an OrtAllocator for the given OrtMemoryInfo for an OrtSession.
OrtStatus * GetCapability(OrtEp *this_ptr, const OrtGraph *graph, OrtEpGraphSupportInfo *graph_support_info)
Get information about the nodes supported by the OrtEp instance.
OrtStatus * OnRunEnd(OrtEp *this_ptr, const OrtRunOptions *run_options, bool sync_stream)
Called by ORT to notify the EP of the end of a run.
OrtStatus * CreateSyncStreamForDevice(OrtEp *this_ptr, const OrtMemoryDevice *memory_device, OrtSyncStreamImpl **stream)
Create a synchronization stream for the given memory device for an OrtSession.
const char *(* GetName)(const OrtEp *this_ptr)
Get the execution provider name.
Definition onnxruntime_ep_c_api.h:1487
OrtStatus * SetDynamicOptions(OrtEp *this_ptr, const char *const *option_keys, const char *const *option_values, size_t num_options)
Set dynamic options on this EP.
OrtStatus * Compile(OrtEp *this_ptr, const OrtGraph **graphs, const OrtNode **fused_nodes, size_t count, OrtNodeComputeInfo **node_compute_infos, OrtNode **ep_context_nodes)
Compile OrtGraph instances assigned to the OrtEp. Implementer must set a OrtNodeComputeInfo instance ...
uint32_t ort_version_supported
The ONNX Runtime version the execution provider was compiled with.
Definition onnxruntime_ep_c_api.h:1476
OrtStatus * ShouldConvertDataLayoutForOp(OrtEp *this_ptr, const char *domain, const char *op_type, OrtEpDataLayout target_data_layout, int *should_convert)
Given an op with domain domain and type op_type, determine whether an associated node's data layout s...
OrtStatus * OnRunStart(OrtEp *this_ptr, const OrtRunOptions *run_options)
Called by ORT to notify the EP of the start of a run.
OrtStatus * GetKernelRegistry(OrtEp *this_ptr, const OrtKernelRegistry **kernel_registry)
Gets the execution provider's kernel registry, if any.
OrtStatus * IsConcurrentRunSupported(OrtEp *this_ptr, bool *is_supported)
Gets whether the execution provider supports concurrent run calls made on the session.
Descriptor for importing external memory.
Definition onnxruntime_c_api.h:993
Base struct for imported external memory handles.
Definition onnxruntime_ep_c_api.h:45
const OrtEpDevice * ep_device
EP device that created this handle.
Definition onnxruntime_ep_c_api.h:47
void(* Release)(OrtExternalMemoryHandle *handle)
Release callback for this handle. EP sets this to its release function.
Definition onnxruntime_ep_c_api.h:55
OrtExternalMemoryDescriptor descriptor
External memory descriptor.
Definition onnxruntime_ep_c_api.h:48
uint32_t version
Must be ORT_API_VERSION.
Definition onnxruntime_ep_c_api.h:46
Struct that an EP implements for external resource import (memory + semaphore import).
Definition onnxruntime_ep_c_api.h:260
void(* ReleaseSemaphore)(OrtExternalResourceImporterImpl *this_ptr, OrtExternalSemaphoreHandle *handle)
Release an imported external semaphore handle.
Definition onnxruntime_ep_c_api.h:370
OrtStatus * ImportSemaphore(OrtExternalResourceImporterImpl *this_ptr, const OrtExternalSemaphoreDescriptor *desc, OrtExternalSemaphoreHandle **out_handle)
Import an external semaphore.
uint32_t ort_version_supported
Must be initialized to ORT_API_VERSION.
Definition onnxruntime_ep_c_api.h:261
OrtStatus * SignalSemaphore(OrtExternalResourceImporterImpl *this_ptr, OrtExternalSemaphoreHandle *handle, OrtSyncStream *stream, uint64_t value)
Signal an external semaphore from the EP's stream.
OrtStatus * ImportMemory(OrtExternalResourceImporterImpl *this_ptr, const OrtExternalMemoryDescriptor *desc, OrtExternalMemoryHandle **out_handle)
Import external memory.
void(* Release)(OrtExternalResourceImporterImpl *this_ptr)
Release the OrtExternalResourceImporterImpl instance.
Definition onnxruntime_ep_c_api.h:423
OrtStatus * CreateTensorFromMemory(OrtExternalResourceImporterImpl *this_ptr, const OrtExternalMemoryHandle *mem_handle, const OrtExternalTensorDescriptor *tensor_desc, OrtValue **out_tensor)
Create a tensor backed by imported external memory.
void(* ReleaseMemory)(OrtExternalResourceImporterImpl *this_ptr, OrtExternalMemoryHandle *handle)
Release an imported external memory handle.
Definition onnxruntime_ep_c_api.h:306
bool(* CanImportMemory)(const OrtExternalResourceImporterImpl *this_ptr, OrtExternalMemoryHandleType handle_type)
Check if the implementation can import external memory of the given handle type.
Definition onnxruntime_ep_c_api.h:275
bool(* CanImportSemaphore)(const OrtExternalResourceImporterImpl *this_ptr, OrtExternalSemaphoreType type)
Check if the implementation can import external semaphores of the given type.
Definition onnxruntime_ep_c_api.h:339
OrtStatus * WaitSemaphore(OrtExternalResourceImporterImpl *this_ptr, OrtExternalSemaphoreHandle *handle, OrtSyncStream *stream, uint64_t value)
Wait on an external semaphore on the EP's stream.
Descriptor for importing external semaphores.
Definition onnxruntime_c_api.h:1017
Base struct for imported external semaphore handles.
Definition onnxruntime_ep_c_api.h:72
OrtExternalSemaphoreDescriptor descriptor
External semaphore descriptor.
Definition onnxruntime_ep_c_api.h:75
uint32_t version
Must be ORT_API_VERSION.
Definition onnxruntime_ep_c_api.h:73
void(* Release)(OrtExternalSemaphoreHandle *handle)
Release callback for this handle. EP sets this to its release function.
Definition onnxruntime_ep_c_api.h:82
const OrtEpDevice * ep_device
EP device that created this handle.
Definition onnxruntime_ep_c_api.h:74
Descriptor for creating a tensor from imported external memory.
Definition onnxruntime_c_api.h:1030
Contains functions that an OrtEp implements to specify the computation for an operator kernel.
Definition onnxruntime_ep_c_api.h:523
uint32_t ort_version_supported
Must be initialized to ORT_API_VERSION.
Definition onnxruntime_ep_c_api.h:524
OrtStatus * Compute(OrtKernelImpl *this_ptr, OrtKernelContext *context)
Computation function called to execute the kernel on an EP.
OrtStatus * SetSharedPrePackedWeight(OrtKernelImpl *this_ptr, const void *const *buffer_data_ptrs, const size_t *buffer_data_sizes, size_t num_buffers, int input_index)
Optional function that receives data for a shared pre-packed weight from ORT.
OrtStatus * PrePackWeight(OrtKernelImpl *this_ptr, const OrtValue *tensor, int input_index, OrtAllocator *allocator, OrtSharedPrePackedWeightCache *prepacked_weight_cache, bool *is_packed)
Optional function to pre-pack a constant tensor (i.e., a weight) to the kernel's preferred data layou...
uint32_t flags
EP must initialize to 0. Used internally by ORT.
Definition onnxruntime_ep_c_api.h:525
void(* Release)(OrtKernelImpl *this_ptr)
Called by ORT to release the OrtKernelImpl instance and its resources.
Definition onnxruntime_ep_c_api.h:548
Contains helper functions for a Loop OrtKernelImpl created via OrtEpApi::CreateLoopKernel.
Definition onnxruntime_ep_c_api.h:670
void(* Release)(OrtLoopKernelHelper *this_ptr)
Called by ORT to release the OrtLoopKernelHelper instance and its resources.
Definition onnxruntime_ep_c_api.h:679
uint32_t ort_version_supported
Must be initialized to ORT_API_VERSION.
Definition onnxruntime_ep_c_api.h:671
OrtStatus * ConcatOutput(OrtLoopKernelHelper *this_ptr, void *stream_handle, const OrtValue *const *per_iteration_outputs, size_t num_per_iteration_outputs, void *output, size_t output_size_in_bytes)
Helper function that concatenates OrtValue instances from each loop iteration into a single pre-alloc...
The OrtNodeComputeInfo struct provides functions that an OrtEp implements to specify the compute func...
Definition onnxruntime_ep_c_api.h:469
OrtStatus *(* Compute)(OrtNodeComputeInfo *this_ptr, void *compute_state, OrtKernelContext *kernel_context)
Computation function called to execute the fused node compiled by an OrtEp instance.
Definition onnxruntime_ep_c_api.h:504
uint32_t ort_version_supported
The ONNX Runtime version the OrtNodeComputeInfo was compiled with.
Definition onnxruntime_ep_c_api.h:477
OrtStatus *(* CreateState)(OrtNodeComputeInfo *this_ptr, OrtNodeComputeContext *compute_context, void **compute_state)
Creates an opaque compute state object that is then passed to the Compute() function during inference...
Definition onnxruntime_ep_c_api.h:491
void(* ReleaseState)(OrtNodeComputeInfo *this_ptr, void *compute_state)
Releases the compute state returned by CreateState().
Definition onnxruntime_ep_c_api.h:513
The OrtNodeFusionOptions struct specifies options for fusing nodes supported by an execution provider...
Definition onnxruntime_ep_c_api.h:439
uint32_t ort_version_supported
The ONNX Runtime version the OrtNodeFusionOptions was compiled with.
Definition onnxruntime_ep_c_api.h:447
bool drop_constant_initializers
If set to true, specify that the execution provider does not require ONNX Runtime to provide constant...
Definition onnxruntime_ep_c_api.h:459
Contains helper functions for a Scan OrtKernelImpl created via OrtEpApi::CreateScanKernel.
Definition onnxruntime_ep_c_api.h:713
OrtStatus * Transpose(OrtScanKernelHelper *this_ptr, const size_t *permutation, size_t num_permutation_elems, const OrtValue *input, OrtSyncStream *stream, OrtValue *output)
Helper function that transposes an OrtValue instance during execution of a Scan kernel.
uint32_t ort_version_supported
Must be initialized to ORT_API_VERSION.
Definition onnxruntime_ep_c_api.h:714
void(* Release)(OrtScanKernelHelper *this_ptr)
Called by ORT to release the OrtScanKernelHelper instance and its resources.
Definition onnxruntime_ep_c_api.h:722
Struct that an EP implements for Stream Notifications.
Definition onnxruntime_ep_c_api.h:149
OrtStatus * WaitOnDevice(OrtSyncNotificationImpl *this_ptr, OrtSyncStream *consumer_stream)
Wait for a device to device operation to complete.
uint32_t ort_version_supported
Must be initialized to ORT_API_VERSION.
Definition onnxruntime_ep_c_api.h:150
OrtStatus * Activate(OrtSyncNotificationImpl *this_ptr)
Called by ORT to activate the notification.
OrtStatus * WaitOnHost(OrtSyncNotificationImpl *this_ptr)
Wait for a device to host operation to complete.
void(* Release)(OrtSyncNotificationImpl *this_ptr)
Release the OrtSyncNotificationImpl instance.
Definition onnxruntime_ep_c_api.h:161
Struct that an EP implements if it wishes to implement Stream support.
Definition onnxruntime_ep_c_api.h:195
void *(* GetHandle)(OrtSyncStreamImpl *this_ptr)
Get the handle of the stream.
Definition onnxruntime_ep_c_api.h:218
uint32_t ort_version_supported
Must be initialized to ORT_API_VERSION.
Definition onnxruntime_ep_c_api.h:196
OrtStatus * Flush(OrtSyncStreamImpl *this_ptr)
Flush the stream.
OrtStatus * CreateNotification(OrtSyncStreamImpl *this_ptr, OrtSyncNotificationImpl **notification)
Create an OrtSyncNotificationImpl for the OrtSyncStreamImpl instance.
OrtStatus * OnSessionRunEnd(OrtSyncStreamImpl *this_ptr)
Notify the stream that a session run has ended.
void(* Release)(OrtSyncStreamImpl *this_ptr)
Release the OrtSyncStreamImpl instance.
Definition onnxruntime_ep_c_api.h:207