Skip to content

Add vendor id to OrtEpFactory and default ORT logger to CreateEpFactories #25365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

skottmckay
Copy link
Contributor

@skottmckay skottmckay commented Jul 11, 2025

Description

Add vendor id to OrtEpFactory. It's easier to get the vendor id than name on other platforms.
Update the selection policy to prefer match on vendor id with fallback to vendor name.

Add default ORT logger to CreateEpFactories.
The OrtEpFactory currently has no way to log informational messages or issues.
CreateEp is given the session logger for use by the OrtEp instance so that part of things is good.

Misc cleanups. Make usage of ORT_API2_STATUS and ORT_API_T consistent on onnxruntime_ep_c_api.h.
See ort_version_supported in some EP factories where it was missed.

Motivation and Context

Vendor id is easier to match against OrtHardwareDevice when doing auto EP selection.
OrtEpFactory should have a logger.
Last chance to cleanup APIs before 1.23 release

Prefer matching on vendor id with fallback to matching on name in the selection policy.
Make usage of ORT_API2_STATUS and ORT_API_T consistent in onnxruntime_ep_c_api.h. Update
@skottmckay skottmckay changed the title Add vendor id to OrtEpFactory Add vendor id to OrtEpFactory and default ORT logger to CreateEpFactories Jul 12, 2025
@skottmckay skottmckay requested a review from Copilot July 12, 2025 06:03
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds vendor ID support to OrtEpFactory and configures default ORT loggers for EP factories, while cleaning up C API macros and enhancing EP selection logic.

  • Extended OrtEpFactory interface and implementations to include GetVendorId
  • Updated auto-EP selection to match by vendor ID first, then vendor name
  • Refactored C API headers (onnxruntime_ep_c_api.h) to use ORT_API_T/ORT_API2_STATUS macros

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
onnxruntime/test/framework/ep_plugin_provider_test.cc Added noexcept to callback implementations
onnxruntime/test/autoep/library/ep_factory.h Declared new GetVendorIdImpl in test EP factory header
onnxruntime/test/autoep/library/ep_factory.cc Implemented GetVendorIdImpl and wired it into factory
onnxruntime/test/autoep/library/ep.h Added noexcept to ExampleEp callbacks
onnxruntime/test/autoep/library/ep.cc Propagated noexcept to ExampleEp method definitions
onnxruntime/core/session/provider_policy_context.cc Updated MatchesEpVendor to prefer matching vendor ID
onnxruntime/core/session/ep_library_provider_bridge.cc Passed GetVendorId into EpFactoryInternal constructors
onnxruntime/core/session/ep_library_internal.cc Updated built-in EP factories to include vendor IDs
onnxruntime/core/session/ep_factory_internal.h Added vendor_id_ member and GetVendorId method
onnxruntime/core/session/ep_factory_internal.cc Wired new vendor_id_ through constructor and API
onnxruntime/core/session/ep_api_utils.h Added forwarder for GetVendorId
onnxruntime/core/providers/qnn/qnn_provider_factory.cc Renamed vendor fields, added GetVendorIdImpl
onnxruntime/core/providers/cuda/cuda_provider_factory.cc Added GetVendorIdImpl and vendor_id member
include/onnxruntime/core/session/onnxruntime_ep_c_api.h Switched callbacks to ORT_API_T/ORT_API2_STATUS macros
Comments suppressed due to low confidence (3)

onnxruntime/core/providers/qnn/qnn_provider_factory.cc:207

  • [nitpick] Having both ep_vendor_id and vendor_id members in QnnEpFactory is confusing; consider renaming vendor_id to something like qc_vendor_id or consolidating to a single vendor_id member to improve clarity.
  uint32_t ep_vendor_id{0x1414};             // Microsoft vendor ID

onnxruntime/core/session/provider_policy_context.cc:26

  • You've added logic to select EPs by vendor ID with fallback to vendor name, but there aren't tests covering this new behavior; consider adding unit tests for MatchesEpVendor to validate vendor ID matching and fallback.
  uint32_t factory_vendor_id = d->ep_factory->GetVendorId(d->ep_factory);

onnxruntime/test/autoep/library/ep.h:34

  • [nitpick] Inside class ExampleEp, the static method declaration redundantly qualifies the method with ExampleEp::; remove the ExampleEp:: prefix here to match the style used for other methods.
                                                              OrtEpGraphSupportInfo* graph_support_info) noexcept;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant