diff --git a/include/onnxruntime/core/session/onnxruntime_ep_c_api.h b/include/onnxruntime/core/session/onnxruntime_ep_c_api.h index 44c7bb6ee424a..5d00ce4940d02 100644 --- a/include/onnxruntime/core/session/onnxruntime_ep_c_api.h +++ b/include/onnxruntime/core/session/onnxruntime_ep_c_api.h @@ -358,7 +358,7 @@ struct OrtEp { * * \since Version 1.22. */ - const char*(ORT_API_CALL* GetName)(_In_ const OrtEp* this_ptr); + ORT_API_T(const char*, GetName, _In_ const OrtEp* this_ptr); /** \brief Get information about the nodes supported by the OrtEp instance. * @@ -376,8 +376,8 @@ struct OrtEp { * * \since Version 1.23. */ - OrtStatus*(ORT_API_CALL* GetCapability)(_In_ OrtEp* this_ptr, _In_ const OrtGraph* graph, - _Inout_ OrtEpGraphSupportInfo* graph_support_info); + ORT_API2_STATUS(GetCapability, _In_ OrtEp* this_ptr, _In_ const OrtGraph* graph, + _Inout_ OrtEpGraphSupportInfo* graph_support_info); /** \brief Compile OrtGraph instances assigned to the OrtEp. Implementer must set a OrtNodeComputeInfo instance * for each OrtGraph in order to define its computation function. @@ -416,10 +416,10 @@ struct OrtEp { * * \since Version 1.23. */ - OrtStatus*(ORT_API_CALL* Compile)(_In_ OrtEp* this_ptr, _In_ const OrtGraph** graphs, - _In_ const OrtNode** fused_nodes, _In_ size_t count, - _Out_writes_all_(count) OrtNodeComputeInfo** node_compute_infos, - _Out_writes_(count) OrtNode** ep_context_nodes); + ORT_API2_STATUS(Compile, _In_ OrtEp* this_ptr, _In_ const OrtGraph** graphs, + _In_ const OrtNode** fused_nodes, _In_ size_t count, + _Out_writes_all_(count) OrtNodeComputeInfo** node_compute_infos, + _Out_writes_(count) OrtNode** ep_context_nodes); /** \brief Release OrtNodeComputeInfo instances. * @@ -429,9 +429,9 @@ struct OrtEp { * * \since Version 1.23. */ - void(ORT_API_CALL* ReleaseNodeComputeInfos)(_In_ OrtEp* this_ptr, - OrtNodeComputeInfo** node_compute_infos, - _In_ size_t num_node_compute_infos); + ORT_API_T(void, ReleaseNodeComputeInfos, _In_ OrtEp* this_ptr, + OrtNodeComputeInfo** node_compute_infos, + _In_ size_t num_node_compute_infos); /** \brief Get the EP's preferred data layout. * @@ -445,8 +445,7 @@ struct OrtEp { * * \since Version 1.23. */ - OrtStatus*(ORT_API_CALL* GetPreferredDataLayout)(_In_ OrtEp* this_ptr, - _Out_ OrtEpDataLayout* preferred_data_layout); + ORT_API2_STATUS(GetPreferredDataLayout, _In_ OrtEp* this_ptr, _Out_ OrtEpDataLayout* preferred_data_layout); /** \brief Given an op with domain `domain` and type `op_type`, determine whether an associated node's data layout * should be converted to `target_data_layout`. @@ -470,11 +469,10 @@ struct OrtEp { * * \since Version 1.23. */ - OrtStatus*(ORT_API_CALL* ShouldConvertDataLayoutForOp)(_In_ OrtEp* this_ptr, - _In_z_ const char* domain, - _In_z_ const char* op_type, - _In_ OrtEpDataLayout target_data_layout, - _Outptr_ int* should_convert); + ORT_API2_STATUS(ShouldConvertDataLayoutForOp, _In_ OrtEp* this_ptr, + _In_z_ const char* domain, _In_z_ const char* op_type, + _In_ OrtEpDataLayout target_data_layout, + _Outptr_ int* should_convert); /** \brief Set dynamic options on this EP. * @@ -492,10 +490,10 @@ struct OrtEp { * * \since Version 1.23. */ - OrtStatus*(ORT_API_CALL* SetDynamicOptions)(_In_ OrtEp* this_ptr, - _In_reads_(num_options) const char* const* option_keys, - _In_reads_(num_options) const char* const* option_values, - _In_ size_t num_options); + ORT_API2_STATUS(SetDynamicOptions, _In_ OrtEp* this_ptr, + _In_reads_(num_options) const char* const* option_keys, + _In_reads_(num_options) const char* const* option_values, + _In_ size_t num_options); /** \brief Called by ORT to notify the EP of the start of a run. * @@ -508,8 +506,7 @@ struct OrtEp { * * \since Version 1.23. */ - OrtStatus*(ORT_API_CALL* OnRunStart)(_In_ OrtEp* this_ptr, - _In_ const OrtRunOptions* run_options); + ORT_API2_STATUS(OnRunStart, _In_ OrtEp* this_ptr, _In_ const OrtRunOptions* run_options); /** \brief Called by ORT to notify the EP of the end of a run. * @@ -524,9 +521,7 @@ struct OrtEp { * * \since Version 1.23. */ - OrtStatus*(ORT_API_CALL* OnRunEnd)(_In_ OrtEp* this_ptr, - _In_ const OrtRunOptions* run_options, - _In_ bool sync_stream); + ORT_API2_STATUS(OnRunEnd, _In_ OrtEp* this_ptr, _In_ const OrtRunOptions* run_options, _In_ bool sync_stream); }; /** \brief The function signature that ORT will call to create OrtEpFactory instances. @@ -586,7 +581,7 @@ struct OrtEpFactory { * * \since Version 1.22. */ - const char*(ORT_API_CALL* GetName)(const OrtEpFactory* this_ptr); + ORT_API_T(const char*, GetName, const OrtEpFactory* this_ptr); /** \brief Get the name of vendor who owns the execution provider that the factory creates. * @@ -597,7 +592,7 @@ struct OrtEpFactory { * * \since Version 1.22. */ - const char*(ORT_API_CALL* GetVendor)(const OrtEpFactory* this_ptr); // return EP vendor + ORT_API_T(const char*, GetVendor, const OrtEpFactory* this_ptr); // return EP vendor /** \brief Get information from the execution provider about OrtHardwareDevice support. * @@ -616,12 +611,12 @@ struct OrtEpFactory { * * \since Version 1.22. */ - OrtStatus*(ORT_API_CALL* GetSupportedDevices)(_In_ OrtEpFactory* this_ptr, - _In_reads_(num_devices) const OrtHardwareDevice* const* devices, - _In_ size_t num_devices, - _Inout_ OrtEpDevice** ep_devices, - _In_ size_t max_ep_devices, - _Out_ size_t* num_ep_devices); + ORT_API2_STATUS(GetSupportedDevices, _In_ OrtEpFactory* this_ptr, + _In_reads_(num_devices) const OrtHardwareDevice* const* devices, + _In_ size_t num_devices, + _Inout_ OrtEpDevice** ep_devices, + _In_ size_t max_ep_devices, + _Out_ size_t* num_ep_devices); /** \brief Function to create an OrtEp instance for use in a Session. * @@ -647,12 +642,12 @@ struct OrtEpFactory { * * \since Version 1.22. */ - OrtStatus*(ORT_API_CALL* CreateEp)(_In_ OrtEpFactory* this_ptr, - _In_reads_(num_devices) const OrtHardwareDevice* const* devices, - _In_reads_(num_devices) const OrtKeyValuePairs* const* ep_metadata_pairs, - _In_ size_t num_devices, - _In_ const OrtSessionOptions* session_options, - _In_ const OrtLogger* logger, _Outptr_ OrtEp** ep); + ORT_API2_STATUS(CreateEp, _In_ OrtEpFactory* this_ptr, + _In_reads_(num_devices) const OrtHardwareDevice* const* devices, + _In_reads_(num_devices) const OrtKeyValuePairs* const* ep_metadata_pairs, + _In_ size_t num_devices, + _In_ const OrtSessionOptions* session_options, + _In_ const OrtLogger* logger, _Outptr_ OrtEp** ep); /** \brief Release the OrtEp instance. * @@ -661,7 +656,18 @@ struct OrtEpFactory { * * \since Version 1.22. */ - void(ORT_API_CALL* ReleaseEp)(OrtEpFactory* this_ptr, struct OrtEp* ep); + ORT_API_T(void, ReleaseEp, OrtEpFactory* this_ptr, struct OrtEp* ep); + + /** \brief Get the vendor id who owns the execution provider that the factory creates. + * + * This is typically the PCI vendor ID. See https://pcisig.com/membership/member-companies + * + * \param[in] this_ptr The OrtEpFactory instance. + * \return vendor_id The vendor ID of the execution provider the factory creates. + * + * \since Version 1.23. + */ + ORT_API_T(uint32_t, GetVendorId, const OrtEpFactory* this_ptr); /** \brief Get the version of the execution provider that the factory creates. * @@ -675,7 +681,7 @@ struct OrtEpFactory { * * \since Version 1.23. */ - const char*(ORT_API_CALL* GetVersion)(_In_ const OrtEpFactory* this_ptr); + ORT_API_T(const char*, GetVersion, _In_ const OrtEpFactory* this_ptr); /** \brief Create an OrtAllocator for the given OrtMemoryInfo. * diff --git a/onnxruntime/core/providers/cuda/cuda_provider_factory.cc b/onnxruntime/core/providers/cuda/cuda_provider_factory.cc index 2de496a9168a0..f00bf51ae143d 100644 --- a/onnxruntime/core/providers/cuda/cuda_provider_factory.cc +++ b/onnxruntime/core/providers/cuda/cuda_provider_factory.cc @@ -313,8 +313,10 @@ CUDA_Provider* GetProvider() { // OrtEpApi infrastructure to be able to use the CUDA EP as an OrtEpFactory for auto EP selection. struct CudaEpFactory : OrtEpFactory { CudaEpFactory(const OrtApi& ort_api_in) : ort_api{ort_api_in} { + ort_version_supported = ORT_API_VERSION; GetName = GetNameImpl; GetVendor = GetVendorImpl; + GetVendorId = GetVendorIdImpl; GetVersion = GetVersionImpl; GetSupportedDevices = GetSupportedDevicesImpl; CreateEp = CreateEpImpl; @@ -331,6 +333,11 @@ struct CudaEpFactory : OrtEpFactory { return factory->vendor.c_str(); } + static uint32_t GetVendorIdImpl(const OrtEpFactory* this_ptr) noexcept { + const auto* factory = static_cast(this_ptr); + return factory->vendor_id; + } + static const char* ORT_API_CALL GetVersionImpl(const OrtEpFactory* /*this_ptr*/) noexcept { return ORT_VERSION; } @@ -374,6 +381,7 @@ struct CudaEpFactory : OrtEpFactory { const OrtApi& ort_api; const std::string ep_name{kCudaExecutionProvider}; // EP name const std::string vendor{"Microsoft"}; // EP vendor name + uint32_t vendor_id{0x1414}; // Microsoft vendor ID }; extern "C" { diff --git a/onnxruntime/core/providers/qnn/qnn_provider_factory.cc b/onnxruntime/core/providers/qnn/qnn_provider_factory.cc index c679ea1adb286..785177ce37788 100644 --- a/onnxruntime/core/providers/qnn/qnn_provider_factory.cc +++ b/onnxruntime/core/providers/qnn/qnn_provider_factory.cc @@ -125,8 +125,10 @@ struct QnnEpFactory : OrtEpFactory { OrtHardwareDeviceType hw_type, const char* qnn_backend_type) : ort_api{ort_api_in}, ep_name{ep_name}, ort_hw_device_type{hw_type}, qnn_backend_type{qnn_backend_type} { + ort_version_supported = ORT_API_VERSION; GetName = GetNameImpl; GetVendor = GetVendorImpl; + GetVendorId = GetVendorIdImpl; GetVersion = GetVersionImpl; GetSupportedDevices = GetSupportedDevicesImpl; CreateEp = CreateEpImpl; @@ -142,7 +144,12 @@ struct QnnEpFactory : OrtEpFactory { static const char* GetVendorImpl(const OrtEpFactory* this_ptr) noexcept { const auto* factory = static_cast(this_ptr); - return factory->vendor.c_str(); + return factory->ep_vendor.c_str(); + } + + static uint32_t GetVendorIdImpl(const OrtEpFactory* this_ptr) noexcept { + const auto* factory = static_cast(this_ptr); + return factory->ep_vendor_id; } static const char* ORT_API_CALL GetVersionImpl(const OrtEpFactory* /*this_ptr*/) noexcept { @@ -195,8 +202,9 @@ struct QnnEpFactory : OrtEpFactory { } const OrtApi& ort_api; - const std::string ep_name; // EP name - const std::string vendor{"Microsoft"}; // EP vendor name + const std::string ep_name; // EP name + const std::string ep_vendor{"Microsoft"}; // EP vendor name + uint32_t ep_vendor_id{0x1414}; // Microsoft vendor ID // Qualcomm vendor ID. Refer to the ACPI ID registry (search Qualcomm): https://uefi.org/ACPI_ID_List const uint32_t vendor_id{'Q' | ('C' << 8) | ('O' << 16) | ('M' << 24)}; diff --git a/onnxruntime/core/session/ep_api_utils.h b/onnxruntime/core/session/ep_api_utils.h index daccd24453371..a0904c32011a7 100644 --- a/onnxruntime/core/session/ep_api_utils.h +++ b/onnxruntime/core/session/ep_api_utils.h @@ -16,6 +16,10 @@ struct ForwardToFactory { return static_cast(this_ptr)->GetVendor(); } + static uint32_t ORT_API_CALL GetVendorId(const OrtEpFactory* this_ptr) noexcept { + return static_cast(this_ptr)->GetVendorId(); + } + static const char* ORT_API_CALL GetVersion(const OrtEpFactory* this_ptr) noexcept { return static_cast(this_ptr)->GetVersion(); } diff --git a/onnxruntime/core/session/ep_factory_internal.cc b/onnxruntime/core/session/ep_factory_internal.cc index b289010cc6c5b..fa4ef2515ca92 100644 --- a/onnxruntime/core/session/ep_factory_internal.cc +++ b/onnxruntime/core/session/ep_factory_internal.cc @@ -14,17 +14,19 @@ namespace onnxruntime { using Forward = ForwardToFactory; -EpFactoryInternal::EpFactoryInternal(const std::string& ep_name, const std::string& vendor, +EpFactoryInternal::EpFactoryInternal(const std::string& ep_name, const std::string& vendor, uint32_t vendor_id, GetSupportedFunc&& get_supported_func, CreateFunc&& create_func) : ep_name_{ep_name}, vendor_{vendor}, + vendor_id_{vendor_id}, get_supported_func_{std::move(get_supported_func)}, create_func_{create_func} { ort_version_supported = ORT_API_VERSION; OrtEpFactory::GetName = Forward::GetFactoryName; OrtEpFactory::GetVendor = Forward::GetVendor; + OrtEpFactory::GetVendorId = Forward::GetVendorId; OrtEpFactory::GetVersion = Forward::GetVersion; OrtEpFactory::GetSupportedDevices = Forward::GetSupportedDevices; OrtEpFactory::CreateEp = Forward::CreateEp; diff --git a/onnxruntime/core/session/ep_factory_internal.h b/onnxruntime/core/session/ep_factory_internal.h index 087c0c60f8f4e..ee08e2233c529 100644 --- a/onnxruntime/core/session/ep_factory_internal.h +++ b/onnxruntime/core/session/ep_factory_internal.h @@ -33,12 +33,13 @@ class EpFactoryInternal : public OrtEpFactory { const OrtSessionOptions* session_options, const OrtLogger* logger, std::unique_ptr* ep)>; - EpFactoryInternal(const std::string& ep_name, const std::string& vendor, + EpFactoryInternal(const std::string& ep_name, const std::string& vendor, uint32_t vendor_id, GetSupportedFunc&& get_supported_func, CreateFunc&& create_func); const char* GetName() const noexcept { return ep_name_.c_str(); } const char* GetVendor() const noexcept { return vendor_.c_str(); } + uint32_t GetVendorId() const noexcept { return vendor_id_; } const char* GetVersion() const noexcept; OrtStatus* GetSupportedDevices(_In_reads_(num_devices) const OrtHardwareDevice* const* devices, @@ -67,6 +68,7 @@ class EpFactoryInternal : public OrtEpFactory { private: const std::string ep_name_; // EP name library was registered with const std::string vendor_; // EP vendor name + const uint32_t vendor_id_; // EP vendor ID const GetSupportedFunc get_supported_func_; // function to return supported devices const CreateFunc create_func_; // function to create the EP instance diff --git a/onnxruntime/core/session/ep_library_internal.cc b/onnxruntime/core/session/ep_library_internal.cc index 25f70f7549a16..ce5736f601b45 100644 --- a/onnxruntime/core/session/ep_library_internal.cc +++ b/onnxruntime/core/session/ep_library_internal.cc @@ -61,7 +61,8 @@ std::unique_ptr EpLibraryInternal::CreateCpuEp() { }; std::string ep_name = kCpuExecutionProvider; - auto cpu_factory = std::make_unique(ep_name, "Microsoft", get_supported, create_cpu_ep); + auto cpu_factory = std::make_unique(ep_name, "Microsoft", OrtDevice::VendorIds::MICROSOFT, + get_supported, create_cpu_ep); return std::make_unique(std::move(cpu_factory)); } @@ -122,7 +123,8 @@ std::unique_ptr EpLibraryInternal::CreateDmlEp() { return nullptr; }; - auto dml_factory = std::make_unique(ep_name, "Microsoft", is_supported, create_dml_ep); + auto dml_factory = std::make_unique(ep_name, "Microsoft", OrtDevice::VendorIds::MICROSOFT, + is_supported, create_dml_ep); return std::make_unique(std::move(dml_factory)); } @@ -170,7 +172,8 @@ std::unique_ptr EpLibraryInternal::CreateWebGpuEp() { return nullptr; }; - auto webgpu_factory = std::make_unique(ep_name, "Microsoft", is_supported, create_webgpu_ep); + auto webgpu_factory = std::make_unique(ep_name, "Microsoft", OrtDevice::VendorIds::MICROSOFT, + is_supported, create_webgpu_ep); return std::make_unique(std::move(webgpu_factory)); } diff --git a/onnxruntime/core/session/ep_library_provider_bridge.cc b/onnxruntime/core/session/ep_library_provider_bridge.cc index 73423a4744576..70937bdc5d3e8 100644 --- a/onnxruntime/core/session/ep_library_provider_bridge.cc +++ b/onnxruntime/core/session/ep_library_provider_bridge.cc @@ -72,6 +72,7 @@ Status EpLibraryProviderBridge::Load() { auto internal_factory = std::make_unique(factory->GetName(factory), factory->GetVendor(factory), + factory->GetVendorId(factory), is_supported_fn, create_fn); factory_ptrs_.push_back(internal_factory.get()); diff --git a/onnxruntime/core/session/provider_policy_context.cc b/onnxruntime/core/session/provider_policy_context.cc index e8d62ab86f517..211bf8b2d15a4 100644 --- a/onnxruntime/core/session/provider_policy_context.cc +++ b/onnxruntime/core/session/provider_policy_context.cc @@ -22,7 +22,13 @@ namespace onnxruntime { namespace { bool MatchesEpVendor(const OrtEpDevice* d) { - // TODO: Would be better to match on Id. Should the EP add that in EP metadata? + // match on vendor id if provided + uint32_t factory_vendor_id = d->ep_factory->GetVendorId(d->ep_factory); + if (factory_vendor_id != 0 && d->device->vendor_id == factory_vendor_id) { + return true; + } + + // match on vendor name return d->device->vendor == d->ep_vendor; } diff --git a/onnxruntime/test/autoep/library/ep.cc b/onnxruntime/test/autoep/library/ep.cc index b498c40079f48..3e19a1c97b945 100644 --- a/onnxruntime/test/autoep/library/ep.cc +++ b/onnxruntime/test/autoep/library/ep.cc @@ -226,7 +226,7 @@ OrtStatus* ExampleEp::SaveConstantInitializers(const OrtGraph* graph) { /*static*/ OrtStatus* ORT_API_CALL ExampleEp::GetCapabilityImpl(OrtEp* this_ptr, const OrtGraph* graph, - OrtEpGraphSupportInfo* graph_support_info) { + OrtEpGraphSupportInfo* graph_support_info) noexcept { ExampleEp* ep = static_cast(this_ptr); size_t num_nodes = 0; @@ -290,7 +290,7 @@ OrtStatus* ORT_API_CALL ExampleEp::GetCapabilityImpl(OrtEp* this_ptr, const OrtG OrtStatus* ORT_API_CALL ExampleEp::CompileImpl(_In_ OrtEp* this_ptr, _In_ const OrtGraph** graphs, _In_ const OrtNode** fused_nodes, _In_ size_t count, _Out_writes_all_(count) OrtNodeComputeInfo** node_compute_infos, - _Out_writes_(count) OrtNode** ep_context_nodes) { + _Out_writes_(count) OrtNode** ep_context_nodes) noexcept { ExampleEp* ep = static_cast(this_ptr); const OrtApi& ort_api = ep->ort_api; @@ -354,7 +354,7 @@ OrtStatus* ORT_API_CALL ExampleEp::CompileImpl(_In_ OrtEp* this_ptr, _In_ const /*static*/ void ORT_API_CALL ExampleEp::ReleaseNodeComputeInfosImpl(OrtEp* this_ptr, OrtNodeComputeInfo** node_compute_infos, - size_t num_node_compute_infos) { + size_t num_node_compute_infos) noexcept { (void)this_ptr; for (size_t i = 0; i < num_node_compute_infos; i++) { delete node_compute_infos[i]; diff --git a/onnxruntime/test/autoep/library/ep.h b/onnxruntime/test/autoep/library/ep.h index b8c63f39438ba..dfebcc52a0caf 100644 --- a/onnxruntime/test/autoep/library/ep.h +++ b/onnxruntime/test/autoep/library/ep.h @@ -31,14 +31,14 @@ class ExampleEp : public OrtEp, public ApiPtrs { private: static const char* ORT_API_CALL GetNameImpl(const OrtEp* this_ptr) noexcept; static OrtStatus* ORT_API_CALL ExampleEp::GetCapabilityImpl(OrtEp* this_ptr, const OrtGraph* graph, - OrtEpGraphSupportInfo* graph_support_info); + OrtEpGraphSupportInfo* graph_support_info) noexcept; static OrtStatus* ORT_API_CALL CompileImpl(_In_ OrtEp* this_ptr, _In_ const OrtGraph** graphs, _In_ const OrtNode** fused_nodes, _In_ size_t count, _Out_writes_all_(count) OrtNodeComputeInfo** node_compute_infos, - _Out_writes_(count) OrtNode** ep_context_nodes); + _Out_writes_(count) OrtNode** ep_context_nodes) noexcept; static void ORT_API_CALL ReleaseNodeComputeInfosImpl(OrtEp* this_ptr, OrtNodeComputeInfo** node_compute_infos, - size_t num_node_compute_infos); + size_t num_node_compute_infos) noexcept; OrtStatus* CreateEpContextNodes(gsl::span fused_nodes, /*out*/ gsl::span ep_context_nodes); diff --git a/onnxruntime/test/autoep/library/ep_factory.cc b/onnxruntime/test/autoep/library/ep_factory.cc index d4895102b0bf1..19a44008b8c97 100644 --- a/onnxruntime/test/autoep/library/ep_factory.cc +++ b/onnxruntime/test/autoep/library/ep_factory.cc @@ -14,6 +14,7 @@ ExampleEpFactory::ExampleEpFactory(const char* ep_name, ApiPtrs apis) ort_version_supported = ORT_API_VERSION; // set to the ORT version we were compiled with. GetName = GetNameImpl; GetVendor = GetVendorImpl; + GetVendorId = GetVendorIdImpl; GetVersion = GetVersionImpl; GetSupportedDevices = GetSupportedDevicesImpl; @@ -87,6 +88,12 @@ const char* ORT_API_CALL ExampleEpFactory::GetVendorImpl(const OrtEpFactory* thi return factory->vendor_.c_str(); } +/*static*/ +uint32_t ORT_API_CALL ExampleEpFactory::GetVendorIdImpl(const OrtEpFactory* this_ptr) noexcept { + const auto* factory = static_cast(this_ptr); + return factory->vendor_id_; +} + /*static*/ const char* ORT_API_CALL ExampleEpFactory::GetVersionImpl(const OrtEpFactory* this_ptr) noexcept { const auto* factory = static_cast(this_ptr); diff --git a/onnxruntime/test/autoep/library/ep_factory.h b/onnxruntime/test/autoep/library/ep_factory.h index fda77f12c4814..72fa1c1301841 100644 --- a/onnxruntime/test/autoep/library/ep_factory.h +++ b/onnxruntime/test/autoep/library/ep_factory.h @@ -21,6 +21,7 @@ class ExampleEpFactory : public OrtEpFactory, public ApiPtrs { static const char* ORT_API_CALL GetNameImpl(const OrtEpFactory* this_ptr) noexcept; static const char* ORT_API_CALL GetVendorImpl(const OrtEpFactory* this_ptr) noexcept; + static uint32_t ORT_API_CALL GetVendorIdImpl(const OrtEpFactory* this_ptr) noexcept; static const char* ORT_API_CALL GetVersionImpl(const OrtEpFactory* this_ptr) noexcept; @@ -53,6 +54,7 @@ class ExampleEpFactory : public OrtEpFactory, public ApiPtrs { const std::string ep_name_; // EP name const std::string vendor_{"Contoso"}; // EP vendor name + const uint32_t vendor_id_{0xB357}; // EP vendor ID const std::string ep_version_{"0.1.0"}; // EP version // CPU allocator so we can control the arena behavior. optional as ORT always provides a CPU allocator if needed. diff --git a/onnxruntime/test/framework/ep_plugin_provider_test.cc b/onnxruntime/test/framework/ep_plugin_provider_test.cc index 18bc9cf05b36d..4c5dcd2bd7580 100644 --- a/onnxruntime/test/framework/ep_plugin_provider_test.cc +++ b/onnxruntime/test/framework/ep_plugin_provider_test.cc @@ -36,7 +36,7 @@ struct TestOrtEp : ::OrtEp, ApiPtrs { // Individual tests should fill out the other function pointers as needed. } - static const char* ORT_API_CALL GetNameImpl(const OrtEp* /*this_ptr*/) { + static const char* ORT_API_CALL GetNameImpl(const OrtEp* /*this_ptr*/) noexcept { constexpr const char* ep_name = "TestOrtEp"; return ep_name; } @@ -50,7 +50,7 @@ struct TestOrtEpFactory : ::OrtEpFactory { ReleaseEp = ReleaseEpImpl; } - static void ORT_API_CALL ReleaseEpImpl(::OrtEpFactory* /*this_ptr*/, OrtEp* ep) { + static void ORT_API_CALL ReleaseEpImpl(::OrtEpFactory* /*this_ptr*/, OrtEp* ep) noexcept { delete static_cast(ep); } }; @@ -125,7 +125,7 @@ TEST(PluginExecutionProviderTest, GetPreferredLayout) { } { - auto prefer_nhwc_fn = [](OrtEp* /*this_ptr*/, OrtEpDataLayout* preferred_data_layout) -> ::OrtStatus* { + auto prefer_nhwc_fn = [](OrtEp* /*this_ptr*/, OrtEpDataLayout* preferred_data_layout) noexcept -> ::OrtStatus* { *preferred_data_layout = OrtEpDataLayout::OrtEpDataLayout_NCHW; return nullptr; }; @@ -135,7 +135,7 @@ TEST(PluginExecutionProviderTest, GetPreferredLayout) { #if !defined(ORT_NO_EXCEPTIONS) { - auto invalid_layout_fn = [](OrtEp* /*this_ptr*/, OrtEpDataLayout* preferred_data_layout) -> ::OrtStatus* { + auto invalid_layout_fn = [](OrtEp* /*this_ptr*/, OrtEpDataLayout* preferred_data_layout) noexcept -> ::OrtStatus* { *preferred_data_layout = static_cast(-1); return nullptr; }; @@ -144,7 +144,7 @@ TEST(PluginExecutionProviderTest, GetPreferredLayout) { } { - auto failing_fn = [](OrtEp* this_ptr, OrtEpDataLayout* /*preferred_data_layout*/) -> ::OrtStatus* { + auto failing_fn = [](OrtEp* this_ptr, OrtEpDataLayout* /*preferred_data_layout*/) noexcept -> ::OrtStatus* { auto* test_ort_ep = static_cast(this_ptr); return test_ort_ep->ort_api->CreateStatus(OrtErrorCode::ORT_FAIL, "I can't decide what data layout I prefer."); }; @@ -167,7 +167,7 @@ TEST(PluginExecutionProviderTest, ShouldConvertDataLayoutForOp) { const char* /*node_domain*/, const char* node_op_type, OrtEpDataLayout target_data_layout, - int* should_convert) -> ::OrtStatus* { + int* should_convert) noexcept -> ::OrtStatus* { EXPECT_EQ(target_data_layout, OrtEpDataLayout::OrtEpDataLayout_NHWC); if (node_op_type == std::string_view{"Conv"}) { @@ -201,7 +201,7 @@ TEST(PluginExecutionProviderTest, ShouldConvertDataLayoutForOp) { const char* /*node_domain*/, const char* /*node_op_type*/, OrtEpDataLayout /*target_data_layout*/, - int* /*should_convert*/) -> ::OrtStatus* { + int* /*should_convert*/) noexcept -> ::OrtStatus* { auto* test_ort_ep = static_cast(this_ptr); return test_ort_ep->ort_api->CreateStatus(OrtErrorCode::ORT_FAIL, "To convert to NHWC or not to convert to NHWC...");