Skip to content

AutoSelect EP Infrastructure Part 2. #24455

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

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions cmake/onnxruntime_unittests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1802,10 +1802,10 @@ endif()
# Build library that can be used with RegisterExecutionProviderLibrary and automatic EP selection
# We need a shared lib build to use that as a dependency for the test library
if (onnxruntime_BUILD_SHARED_LIB AND NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten" AND NOT onnxruntime_MINIMAL_BUILD)
onnxruntime_add_shared_library_module(example_plugin_ep_library
onnxruntime_add_shared_library_module(example_plugin_ep
${TEST_SRC_DIR}/autoep/library/example_plugin_ep.cc)
target_include_directories(example_plugin_ep_library PRIVATE ${REPO_ROOT}/include/onnxruntime/core/session)
target_link_libraries( example_plugin_ep_library PRIVATE onnxruntime)
target_include_directories(example_plugin_ep PRIVATE ${REPO_ROOT}/include/onnxruntime/core/session)
target_link_libraries(example_plugin_ep PRIVATE onnxruntime)

if(UNIX)
if (APPLE)
Expand All @@ -1820,7 +1820,7 @@ if (onnxruntime_BUILD_SHARED_LIB AND NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten"
"-DEF:${TEST_SRC_DIR}/autoep/library/example_plugin_ep_library.def")
endif()

set_property(TARGET example_plugin_ep_library APPEND_STRING PROPERTY LINK_FLAGS
set_property(TARGET example_plugin_ep APPEND_STRING PROPERTY LINK_FLAGS
${ONNXRUNTIME_AUTOEP_LIB_LINK_FLAG})

# test library
Expand Down Expand Up @@ -1850,7 +1850,7 @@ if (onnxruntime_BUILD_SHARED_LIB AND NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten"
TARGET onnxruntime_autoep_test
SOURCES ${onnxruntime_autoep_test_SRC} ${onnxruntime_unittest_main_src}
LIBS ${onnxruntime_autoep_test_LIBS}
DEPENDS ${all_dependencies} example_plugin_ep_library
DEPENDS ${all_dependencies} example_plugin_ep
)
endif()

Expand Down
19 changes: 12 additions & 7 deletions include/onnxruntime/core/session/onnxruntime_c_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -5072,8 +5072,12 @@
*
* \param[in] session_options Session options to add execution provider to.
* \param[in] env Environment that execution providers were registered with.
* \param[in] ep_name Execution provider to add. Use GetEpDevices to discover the available execution providers and
* the devices they will use.
* \param[in] ep_devices One or more OrtEpDevice instances to create an execution provider for.
* Obtain from GetEpDevices. All OrtEpDevice instances must be from the same execution
* provider. It is only necessary to provide multiple OrtEpDevices if you want to use the
* same execution provider for multiple devices.
* e.g. the EP is capable of running on GPU and NPU.
* \param[in] num_ep_devices Number of OrtEpDevice instances.
* \param[in] ep_option_keys Optional keys to configure the execution provider.
* \param[in] ep_option_vals Optional values to configure the execution provider.
* \param[in] num_ep_options Number of execution provide options to add.
Expand All @@ -5083,7 +5087,8 @@
* \since Version 1.22.
*/
ORT_API2_STATUS(SessionOptionsAppendExecutionProvider_V2, _In_ OrtSessionOptions* session_options,
_In_ OrtEnv* env, _In_ const char* ep_name,
_In_ OrtEnv* env,
_In_reads_(num_ep_devices) const OrtEpDevice* const* ep_devices, _In_ size_t num_ep_devices,
_In_reads_(num_op_options) const char* const* ep_option_keys,
_In_reads_(num_op_options) const char* const* ep_option_vals,
size_t num_ep_options);
Expand All @@ -5104,7 +5109,7 @@
*
* \since Version 1.22.
*/
int32_t(ORT_API_CALL* HardwareDevice_VendorId)(_In_ const OrtHardwareDevice* device);
uint32_t(ORT_API_CALL* HardwareDevice_VendorId)(_In_ const OrtHardwareDevice* device);

Check warning on line 5112 in include/onnxruntime/core/session/onnxruntime_c_api.h

View workflow job for this annotation

GitHub Actions / Optional Lint C++

[cpplint] reported by reviewdog 🐶 Using deprecated casting style. Use static_cast<uint32_t>(...) instead [readability/casting] [4] Raw Output: include/onnxruntime/core/session/onnxruntime_c_api.h:5112: Using deprecated casting style. Use static_cast<uint32_t>(...) instead [readability/casting] [4]

/** \brief Get the hardware device's vendor name.
*
Expand All @@ -5118,12 +5123,12 @@
/** \brief Get the hardware device's unique identifier.
*
* \param[in] device The OrtHardwareDevice instance to query.
* \return The bus ID of the device.
* \return The device id.
*
* \note This is not a unique identifier. It identifies the hardware type when combined with vendor id.
* \since Version 1.22.
*/
// ??? does the user care about the 'bus' part or could this just be HardwareDevice_Id?
int32_t(ORT_API_CALL* HardwareDevice_BusId)(_In_ const OrtHardwareDevice* device);
uint32_t(ORT_API_CALL* HardwareDevice_DeviceId)(_In_ const OrtHardwareDevice* device);

Check warning on line 5131 in include/onnxruntime/core/session/onnxruntime_c_api.h

View workflow job for this annotation

GitHub Actions / Optional Lint C++

[cpplint] reported by reviewdog 🐶 Using deprecated casting style. Use static_cast<uint32_t>(...) instead [readability/casting] [4] Raw Output: include/onnxruntime/core/session/onnxruntime_c_api.h:5131: Using deprecated casting style. Use static_cast<uint32_t>(...) instead [readability/casting] [4]

/** \brief Get hardware device metadata.
*
Expand Down
Loading
Loading