6#if defined(__DOXYGEN__)
8#include "onnxruntime_c_api.h"
21ORT_RUNTIME_CLASS(EpFactory);
22ORT_RUNTIME_CLASS(EpGraphSupportInfo);
23ORT_RUNTIME_CLASS(MemoryDevice);
24ORT_RUNTIME_CLASS(NodeComputeContext);
26ORT_RUNTIME_CLASS(DataTransferImpl);
27ORT_RUNTIME_CLASS(SyncNotificationImpl);
28ORT_RUNTIME_CLASS(SyncStreamImpl);
30ORT_RUNTIME_CLASS(ExternalResourceImporterImpl);
32ORT_RUNTIME_CLASS(OpSchema);
33ORT_RUNTIME_CLASS(OpSchemaTypeConstraint);
34ORT_RUNTIME_CLASS(ProfilingEventsContainer);
35ORT_RUNTIME_CLASS(ProfilingEvent);
95ORT_RUNTIME_CLASS(KernelRegistry);
96ORT_RUNTIME_CLASS(KernelDefBuilder);
97ORT_RUNTIME_CLASS(KernelDef);
98ORT_RUNTIME_CLASS(DataType);
99ORT_RUNTIME_CLASS(SharedPrePackedWeightCache);
148 _In_reads_(num_tensors)
const OrtValue** src_tensors,
149 _In_reads_(num_tensors)
OrtValue** dst_tensors,
151 _In_
size_t num_tensors);
399 _In_ uint64_t value);
419 _In_ uint64_t value);
439typedef enum OrtProfilingEventCategory {
440 OrtProfilingEventCategory_SESSION = 0,
441 OrtProfilingEventCategory_NODE = 1,
442 OrtProfilingEventCategory_KERNEL = 2,
443 OrtProfilingEventCategory_API = 3,
444} OrtProfilingEventCategory;
700 _Outptr_
void** compute_state);
811 _In_opt_ OrtSharedPrePackedWeightCache* prepacked_weight_cache, _Out_
bool* is_packed);
848 _In_reads_(num_buffers)
const void*
const* buffer_data_ptrs,
849 _In_reads_(num_buffers)
const size_t* buffer_data_sizes,
850 _In_
size_t num_buffers, _In_
int input_index);
866typedef OrtStatus*(ORT_API_CALL* OrtKernelCreateFunc)(_In_
void* kernel_create_func_state,
908 _In_reads_(num_per_iteration_outputs)
const OrtValue*
const* per_iteration_outputs,
909 _In_
size_t num_per_iteration_outputs, _Out_writes_bytes_all_(output_size_in_bytes)
void* output,
910 _In_
size_t output_size_in_bytes);
949 _In_reads_(num_permutation_elems)
const size_t* permutation, _In_
size_t num_permutation_elems,
961typedef enum OrtResourceCountKind {
962 OrtResourceCountKind_None = 0,
963 OrtResourceCountKind_TotalBytes = 1,
964} OrtResourceCountKind;
1000 rc.
kind = OrtResourceCountKind_TotalBytes;
1001 rc.value.total_bytes = bytes;
1007 return value.total_bytes;
1013static_assert(
sizeof(
OrtResourceCount) == 56,
"OrtResourceCount size must not change to maintain ABI stability");
1041 ORT_CLASS_RELEASE(EpDevice);
1061 _In_reads_(num_nodes)
const OrtNode*
const* nodes, _In_
size_t num_nodes,
1242 _In_ uint32_t vendor_id,
1243 _In_ uint32_t device_id,
1244 _In_
const char* vendor_name,
1248 ORT_CLASS_RELEASE(HardwareDevice);
1264 ORT_CLASS_RELEASE(KernelRegistry);
1280 _In_
const OrtKernelDef* kernel_def, _In_ OrtKernelCreateFunc kernel_create_func,
1281 _In_
void* kernel_create_func_state);
1294 ORT_CLASS_RELEASE(KernelDefBuilder);
1306 _In_
const char* op_type);
1332 _In_
int since_version_start, _In_
int since_version_end);
1344 _In_
const char* ep_name);
1385 _In_
const char* arg_name, _In_reads_(num_types)
const OrtDataType*
const* types,
1386 _In_
size_t num_types);
1404 _In_reads_(num_io_indices)
int const* input_indices,
1405 _In_reads_(num_io_indices)
int const* output_indices,
1406 _In_
size_t num_io_indices);
1424 _In_reads_(num_io_indices)
int const* input_indices,
1425 _In_reads_(num_io_indices)
int const* output_indices,
1426 _In_
size_t num_io_indices);
1438 _Outptr_ OrtKernelDef** kernel_def_out);
1440 ORT_CLASS_RELEASE(KernelDef);
1471 _Out_
int* start_version, _Out_
int* end_version);
1518 _Outptr_
const OrtDataType** out);
1536 _In_
const OrtNode* node, _Outptr_result_maybenull_
const OrtKernelDef** out_kernel_def);
1563 _In_ OrtSharedPrePackedWeightCache* prepacked_weight_cache,
1564 _In_reads_(num_buffers)
void** buffer_data_ptrs, _In_reads_(num_buffers)
size_t* buffer_data_sizes,
1565 _In_
size_t num_buffers);
1596 _In_ uint32_t reasons_bitmask,
1597 _In_ int32_t error_code,
1598 _In_opt_z_
const char* notes);
1699 ORT_CLASS_RELEASE(KernelImpl);
1737 ORT_API2_STATUS(
GetOpSchema, _In_
const char* name, _In_
int max_inclusive_version,
1738 _In_
const char* domain, _Outptr_result_maybenull_
OrtOpSchema** out_schema);
1740 ORT_CLASS_RELEASE(OpSchema);
1784 _Outptr_
const char** out);
1829 _Outptr_
const char** out);
1898 _Outptr_
const char** out);
1916 _Outptr_
const char*
const** out_types, _Out_
size_t* num_types);
1932 _Outptr_
const size_t** out_indices, _Out_
size_t* count);
1948 _Outptr_
const size_t** out_indices, _Out_
size_t* count);
1978 _In_ OrtProfilingEventCategory category,
1979 _In_ int32_t process_id,
1980 _In_ int32_t thread_id,
1981 _In_
const char* event_name,
1982 _In_ int64_t timestamp_us,
1983 _In_ int64_t duration_us,
1984 _In_reads_(num_args)
const char*
const* arg_keys,
1985 _In_reads_(num_args)
const char*
const* arg_values,
1986 _In_
size_t num_args,
1993 ORT_CLASS_RELEASE(ProfilingEvent);
2005 _Out_ OrtProfilingEventCategory* out);
2018 _Outptr_
const char** out);
2031 _Out_ int64_t* out);
2043 _Out_ int64_t* out);
2059 _Outptr_result_maybenull_
const char** out);
2079 _In_
size_t num_events);
2090typedef enum OrtEpDataLayout {
2091 OrtEpDataLayout_NCHW = 0,
2092 OrtEpDataLayout_NHWC,
2094 OrtEpDataLayout_Default = OrtEpDataLayout_NCHW,
2105typedef enum OrtGraphCaptureNodeAssignmentPolicy {
2107 OrtGraphCaptureNodeAssignmentPolicy_ALL_NODES_ON_EP = 0,
2111 OrtGraphCaptureNodeAssignmentPolicy_ALLOW_CPU_FOR_SHAPES = 1,
2112} OrtGraphCaptureNodeAssignmentPolicy;
2199 _In_
const OrtNode** fused_nodes, _In_
size_t count,
2216 _In_
size_t num_node_compute_infos);
2255 _In_z_
const char* domain, _In_z_
const char* op_type,
2256 _In_ OrtEpDataLayout target_data_layout,
2257 _Outptr_
int* should_convert);
2276 _In_reads_(num_options)
const char*
const* option_keys,
2277 _In_reads_(num_options)
const char*
const* option_values,
2278 _In_
size_t num_options);
2383 _Outptr_result_maybenull_
const OrtKernelRegistry** kernel_registry);
2613typedef OrtStatus* (*CreateEpApiFactoriesFn)(_In_
const char* registered_name, _In_
const OrtApiBase* ort_api_base,
2615 _Inout_
OrtEpFactory** factories, _In_
size_t max_factories,
2616 _Out_
size_t* num_factories);
2685 _In_
size_t num_devices,
2687 _In_
size_t max_ep_devices,
2688 _Out_
size_t* num_ep_devices);
2717 _In_
size_t num_devices,
2776 _In_
size_t num_devices,
2777 _In_
const char* compatibility_info,
struct OrtMemoryInfo OrtMemoryInfo
Definition onnxruntime_c_api.h:308
struct OrtHardwareDevice OrtHardwareDevice
Definition onnxruntime_c_api.h:340
struct OrtKernelInfo OrtKernelInfo
Definition onnxruntime_c_api.h:484
struct OrtNode OrtNode
Definition onnxruntime_c_api.h:336
OrtMemoryInfoDeviceType
This mimics OrtDevice type constants so they can be returned in the API.
Definition onnxruntime_c_api.h:519
struct OrtMemoryDevice OrtMemoryDevice
Definition onnxruntime_ep_c_api.h:23
OrtExternalMemoryHandleType
External memory handle type for importing GPU resources.
Definition onnxruntime_c_api.h:1067
OrtCompiledModelCompatibility
Definition onnxruntime_c_api.h:1198
struct OrtNodeComputeContext OrtNodeComputeContext
Definition onnxruntime_ep_c_api.h:24
struct OrtCustomOpDomain OrtCustomOpDomain
Definition onnxruntime_c_api.h:319
OrtExternalSemaphoreType
External semaphore type for GPU synchronization.
Definition onnxruntime_c_api.h:1094
struct OrtOpSchema OrtOpSchema
Definition onnxruntime_ep_c_api.h:32
struct OrtEpGraphSupportInfo OrtEpGraphSupportInfo
Definition onnxruntime_ep_c_api.h:22
struct OrtProfilingEvent OrtProfilingEvent
Definition onnxruntime_ep_c_api.h:35
struct OrtKernelContext OrtKernelContext
Definition onnxruntime_c_api.h:486
struct OrtOpSchemaTypeConstraint OrtOpSchemaTypeConstraint
Definition onnxruntime_ep_c_api.h:33
struct OrtEpDevice OrtEpDevice
Definition onnxruntime_c_api.h:341
struct OrtRunOptions OrtRunOptions
Definition onnxruntime_c_api.h:312
OrtHardwareDeviceType
Definition onnxruntime_c_api.h:526
struct OrtGraph OrtGraph
Definition onnxruntime_c_api.h:337
struct OrtSyncStream OrtSyncStream
Definition onnxruntime_c_api.h:343
struct OrtSessionOptions OrtSessionOptions
Definition onnxruntime_c_api.h:318
OrtDeviceMemoryType
This matches OrtDevice::MemoryType values.
Definition onnxruntime_c_api.h:512
struct OrtValue OrtValue
Definition onnxruntime_c_api.h:311
struct OrtKeyValuePairs OrtKeyValuePairs
Definition onnxruntime_c_api.h:342
OrtMemType
Memory types for allocated memory, execution provider specific types should be extended in each provi...
Definition onnxruntime_c_api.h:500
struct OrtStatus OrtStatus
Definition onnxruntime_c_api.h:307
struct OrtDeviceEpIncompatibilityDetails OrtDeviceEpIncompatibilityDetails
Definition onnxruntime_c_api.h:348
struct OrtLogger OrtLogger
Definition onnxruntime_c_api.h:332
struct OrtProfilingEventsContainer OrtProfilingEventsContainer
Definition onnxruntime_ep_c_api.h:34
ONNXTensorElementDataType
Definition onnxruntime_c_api.h:191
Memory allocation interface.
Definition onnxruntime_c_api.h:364
The helper interface to get the right version of OrtApi.
Definition onnxruntime_c_api.h:935
Struct that an EP implements for IDataTransfer to copy between devices it uses and CPU.
Definition onnxruntime_ep_c_api.h:105
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:129
uint32_t ort_version_supported
Must be initialized to ORT_API_VERSION.
Definition onnxruntime_ep_c_api.h:106
void(* Release)(OrtDataTransferImpl *this_ptr)
Release the OrtDataTransferImpl instance.
Definition onnxruntime_ep_c_api.h:117
The OrtEpApi struct provides functions that are relevant to the implementation of an execution provid...
Definition onnxruntime_ep_c_api.h:1021
OrtStatus * OpSchemaTypeConstraint_GetTypeParamName(const OrtOpSchemaTypeConstraint *type_constraint, const char **out)
Get the type parameter name of a type constraint (e.g., "T", "T1").
OrtStatus * OpSchema_GetOutputTypeConstraint(const OrtOpSchema *schema, size_t index, const OrtOpSchemaTypeConstraint **out)
Get the type constraint for the i-th output formal parameter from an operator schema.
const char *(* KernelDef_GetDomain)(const OrtKernelDef *kernel_def)
Returns the operator's domain from the kernel definition.
Definition onnxruntime_ep_c_api.h:1458
uint32_t(* MemoryDevice_GetVendorId)(const OrtMemoryDevice *memory_device)
Get the vendor ID from an OrtMemoryDevice instance.
Definition onnxruntime_ep_c_api.h:1177
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:1221
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:1155
OrtStatus * OpSchemaTypeConstraint_GetAllowedTypes(const OrtOpSchemaTypeConstraint *type_constraint, const char *const **out_types, size_t *num_types)
Get the allowed type strings for a type constraint.
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:1087
OrtStatus * OpSchema_GetTypeConstraintCount(const OrtOpSchema *schema, size_t *out)
Get the number of unique type constraints in the operator schema.
OrtStatus * ProfilingEvent_GetDurationUs(const OrtProfilingEvent *event, int64_t *out)
Get the duration of a profiling event in microseconds.
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:1146
OrtStatus * ProfilingEvent_GetName(const OrtProfilingEvent *event, const char **out)
Get the event name of a profiling event.
const OrtMemoryDevice *(* MemoryInfo_GetMemoryDevice)(const OrtMemoryInfo *memory_info)
Get the OrtMemoryDevice from an OrtMemoryInfo instance.
Definition onnxruntime_ep_c_api.h:1124
OrtStatus * OpSchema_GetNumInputs(const OrtOpSchema *schema, size_t *out)
Get the number of inputs defined by the operator schema.
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:1199
OrtStatus * ProfilingEvent_GetArgValue(const OrtProfilingEvent *event, const char *key, const char **out)
Get the value of an event argument by its key.
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 * ProfilingEvent_GetCategory(const OrtProfilingEvent *event, OrtProfilingEventCategory *out)
Get the event category of a profiling event.
OrtStatus * OpSchema_GetNumOutputs(const OrtOpSchema *schema, size_t *out)
Get the number of outputs defined by the operator schema.
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:1186
OrtStatus * OpSchema_GetInputName(const OrtOpSchema *schema, size_t index, const char **out)
Get the name of the i-th input formal parameter from an operator schema.
OrtDeviceMemoryType(* MemoryDevice_GetMemoryType)(const OrtMemoryDevice *memory_device)
Get the OrtDeviceMemoryType value from an OrtMemoryDevice instance.
Definition onnxruntime_ep_c_api.h:1164
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 * ProfilingEvent_GetTimestampUs(const OrtProfilingEvent *event, int64_t *out)
Get the start timestamp of a profiling event in microseconds.
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:1449
OrtStatus * CreateProfilingEvent(OrtProfilingEventCategory category, int32_t process_id, int32_t thread_id, const char *event_name, int64_t timestamp_us, int64_t duration_us, const char *const *arg_keys, const char *const *arg_values, size_t num_args, OrtProfilingEvent **out)
Create a profiling event.
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 * OpSchema_GetInputTypeConstraint(const OrtOpSchema *schema, size_t index, const OrtOpSchemaTypeConstraint **out)
Get the type constraint for the i-th input formal parameter from an operator schema.
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:1133
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 * ProfilingEventsContainer_AddEvents(OrtProfilingEventsContainer *events_container, const OrtProfilingEvent *const *events, size_t num_events)
Add EP profiling events to an events container.
OrtStatus * GetEnvConfigEntries(OrtKeyValuePairs **config_entries)
Gets a new OrtKeyValuePairs instance containing a copy of all configuration entries set on the enviro...
OrtStatus * OpSchema_GetTypeConstraint(const OrtOpSchema *schema, size_t index, const OrtOpSchemaTypeConstraint **out)
Get the i-th type constraint from the operator schema.
OrtStatus * KernelDefBuilder_SetInputMemType(OrtKernelDefBuilder *kernel_def_builder, size_t input_index, OrtMemType mem_type)
Sets the memory type for a kernel input.
OrtStatus * OpSchemaTypeConstraint_GetInputIndices(const OrtOpSchemaTypeConstraint *type_constraint, const size_t **out_indices, size_t *count)
Get the input indices that use a type constraint.
const char *(* KernelDef_GetExecutionProvider)(const OrtKernelDef *kernel_def)
Returns the name of the kernel's intended execution provider.
Definition onnxruntime_ep_c_api.h:1480
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 * OpSchema_GetOutputName(const OrtOpSchema *schema, size_t index, const char **out)
Get the name of the i-th output formal parameter from an operator schema.
OrtStatus * KernelInfo_GetEp(const OrtKernelInfo *info, const OrtEp **ep)
Get the OrtEp instance to which the node is assigned from the OrtKernelInfo.
OrtStatus * OpSchemaTypeConstraint_GetOutputIndices(const OrtOpSchemaTypeConstraint *type_constraint, const size_t **out_indices, size_t *count)
Get the output indices that use a type constraint.
OrtStatus * GetOpSchema(const char *name, int max_inclusive_version, const char *domain, OrtOpSchema **out_schema)
Get an operator schema from the global schema registry.
OrtStatus * OpSchema_GetSinceVersion(const OrtOpSchema *schema, int *out)
Get the first ONNX opset version that introduced this operator schema.
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:1208
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:2634
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:2827
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:2739
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:2664
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...
OrtStatus * InitGraphicsInterop(OrtEpFactory *this_ptr, const OrtEpDevice *ep_device, const OrtGraphicsInteropConfig *config)
Initialize graphics interop for the EP factory.
OrtStatus * DeinitGraphicsInterop(OrtEpFactory *this_ptr, const OrtEpDevice *ep_device)
Deinitialize graphics interop for the EP factory.
const char *(* GetVersion)(const OrtEpFactory *this_ptr)
Get the version of the execution provider that the factory creates.
Definition onnxruntime_ep_c_api.h:2753
void(* ReleaseAllocator)(OrtEpFactory *this_ptr, OrtAllocator *allocator)
Release an OrtAllocator created by the factory.
Definition onnxruntime_ep_c_api.h:2803
uint32_t ort_version_supported
The ONNX Runtime version the execution provider was compiled with.
Definition onnxruntime_ep_c_api.h:2642
void(* ReleaseEp)(OrtEpFactory *this_ptr, struct OrtEp *ep)
Release the OrtEp instance.
Definition onnxruntime_ep_c_api.h:2728
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:2653
The OrtEp struct provides functions to implement for an execution provider.
Definition onnxruntime_ep_c_api.h:2118
void(* ReleaseNodeComputeInfos)(OrtEp *this_ptr, OrtNodeComputeInfo **node_compute_infos, size_t num_node_compute_infos)
Release OrtNodeComputeInfo instances.
Definition onnxruntime_ep_c_api.h:2216
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:2367
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.
OrtGraphCaptureNodeAssignmentPolicy(* GetGraphCaptureNodeAssignmentPolicy)(const OrtEp *this_ptr)
Get the node assignment validation policy for graph capture.
Definition onnxruntime_ep_c_api.h:2531
OrtStatus * CreateSyncStreamForDevice(OrtEp *this_ptr, const OrtMemoryDevice *memory_device, OrtSyncStreamImpl **stream)
Create a synchronization stream for the given memory device for an OrtSession.
OrtStatus * OnSessionInitializationEnd(OrtEp *this_ptr)
Called by ORT when session initialization is complete.
const char *(* GetName)(const OrtEp *this_ptr)
Get the execution provider name.
Definition onnxruntime_ep_c_api.h:2137
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.
bool(* IsGraphCaptured)(const OrtEp *this_ptr, int graph_annotation_id)
Indicate whether a graph has been captured and instantiated.
Definition onnxruntime_ep_c_api.h:2497
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 ...
OrtStatus * ReplayGraph(OrtEp *this_ptr, int graph_annotation_id)
Run the instantiated (captured) graph.
bool(* IsGraphCaptureEnabled)(const OrtEp *this_ptr)
Indicate whether the graph capturing mode (e.g., CUDA graph) is enabled for the provider.
Definition onnxruntime_ep_c_api.h:2477
OrtStatus * Sync(OrtEp *this_ptr)
Called by ORT to block until the device has completed all preceding requested tasks.
uint32_t ort_version_supported
The ONNX Runtime version the execution provider was compiled with.
Definition onnxruntime_ep_c_api.h:2126
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.
OrtStatus * ReleaseCapturedGraph(OrtEp *this_ptr, int graph_annotation_id)
Release a previously captured graph and its associated resources.
OrtStatus * CreateProfiler(OrtEp *this_ptr, OrtEpProfilerImpl **profiler)
Return a new profiler for the execution provider.
OrtStatus * GetAvailableResource(const OrtEp *this_ptr, OrtResourceCount *available)
Query the available device resource for partitioning budget.
Struct that an EP implements for profiling support.
Definition onnxruntime_ep_c_api.h:478
OrtStatus * StartEvent(OrtEpProfilerImpl *this_ptr, uint64_t ort_event_correlation_id)
Called when an ORT event (e.g., session initialization, node kernel execution, etc....
uint32_t ort_version_supported
Must be initialized to ORT_API_VERSION.
Definition onnxruntime_ep_c_api.h:479
OrtStatus * StartProfiling(OrtEpProfilerImpl *this_ptr, int64_t ep_profiling_start_offset_ns)
Called when profiling starts.
void(* Release)(OrtEpProfilerImpl *this_ptr)
Release the OrtEpProfilerImpl instance.
Definition onnxruntime_ep_c_api.h:492
OrtStatus * EndProfiling(OrtEpProfilerImpl *this_ptr, OrtProfilingEventsContainer *events_container)
Called when profiling ends to collect the EP's new profiling events since the call to StartProfiling.
OrtStatus * StopEvent(OrtEpProfilerImpl *this_ptr, uint64_t ort_event_correlation_id, const OrtProfilingEvent *ort_event)
Called when a profiled ORT event (e.g., session initialization, node kernel execution,...
Descriptor for importing external memory.
Definition onnxruntime_c_api.h:1081
Base struct for imported external memory handles.
Definition onnxruntime_ep_c_api.h:54
const OrtEpDevice * ep_device
EP device that created this handle.
Definition onnxruntime_ep_c_api.h:56
void(* Release)(OrtExternalMemoryHandle *handle)
Release callback for this handle. EP sets this to its release function.
Definition onnxruntime_ep_c_api.h:64
OrtExternalMemoryDescriptor descriptor
External memory descriptor.
Definition onnxruntime_ep_c_api.h:57
uint32_t version
Must be ORT_API_VERSION.
Definition onnxruntime_ep_c_api.h:55
Struct that an EP implements for external resource import (memory + semaphore import).
Definition onnxruntime_ep_c_api.h:269
void(* ReleaseSemaphore)(OrtExternalResourceImporterImpl *this_ptr, OrtExternalSemaphoreHandle *handle)
Release an imported external semaphore handle.
Definition onnxruntime_ep_c_api.h:379
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:270
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:432
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:315
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:284
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:348
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:1107
Base struct for imported external semaphore handles.
Definition onnxruntime_ep_c_api.h:81
OrtExternalSemaphoreDescriptor descriptor
External semaphore descriptor.
Definition onnxruntime_ep_c_api.h:84
uint32_t version
Must be ORT_API_VERSION.
Definition onnxruntime_ep_c_api.h:82
void(* Release)(OrtExternalSemaphoreHandle *handle)
Release callback for this handle. EP sets this to its release function.
Definition onnxruntime_ep_c_api.h:91
const OrtEpDevice * ep_device
EP device that created this handle.
Definition onnxruntime_ep_c_api.h:83
Descriptor for creating a tensor from imported external memory.
Definition onnxruntime_c_api.h:1185
Configuration for initializing graphics interop on an EP factory.
Definition onnxruntime_c_api.h:1153
Contains functions that an OrtEp implements to specify the computation for an operator kernel.
Definition onnxruntime_ep_c_api.h:730
uint32_t ort_version_supported
Must be initialized to ORT_API_VERSION.
Definition onnxruntime_ep_c_api.h:731
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:732
void(* Release)(OrtKernelImpl *this_ptr)
Called by ORT to release the OrtKernelImpl instance and its resources.
Definition onnxruntime_ep_c_api.h:755
Contains helper functions for a Loop OrtKernelImpl created via OrtEpApi::CreateLoopKernel.
Definition onnxruntime_ep_c_api.h:877
void(* Release)(OrtLoopKernelHelper *this_ptr)
Called by ORT to release the OrtLoopKernelHelper instance and its resources.
Definition onnxruntime_ep_c_api.h:886
uint32_t ort_version_supported
Must be initialized to ORT_API_VERSION.
Definition onnxruntime_ep_c_api.h:878
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:676
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:711
uint32_t ort_version_supported
The ONNX Runtime version the OrtNodeComputeInfo was compiled with.
Definition onnxruntime_ep_c_api.h:684
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:698
void(* ReleaseState)(OrtNodeComputeInfo *this_ptr, void *compute_state)
Releases the compute state returned by CreateState().
Definition onnxruntime_ep_c_api.h:720
The OrtNodeFusionOptions struct specifies options for fusing nodes supported by an execution provider...
Definition onnxruntime_ep_c_api.h:646
uint32_t ort_version_supported
The ONNX Runtime version the OrtNodeFusionOptions was compiled with.
Definition onnxruntime_ep_c_api.h:654
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:666
ABI-stable tagged union representing a resource cost or budget.
Definition onnxruntime_ep_c_api.h:979
static OrtResourceCount FromTotalBytes(uint64_t bytes) noexcept
Definition onnxruntime_ep_c_api.h:998
static OrtResourceCount None() noexcept
Definition onnxruntime_ep_c_api.h:993
uint32_t kind
Definition onnxruntime_ep_c_api.h:980
uint64_t total_bytes
Definition onnxruntime_ep_c_api.h:984
uint32_t reserved
Definition onnxruntime_ep_c_api.h:981
uint64_t AsTotalBytes() const noexcept
Definition onnxruntime_ep_c_api.h:1006
uint64_t reserved_words[6]
Definition onnxruntime_ep_c_api.h:985
OrtResourceCount() noexcept
Definition onnxruntime_ep_c_api.h:990
union OrtResourceCount::@3 value
Contains helper functions for a Scan OrtKernelImpl created via OrtEpApi::CreateScanKernel.
Definition onnxruntime_ep_c_api.h:920
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:921
void(* Release)(OrtScanKernelHelper *this_ptr)
Called by ORT to release the OrtScanKernelHelper instance and its resources.
Definition onnxruntime_ep_c_api.h:929
Struct that an EP implements for Stream Notifications.
Definition onnxruntime_ep_c_api.h:158
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:159
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:170
Struct that an EP implements if it wishes to implement Stream support.
Definition onnxruntime_ep_c_api.h:204
void *(* GetHandle)(OrtSyncStreamImpl *this_ptr)
Get the handle of the stream.
Definition onnxruntime_ep_c_api.h:227
uint32_t ort_version_supported
Must be initialized to ORT_API_VERSION.
Definition onnxruntime_ep_c_api.h:205
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:216