ONNX Runtime
Loading...
Searching...
No Matches
onnxruntime_ep_c_api.h
1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT License.
3
4// Do not include this file directly. Please include "onnxruntime_c_api.h" instead.
5
6#if defined(__DOXYGEN__)
7// When running a Doxygen build, include onnxruntime_c_api.h. Doxygen expects header files to be self-contained.
8#include "onnxruntime_c_api.h"
9#else
10// In normal usage, do not include onnxruntime_c_api.h. This file is explicitly included in onnxruntime_c_api.h.
11#endif
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17ORT_RUNTIME_CLASS(Ep);
18ORT_RUNTIME_CLASS(EpFactory);
19ORT_RUNTIME_CLASS(EpGraphSupportInfo);
20ORT_RUNTIME_CLASS(MemoryDevice); // opaque class to wrap onnxruntime::OrtDevice
21ORT_RUNTIME_CLASS(NodeComputeContext);
22
23ORT_RUNTIME_CLASS(DataTransferImpl);
24ORT_RUNTIME_CLASS(SyncNotificationImpl);
25ORT_RUNTIME_CLASS(SyncStreamImpl);
26
27ORT_RUNTIME_CLASS(ExternalResourceImporterImpl);
28
57
84
85// Opaque types for kernel-based EPs
86ORT_RUNTIME_CLASS(KernelRegistry);
87ORT_RUNTIME_CLASS(KernelDefBuilder);
88ORT_RUNTIME_CLASS(KernelDef);
89ORT_RUNTIME_CLASS(DataType); // combination of ONNXType (e.g., Tensor, Map, Sequence) and ONNXTensorElementDataType
90ORT_RUNTIME_CLASS(SharedPrePackedWeightCache);
91
98
108 ORT_API_T(void, Release, _In_ OrtDataTransferImpl* this_ptr);
109
119 ORT_API_T(bool, CanCopy, _In_ const OrtDataTransferImpl* this_ptr,
120 _In_ const OrtMemoryDevice* src_memory_device, _In_ const OrtMemoryDevice* dst_memory_device);
121
138 ORT_API2_STATUS(CopyTensors, _In_ OrtDataTransferImpl* this_ptr,
139 _In_reads_(num_tensors) const OrtValue** src_tensors,
140 _In_reads_(num_tensors) OrtValue** dst_tensors,
141 _In_reads_(num_tensors) OrtSyncStream** streams,
142 _In_ size_t num_tensors);
143};
144
151
161 ORT_API_T(void, Release, _In_ OrtSyncNotificationImpl* this_ptr);
162
169 ORT_API2_STATUS(Activate, _In_ OrtSyncNotificationImpl* this_ptr);
170
178 ORT_API2_STATUS(WaitOnDevice, _In_ OrtSyncNotificationImpl* this_ptr, _In_ OrtSyncStream* consumer_stream);
179
186 ORT_API2_STATUS(WaitOnHost, _In_ OrtSyncNotificationImpl* this_ptr);
187};
188
197
207 ORT_API_T(void, Release, _In_ OrtSyncStreamImpl* this_ptr);
208
218 ORT_API_T(void*, GetHandle, _In_ OrtSyncStreamImpl* this_ptr);
219
227 ORT_API2_STATUS(CreateNotification, _In_ OrtSyncStreamImpl* this_ptr,
228 _Outptr_ OrtSyncNotificationImpl** notification);
229
238 ORT_API2_STATUS(Flush, _In_ OrtSyncStreamImpl* this_ptr);
239
249 ORT_API2_STATUS(OnSessionRunEnd, _In_ OrtSyncStreamImpl* this_ptr);
250};
251
262
263 // Memory operations (stream-independent)
264
273 ORT_API_T(bool, CanImportMemory,
274 _In_ const OrtExternalResourceImporterImpl* this_ptr,
276
290 ORT_API2_STATUS(ImportMemory,
291 _In_ OrtExternalResourceImporterImpl* this_ptr,
292 _In_ const OrtExternalMemoryDescriptor* desc,
293 _Outptr_ OrtExternalMemoryHandle** out_handle);
294
304 ORT_API_T(void, ReleaseMemory,
305 _In_ OrtExternalResourceImporterImpl* this_ptr,
307
321 ORT_API2_STATUS(CreateTensorFromMemory,
322 _In_ OrtExternalResourceImporterImpl* this_ptr,
323 _In_ const OrtExternalMemoryHandle* mem_handle,
324 _In_ const OrtExternalTensorDescriptor* tensor_desc,
325 _Outptr_ OrtValue** out_tensor);
326
327 // Semaphore operations (require stream)
328
337 ORT_API_T(bool, CanImportSemaphore,
338 _In_ const OrtExternalResourceImporterImpl* this_ptr,
340
354 ORT_API2_STATUS(ImportSemaphore,
355 _In_ OrtExternalResourceImporterImpl* this_ptr,
356 _In_ const OrtExternalSemaphoreDescriptor* desc,
357 _Outptr_ OrtExternalSemaphoreHandle** out_handle);
358
368 ORT_API_T(void, ReleaseSemaphore,
369 _In_ OrtExternalResourceImporterImpl* this_ptr,
371
386 ORT_API2_STATUS(WaitSemaphore,
387 _In_ OrtExternalResourceImporterImpl* this_ptr,
388 _In_ OrtExternalSemaphoreHandle* handle,
389 _In_ OrtSyncStream* stream,
390 _In_ uint64_t value);
391
406 ORT_API2_STATUS(SignalSemaphore,
407 _In_ OrtExternalResourceImporterImpl* this_ptr,
408 _In_ OrtExternalSemaphoreHandle* handle,
409 _In_ OrtSyncStream* stream,
410 _In_ uint64_t value);
411
412 // Release the capability object itself
413
423 ORT_API_T(void, Release, _In_ OrtExternalResourceImporterImpl* this_ptr);
424};
425
428
429struct OrtNodeComputeInfo;
431
448
460
461 // const OrtNode* fused_node_schema;
462};
463
478
491 OrtStatus*(ORT_API_CALL* CreateState)(_In_ OrtNodeComputeInfo* this_ptr,
492 _In_ OrtNodeComputeContext* compute_context,
493 _Outptr_ void** compute_state);
494
504 OrtStatus*(ORT_API_CALL* Compute)(_In_ OrtNodeComputeInfo* this_ptr, _In_ void* compute_state,
505 _In_ OrtKernelContext* kernel_context);
506
513 void(ORT_API_CALL* ReleaseState)(_In_ OrtNodeComputeInfo* this_ptr, _Frees_ptr_opt_ void* compute_state);
514};
515
516struct OrtKernelImpl;
517typedef struct OrtKernelImpl OrtKernelImpl;
518
525 uint32_t flags;
526
538 ORT_API2_STATUS(Compute, _In_ OrtKernelImpl* this_ptr, _In_ OrtKernelContext* context);
539
548 ORT_API_T(void, Release, _In_ OrtKernelImpl* this_ptr);
549
602 ORT_API2_STATUS(PrePackWeight, _In_ OrtKernelImpl* this_ptr, _In_ const OrtValue* tensor,
603 _In_ int input_index, _Inout_ OrtAllocator* allocator,
604 _In_opt_ OrtSharedPrePackedWeightCache* prepacked_weight_cache, _Out_ bool* is_packed);
605
640 ORT_API2_STATUS(SetSharedPrePackedWeight, _In_ OrtKernelImpl* this_ptr,
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);
644};
645
659typedef OrtStatus*(ORT_API_CALL* OrtKernelCreateFunc)(_In_ void* kernel_create_func_state,
660 _In_ const OrtKernelInfo* info,
661 _Outptr_result_maybenull_ OrtKernelImpl** kernel_out);
662
665
672
679 ORT_API_T(void, Release, _In_ OrtLoopKernelHelper* this_ptr);
680
700 ORT_API2_STATUS(ConcatOutput, _In_ OrtLoopKernelHelper* this_ptr, _In_opt_ void* stream_handle,
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);
704};
705
708
715
722 ORT_API_T(void, Release, _In_ OrtScanKernelHelper* this_ptr);
723
741 ORT_API2_STATUS(Transpose, _In_ OrtScanKernelHelper* this_ptr,
742 _In_reads_(num_permutation_elems) const size_t* permutation, _In_ size_t num_permutation_elems,
743 _In_ const OrtValue* input, _In_opt_ OrtSyncStream* stream, _Inout_ OrtValue* output);
744};
745
751struct OrtEpApi {
765 ORT_API2_STATUS(CreateEpDevice, _In_ OrtEpFactory* ep_factory,
766 _In_ const OrtHardwareDevice* hardware_device,
767 _In_opt_ const OrtKeyValuePairs* ep_metadata,
768 _In_opt_ const OrtKeyValuePairs* ep_options,
769 _Out_ OrtEpDevice** ep_device);
770
771 ORT_CLASS_RELEASE(EpDevice);
772
790 ORT_API2_STATUS(EpGraphSupportInfo_AddNodesToFuse, _In_ OrtEpGraphSupportInfo* graph_support_info,
791 _In_reads_(num_nodes) const OrtNode* const* nodes, _In_ size_t num_nodes,
792 _In_opt_ const OrtNodeFusionOptions* node_fusion_options);
793
803 ORT_API2_STATUS(EpGraphSupportInfo_AddSingleNode, _In_ OrtEpGraphSupportInfo* graph_support_info,
804 _In_ const OrtNode* node);
805
817 ORT_API_T(const char*, NodeComputeContext_NodeName, _In_ const OrtNodeComputeContext* context);
818
841 ORT_API2_STATUS(EpDevice_AddAllocatorInfo, _In_ OrtEpDevice* ep_device,
842 _In_ const OrtMemoryInfo* allocator_memory_info);
843
854 ORT_API_T(const OrtMemoryDevice*, MemoryInfo_GetMemoryDevice, _In_ const OrtMemoryInfo* memory_info);
855
863 ORT_API_T(const OrtMemoryDevice*, Value_GetMemoryDevice, _In_ const OrtValue* value);
864
876 ORT_API_T(bool, MemoryDevice_AreEqual, _In_ const OrtMemoryDevice* a, _In_ const OrtMemoryDevice* b);
877
885 ORT_API_T(OrtMemoryInfoDeviceType, MemoryDevice_GetDeviceType, _In_ const OrtMemoryDevice* memory_device);
886
894 ORT_API_T(OrtDeviceMemoryType, MemoryDevice_GetMemoryType, _In_ const OrtMemoryDevice* memory_device);
895
907 ORT_API_T(uint32_t, MemoryDevice_GetVendorId, _In_ const OrtMemoryDevice* memory_device);
908
916 ORT_API_T(uint32_t, MemoryDevice_GetDeviceId, _In_ const OrtMemoryDevice* memory_device);
917
929 ORT_API_T(const OrtSyncStreamImpl*, SyncStream_GetImpl, _In_ const OrtSyncStream* stream);
930
938 ORT_API_T(uint64_t, SyncStream_GetSyncId, _In_ const OrtSyncStream* stream);
939
950 ORT_API_T(uint64_t, GetSyncIdForLastWaitOnSyncStream,
951 _In_ const OrtSyncStream* producer_stream, _In_ const OrtSyncStream* consumer_stream);
952
971 ORT_API2_STATUS(CreateHardwareDevice, _In_ OrtHardwareDeviceType type,
972 _In_ uint32_t vendor_id,
973 _In_ uint32_t device_id,
974 _In_ const char* vendor_name,
975 _In_opt_ const OrtKeyValuePairs* metadata,
976 _Out_ OrtHardwareDevice** hardware_device);
977
978 ORT_CLASS_RELEASE(HardwareDevice);
979
992 ORT_API2_STATUS(CreateKernelRegistry, _Outptr_ OrtKernelRegistry** kernel_registry);
993
994 ORT_CLASS_RELEASE(KernelRegistry);
995
1009 ORT_API2_STATUS(KernelRegistry_AddKernel, _In_ OrtKernelRegistry* kernel_registry,
1010 _In_ const OrtKernelDef* kernel_def, _In_ OrtKernelCreateFunc kernel_create_func,
1011 _In_ void* kernel_create_func_state);
1012
1022 ORT_API2_STATUS(CreateKernelDefBuilder, _Outptr_ OrtKernelDefBuilder** kernel_def_builder_out);
1023
1024 ORT_CLASS_RELEASE(KernelDefBuilder);
1025
1035 ORT_API2_STATUS(KernelDefBuilder_SetOperatorType, _In_ OrtKernelDefBuilder* kernel_def_builder,
1036 _In_ const char* op_type);
1037
1047 ORT_API2_STATUS(KernelDefBuilder_SetDomain, _In_ OrtKernelDefBuilder* kernel_def_builder, _In_ const char* domain);
1048
1061 ORT_API2_STATUS(KernelDefBuilder_SetSinceVersion, _In_ OrtKernelDefBuilder* kernel_def_builder,
1062 _In_ int since_version_start, _In_ int since_version_end);
1063
1073 ORT_API2_STATUS(KernelDefBuilder_SetExecutionProvider, _In_ OrtKernelDefBuilder* kernel_def_builder,
1074 _In_ const char* ep_name);
1075
1086 ORT_API2_STATUS(KernelDefBuilder_SetInputMemType, _In_ OrtKernelDefBuilder* kernel_def_builder,
1087 _In_ size_t input_index, _In_ OrtMemType mem_type);
1088
1099 ORT_API2_STATUS(KernelDefBuilder_SetOutputMemType, _In_ OrtKernelDefBuilder* kernel_def_builder,
1100 _In_ size_t output_index, _In_ OrtMemType mem_type);
1101
1114 ORT_API2_STATUS(KernelDefBuilder_AddTypeConstraint, _In_ OrtKernelDefBuilder* kernel_def_builder,
1115 _In_ const char* arg_name, _In_reads_(num_types) const OrtDataType* const* types,
1116 _In_ size_t num_types);
1117
1133 ORT_API2_STATUS(KernelDefBuilder_AddInputOutputAliases, _In_ OrtKernelDefBuilder* kernel_def_builder,
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);
1137
1153 ORT_API2_STATUS(KernelDefBuilder_AddInputOutputMutableAliases, _In_ OrtKernelDefBuilder* kernel_def_builder,
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);
1157
1167 ORT_API2_STATUS(KernelDefBuilder_Build, _In_ OrtKernelDefBuilder* kernel_def_builder,
1168 _Outptr_ OrtKernelDef** kernel_def_out);
1169
1170 ORT_CLASS_RELEASE(KernelDef);
1171
1179 ORT_API_T(const char*, KernelDef_GetOperatorType, _In_ const OrtKernelDef* kernel_def);
1180
1188 ORT_API_T(const char*, KernelDef_GetDomain, _In_ const OrtKernelDef* kernel_def);
1189
1200 ORT_API2_STATUS(KernelDef_GetSinceVersion, _In_ const OrtKernelDef* kernel_def,
1201 _Out_ int* start_version, _Out_ int* end_version);
1202
1210 ORT_API_T(const char*, KernelDef_GetExecutionProvider, _In_ const OrtKernelDef* kernel_def);
1211
1222 ORT_API2_STATUS(KernelDef_GetInputMemType, _In_ const OrtKernelDef* kernel_def,
1223 _In_ size_t input_index, _Out_ OrtMemType* mem_type);
1224
1235 ORT_API2_STATUS(KernelDef_GetOutputMemType, _In_ const OrtKernelDef* kernel_def,
1236 _In_ size_t output_index, _Out_ OrtMemType* mem_type);
1237
1247 ORT_API2_STATUS(GetTensorDataType, _In_ ONNXTensorElementDataType elem_type,
1248 _Outptr_ const OrtDataType** out);
1249
1265 ORT_API2_STATUS(EpGraphSupportInfo_LookUpKernel, _In_ OrtEpGraphSupportInfo* graph_support_info,
1266 _In_ const OrtNode* node, _Outptr_result_maybenull_ const OrtKernelDef** out_kernel_def);
1267
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);
1296
1307 ORT_API2_STATUS(KernelInfo_GetEp, _In_ const OrtKernelInfo* info, _Outptr_ const OrtEp** ep);
1308
1326 _In_ uint32_t reasons_bitmask,
1327 _In_ int32_t error_code,
1328 _In_opt_z_ const char* notes);
1329
1358 ORT_API2_STATUS(CreateIfKernel, _In_ const OrtKernelInfo* kernel_info, _Outptr_ OrtKernelImpl** kernel_out);
1359
1394 ORT_API2_STATUS(CreateLoopKernel, _In_ const OrtKernelInfo* kernel_info, _In_ OrtLoopKernelHelper* helper,
1395 _Outptr_ OrtKernelImpl** kernel_out);
1396
1426 ORT_API2_STATUS(CreateScanKernel, _In_ const OrtKernelInfo* kernel_info, _In_ OrtScanKernelHelper* helper,
1427 _Outptr_ OrtKernelImpl** kernel_out);
1428
1429 ORT_CLASS_RELEASE(KernelImpl);
1430
1446 ORT_API2_STATUS(GetEnvConfigEntries, _Outptr_ OrtKeyValuePairs** config_entries);
1447};
1448
1457typedef enum OrtEpDataLayout {
1458 OrtEpDataLayout_NCHW = 0,
1459 OrtEpDataLayout_NHWC,
1460
1461 OrtEpDataLayout_Default = OrtEpDataLayout_NCHW,
1462} OrtEpDataLayout;
1463
1468struct OrtEp {
1477
1487 ORT_API_T(const char*, GetName, _In_ const OrtEp* this_ptr);
1488
1505 ORT_API2_STATUS(GetCapability, _In_ OrtEp* this_ptr, _In_ const OrtGraph* graph,
1506 _Inout_ OrtEpGraphSupportInfo* graph_support_info);
1507
1548 ORT_API2_STATUS(Compile, _In_ OrtEp* this_ptr, _In_ const OrtGraph** graphs,
1549 _In_ const OrtNode** fused_nodes, _In_ size_t count,
1550 _Out_writes_all_(count) OrtNodeComputeInfo** node_compute_infos,
1551 _Out_writes_(count) OrtNode** ep_context_nodes);
1552
1564 ORT_API_T(void, ReleaseNodeComputeInfos, _In_ OrtEp* this_ptr,
1565 OrtNodeComputeInfo** node_compute_infos,
1566 _In_ size_t num_node_compute_infos);
1567
1580 ORT_API2_STATUS(GetPreferredDataLayout, _In_ OrtEp* this_ptr, _Out_ OrtEpDataLayout* preferred_data_layout);
1581
1604 ORT_API2_STATUS(ShouldConvertDataLayoutForOp, _In_ OrtEp* this_ptr,
1605 _In_z_ const char* domain, _In_z_ const char* op_type,
1606 _In_ OrtEpDataLayout target_data_layout,
1607 _Outptr_ int* should_convert);
1608
1625 ORT_API2_STATUS(SetDynamicOptions, _In_ OrtEp* this_ptr,
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);
1629
1641 ORT_API2_STATUS(OnRunStart, _In_ OrtEp* this_ptr, _In_ const OrtRunOptions* run_options);
1642
1656 ORT_API2_STATUS(OnRunEnd, _In_ OrtEp* this_ptr, _In_ const OrtRunOptions* run_options, _In_ bool sync_stream);
1657
1673 ORT_API2_STATUS(CreateAllocator, _In_ OrtEp* this_ptr,
1674 _In_ const OrtMemoryInfo* memory_info,
1675 _Outptr_result_maybenull_ OrtAllocator** allocator);
1676
1693 ORT_API2_STATUS(CreateSyncStreamForDevice, _In_ OrtEp* this_ptr,
1694 _In_ const OrtMemoryDevice* memory_device,
1695 _Outptr_ OrtSyncStreamImpl** stream);
1696
1712 ORT_API_T(const char*, GetCompiledModelCompatibilityInfo, _In_ OrtEp* this_ptr,
1713 _In_ const OrtGraph* graph);
1714
1728 ORT_API2_STATUS(GetKernelRegistry, _In_ OrtEp* this_ptr,
1729 _Outptr_result_maybenull_ const OrtKernelRegistry** kernel_registry);
1730
1743 ORT_API2_STATUS(IsConcurrentRunSupported, _In_ OrtEp* this_ptr, _Outptr_ bool* is_supported);
1744};
1745
1765typedef OrtStatus* (*CreateEpApiFactoriesFn)(_In_ const char* registered_name, _In_ const OrtApiBase* ort_api_base,
1766 _In_ const OrtLogger* default_logger,
1767 _Inout_ OrtEpFactory** factories, _In_ size_t max_factories,
1768 _Out_ size_t* num_factories);
1769
1780typedef OrtStatus* (*ReleaseEpApiFactoryFn)(_In_ OrtEpFactory* factory);
1781
1795
1805 ORT_API_T(const char*, GetName, const OrtEpFactory* this_ptr);
1806
1816 ORT_API_T(const char*, GetVendor, const OrtEpFactory* this_ptr); // return EP vendor
1817
1835 ORT_API2_STATUS(GetSupportedDevices, _In_ OrtEpFactory* this_ptr,
1836 _In_reads_(num_devices) const OrtHardwareDevice* const* devices,
1837 _In_ size_t num_devices,
1838 _Inout_ OrtEpDevice** ep_devices,
1839 _In_ size_t max_ep_devices,
1840 _Out_ size_t* num_ep_devices);
1841
1866 ORT_API2_STATUS(CreateEp, _In_ OrtEpFactory* this_ptr,
1867 _In_reads_(num_devices) const OrtHardwareDevice* const* devices,
1868 _In_reads_(num_devices) const OrtKeyValuePairs* const* ep_metadata_pairs,
1869 _In_ size_t num_devices,
1870 _In_ const OrtSessionOptions* session_options,
1871 _In_ const OrtLogger* logger, _Outptr_ OrtEp** ep);
1872
1880 ORT_API_T(void, ReleaseEp, OrtEpFactory* this_ptr, struct OrtEp* ep);
1881
1891 ORT_API_T(uint32_t, GetVendorId, const OrtEpFactory* this_ptr);
1892
1905 ORT_API_T(const char*, GetVersion, _In_ const OrtEpFactory* this_ptr);
1906
1926 ORT_API2_STATUS(ValidateCompiledModelCompatibilityInfo, _In_ OrtEpFactory* this_ptr,
1927 _In_reads_(num_devices) const OrtHardwareDevice* const* devices,
1928 _In_ size_t num_devices,
1929 _In_ const char* compatibility_info,
1930 _Out_ OrtCompiledModelCompatibility* model_compatibility);
1931
1946 ORT_API2_STATUS(CreateAllocator, _In_ OrtEpFactory* this_ptr,
1947 _In_ const OrtMemoryInfo* memory_info,
1948 _In_opt_ const OrtKeyValuePairs* allocator_options,
1949 _Outptr_result_maybenull_ OrtAllocator** allocator);
1950
1955 ORT_API_T(void, ReleaseAllocator, _In_ OrtEpFactory* this_ptr, _In_ OrtAllocator* allocator);
1956
1969 ORT_API2_STATUS(CreateDataTransfer, _In_ OrtEpFactory* this_ptr,
1970 _Outptr_result_maybenull_ OrtDataTransferImpl** data_transfer);
1971
1979 ORT_API_T(bool, IsStreamAware, _In_ const OrtEpFactory* this_ptr);
1980
1995 ORT_API2_STATUS(CreateSyncStreamForDevice, _In_ OrtEpFactory* this_ptr,
1996 _In_ const OrtMemoryDevice* memory_device,
1997 _In_opt_ const OrtKeyValuePairs* stream_options,
1998 _Outptr_ OrtSyncStreamImpl** stream);
1999
2020 ORT_API2_STATUS(GetHardwareDeviceIncompatibilityDetails, _In_ OrtEpFactory* this_ptr,
2021 _In_ const OrtHardwareDevice* hw,
2023
2046 ORT_API2_STATUS(CreateExternalResourceImporterForDevice, _In_ OrtEpFactory* this_ptr,
2047 _In_ const OrtEpDevice* ep_device,
2048 _Outptr_result_maybenull_ OrtExternalResourceImporterImpl** out_importer);
2049
2059 ORT_API2_STATUS(GetNumCustomOpDomains, _In_ OrtEpFactory* this_ptr, _Out_ size_t* num_domains);
2060
2106 ORT_API2_STATUS(GetCustomOpDomains, _In_ OrtEpFactory* this_ptr,
2107 _Out_writes_all_(num_domains) OrtCustomOpDomain** domains, _In_ size_t num_domains);
2108};
2109
2110#ifdef __cplusplus
2111}
2112#endif
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