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);
55 _In_
const OrtMemoryDevice* src_memory_device, _In_
const OrtMemoryDevice* dst_memory_device);
74 _In_reads_(num_tensors)
const OrtValue** src_tensors,
75 _In_reads_(num_tensors)
OrtValue** dst_tensors,
77 _In_
size_t num_tensors);
253 _In_ OrtNodeComputeContext* compute_context,
254 _Outptr_
void** compute_state);
302 ORT_CLASS_RELEASE(EpDevice);
322 _In_reads_(num_nodes)
const OrtNode*
const* nodes, _In_
size_t num_nodes,
503 _In_ uint32_t vendor_id,
504 _In_ uint32_t device_id,
505 _In_
const char* vendor_name,
509 ORT_CLASS_RELEASE(HardwareDevice);
520typedef enum OrtEpDataLayout {
521 OrtEpDataLayout_NCHW = 0,
522 OrtEpDataLayout_NHWC,
524 OrtEpDataLayout_Default = OrtEpDataLayout_NCHW,
569 _Inout_ OrtEpGraphSupportInfo* graph_support_info);
609 _In_
const OrtNode** fused_nodes, _In_
size_t count,
611 _Out_writes_(count)
OrtNode** ep_context_nodes);
623 _In_
size_t num_node_compute_infos);
662 _In_z_
const char* domain, _In_z_
const char* op_type,
663 _In_ OrtEpDataLayout target_data_layout,
664 _Outptr_
int* should_convert);
683 _In_reads_(num_options)
const char*
const* option_keys,
684 _In_reads_(num_options)
const char*
const* option_values,
685 _In_
size_t num_options);
751 _In_
const OrtMemoryDevice* memory_device,
792typedef OrtStatus* (*CreateEpApiFactoriesFn)(_In_
const char* registered_name, _In_
const OrtApiBase* ort_api_base,
794 _Inout_
OrtEpFactory** factories, _In_
size_t max_factories,
795 _Out_
size_t* num_factories);
864 _In_
size_t num_devices,
866 _In_
size_t max_ep_devices,
867 _Out_
size_t* num_ep_devices);
896 _In_
size_t num_devices,
955 _In_
size_t num_devices,
956 _In_
const char* compatibility_info,
1023 _In_
const OrtMemoryDevice* memory_device,
struct OrtMemoryInfo OrtMemoryInfo
Definition onnxruntime_c_api.h:296
struct OrtHardwareDevice OrtHardwareDevice
Definition onnxruntime_c_api.h:328
struct OrtNode OrtNode
Definition onnxruntime_c_api.h:324
OrtMemoryInfoDeviceType
This mimics OrtDevice type constants so they can be returned in the API.
Definition onnxruntime_c_api.h:485
OrtCompiledModelCompatibility
The C API.
Definition onnxruntime_c_api.h:961
struct OrtKernelContext OrtKernelContext
Definition onnxruntime_c_api.h:452
struct OrtEpDevice OrtEpDevice
Definition onnxruntime_c_api.h:329
struct OrtRunOptions OrtRunOptions
Definition onnxruntime_c_api.h:300
OrtHardwareDeviceType
Definition onnxruntime_c_api.h:492
struct OrtGraph OrtGraph
Definition onnxruntime_c_api.h:325
struct OrtSyncStream OrtSyncStream
Definition onnxruntime_c_api.h:331
struct OrtSessionOptions OrtSessionOptions
Definition onnxruntime_c_api.h:306
OrtDeviceMemoryType
This matches OrtDevice::MemoryType values.
Definition onnxruntime_c_api.h:478
struct OrtValue OrtValue
Definition onnxruntime_c_api.h:299
struct OrtKeyValuePairs OrtKeyValuePairs
Definition onnxruntime_c_api.h:330
struct OrtStatus OrtStatus
Definition onnxruntime_c_api.h:295
struct OrtLogger OrtLogger
Definition onnxruntime_c_api.h:320
Memory allocation interface.
Definition onnxruntime_c_api.h:346
The helper interface to get the right version of OrtApi.
Definition onnxruntime_c_api.h:888
Struct that an EP implements for IDataTransfer to copy between devices it uses and CPU.
Definition onnxruntime_ep_c_api.h:31
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:55
uint32_t ort_version_supported
Must be initialized to ORT_API_VERSION.
Definition onnxruntime_ep_c_api.h:32
void(* Release)(OrtDataTransferImpl *this_ptr)
Release the OrtDataTransferImpl instance.
Definition onnxruntime_ep_c_api.h:43
The OrtEpApi struct provides functions that are relevant to the implementation of an execution provid...
Definition onnxruntime_ep_c_api.h:282
uint32_t(* MemoryDevice_GetVendorId)(const OrtMemoryDevice *memory_device)
Get the vendor ID from an OrtMemoryDevice instance.
Definition onnxruntime_ep_c_api.h:438
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:482
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:416
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:348
bool(* MemoryDevice_AreEqual)(const OrtMemoryDevice *a, const OrtMemoryDevice *b)
Compare two OrtMemoryDevice instances for equality.
Definition onnxruntime_ep_c_api.h:407
const OrtMemoryDevice *(* MemoryInfo_GetMemoryDevice)(const OrtMemoryInfo *memory_info)
Get the OrtMemoryDevice from an OrtMemoryInfo instance.
Definition onnxruntime_ep_c_api.h:385
const OrtSyncStreamImpl *(* SyncStream_GetImpl)(const OrtSyncStream *stream)
Get the OrtSyncStreamImpl associated with an OrtSyncStream instance.
Definition onnxruntime_ep_c_api.h:460
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 * 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.
uint32_t(* MemoryDevice_GetDeviceId)(const OrtMemoryDevice *memory_device)
Get the device ID from an OrtMemoryDevice instance.
Definition onnxruntime_ep_c_api.h:447
OrtDeviceMemoryType(* MemoryDevice_GetMemoryType)(const OrtMemoryDevice *memory_device)
Get the OrtDeviceMemoryType value from an OrtMemoryDevice instance.
Definition onnxruntime_ep_c_api.h:425
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.
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:394
uint64_t(* SyncStream_GetSyncId)(const OrtSyncStream *stream)
Get the current sync ID for a stream.
Definition onnxruntime_ep_c_api.h:469
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:813
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:1006
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:918
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.
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:843
OrtStatus * SetEnvironmentOptions(OrtEpFactory *this_ptr, const OrtKeyValuePairs *options)
Set environment options on this EP factory.
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 * 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:932
void(* ReleaseAllocator)(OrtEpFactory *this_ptr, OrtAllocator *allocator)
Release an OrtAllocator created by the factory.
Definition onnxruntime_ep_c_api.h:982
uint32_t ort_version_supported
The ONNX Runtime version the execution provider was compiled with.
Definition onnxruntime_ep_c_api.h:821
void(* ReleaseEp)(OrtEpFactory *this_ptr, struct OrtEp *ep)
Release the OrtEp instance.
Definition onnxruntime_ep_c_api.h:907
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:832
The OrtEp struct provides functions to implement for an execution provider.
Definition onnxruntime_ep_c_api.h:531
void(* ReleaseNodeComputeInfos)(OrtEp *this_ptr, OrtNodeComputeInfo **node_compute_infos, size_t num_node_compute_infos)
Release OrtNodeComputeInfo instances.
Definition onnxruntime_ep_c_api.h:623
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:770
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:550
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:539
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.
The OrtNodeComputeInfo struct provides functions that an OrtEp implements to specify the compute func...
Definition onnxruntime_ep_c_api.h:230
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:265
uint32_t ort_version_supported
The ONNX Runtime version the OrtNodeComputeInfo was compiled with.
Definition onnxruntime_ep_c_api.h:238
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:252
void(* ReleaseState)(OrtNodeComputeInfo *this_ptr, void *compute_state)
Releases the compute state returned by CreateState().
Definition onnxruntime_ep_c_api.h:274
The OrtNodeFusionOptions struct specifies options for fusing nodes supported by an execution provider...
Definition onnxruntime_ep_c_api.h:200
uint32_t ort_version_supported
The ONNX Runtime version the OrtNodeFusionOptions was compiled with.
Definition onnxruntime_ep_c_api.h:208
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:220
Struct that an EP implements for Stream Notifications.
Definition onnxruntime_ep_c_api.h:84
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:85
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:96
Struct that an EP implements if it wishes to implement Stream support.
Definition onnxruntime_ep_c_api.h:130
void *(* GetHandle)(OrtSyncStreamImpl *this_ptr)
Get the handle of the stream.
Definition onnxruntime_ep_c_api.h:153
uint32_t ort_version_supported
Must be initialized to ORT_API_VERSION.
Definition onnxruntime_ep_c_api.h:131
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:142