Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f319185

Browse files
skottmckaygithub-actions[bot]adrianlizarraga
authored andcommittedApr 24, 2025
Add infrastructure for auto EP selection (#24430)
### Description <!-- Describe your changes. --> Add infrastructure to enable auto EP selection. Device discovery for CPU/GPU/NPU on Windows. Supports internal (CPU/DML/WebGPU) and provider bridge (CUDA) EPs currently. Infrastructure will be used with plugin EPs next. Selection policy implementation will be added next, so in the interim there's a temporary function with manually specified selection so unit tests can cover the end-to-end. ### Motivation and Context <!-- - Why is this change required? What problem does it solve? - If it fixes an open issue, please link to the issue here. --> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Adrian Lizarraga <adlizarraga@microsoft.com>
1 parent 3df4811 commit f319185

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+3372
-154
lines changed
 

‎cmake/onnxruntime_common.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ set(onnxruntime_common_src_patterns
1111
"${ONNXRUNTIME_ROOT}/core/common/logging/*.cc"
1212
"${ONNXRUNTIME_ROOT}/core/common/logging/sinks/*.h"
1313
"${ONNXRUNTIME_ROOT}/core/common/logging/sinks/*.cc"
14+
"${ONNXRUNTIME_ROOT}/core/platform/device_discovery.h"
15+
"${ONNXRUNTIME_ROOT}/core/platform/device_discovery.cc"
1416
"${ONNXRUNTIME_ROOT}/core/platform/env.h"
1517
"${ONNXRUNTIME_ROOT}/core/platform/env.cc"
1618
"${ONNXRUNTIME_ROOT}/core/platform/env_time.h"
@@ -157,6 +159,9 @@ if(APPLE)
157159
target_link_libraries(onnxruntime_common PRIVATE "-framework Foundation")
158160
endif()
159161

162+
if(MSVC)
163+
target_link_libraries(onnxruntime_common PRIVATE dxcore.lib)
164+
endif()
160165

161166
if(MSVC)
162167
if(onnxruntime_target_platform STREQUAL "ARM64")
@@ -205,7 +210,6 @@ elseif(NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
205210
endif()
206211
endif()
207212

208-
209213
if (RISCV64 OR ARM64 OR ARM OR X86 OR X64 OR X86_64)
210214
# Link cpuinfo if supported
211215
# Using it mainly in ARM with Android.

‎cmake/onnxruntime_session.cmake

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,17 @@ if (onnxruntime_ENABLE_TRAINING_APIS)
1818
list(APPEND onnxruntime_session_srcs ${training_api_srcs})
1919
endif()
2020

21-
21+
# disable for all minimal builds. enabling this pulls in all the provider bridge stuff,
22+
# which is not enabled for any minimal builds.
2223
if (onnxruntime_MINIMAL_BUILD)
24+
file(GLOB autoep_srcs
25+
"${ONNXRUNTIME_ROOT}/core/session/ep_*.*"
26+
)
27+
2328
set(onnxruntime_session_src_exclude
2429
"${ONNXRUNTIME_ROOT}/core/session/provider_bridge_ort.cc"
2530
"${ONNXRUNTIME_ROOT}/core/session/model_builder_c_api.cc"
31+
${autoep_srcs}
2632
)
2733

2834
list(REMOVE_ITEM onnxruntime_session_srcs ${onnxruntime_session_src_exclude})

0 commit comments

Comments
 (0)
Please sign in to comment.