Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions cmake/deps.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,4 @@ kleidiai;https://github.com/ARM-software/kleidiai/archive/refs/tags/v1.20.0.tar.
# this entry will be updated to use refs/tags/<version> instead of the raw commit hash.
kleidiai-qmx;https://github.com/qualcomm/kleidiai/archive/2f10c9a8d32f81ffeeb6d4885a29cc35d2b0da87.zip;5e855730a2d69057a569f43dd7532db3b2d2a05c
duktape;https://github.com/svaarala/duktape/releases/download/v2.7.0/duktape-2.7.0.tar.xz;8200c8e417dbab7adcc12c4dbdef7651cfc55794
directx_headers;https://codeload.github.com/microsoft/DirectX-Headers/tar.gz/refs/tags/v1.618.2;179ee2ecb714e07510e6a3607072d4948d67ed24
10 changes: 10 additions & 0 deletions cmake/external/onnxruntime_external_deps.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -878,3 +878,13 @@ FILE(TO_NATIVE_PATH ${CMAKE_BINARY_DIR} ORT_BINARY_DIR)
FILE(TO_NATIVE_PATH ${PROJECT_SOURCE_DIR} ORT_SOURCE_DIR)

message(STATUS "Finished fetching external dependencies")

if(UNIX AND NOT APPLE)
onnxruntime_fetchcontent_declare(
directx_headers
URL ${DEP_URL_directx_headers}
URL_HASH SHA1=${DEP_SHA1_directx_headers}
EXCLUDE_FROM_ALL
)
onnxruntime_fetchcontent_makeavailable(directx_headers)
endif()
8 changes: 7 additions & 1 deletion cmake/onnxruntime_common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ if (WIN32)
"${ONNXRUNTIME_ROOT}/core/platform/windows/device_discovery.cc")
elseif (LINUX)
list(APPEND onnxruntime_common_src_patterns
"${ONNXRUNTIME_ROOT}/core/platform/linux/device_discovery.cc")
"${ONNXRUNTIME_ROOT}/core/platform/linux/device_discovery.cc"
"${ONNXRUNTIME_ROOT}/core/platform/linux/wsl_device_discovery.cc")
elseif (APPLE)
list(APPEND onnxruntime_common_src_patterns
"${ONNXRUNTIME_ROOT}/core/platform/apple/device_discovery.cc")
Expand Down Expand Up @@ -130,6 +131,11 @@ if(WIN32)
endif()
endif()

if(LINUX)
# For WSL device discovery
target_link_libraries(onnxruntime_common PRIVATE DirectX-Headers)
endif()

if(NOT WIN32 AND NOT APPLE AND NOT ANDROID AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
set_source_files_properties(
${ONNXRUNTIME_ROOT}/core/common/spin_pause.cc
Expand Down
7 changes: 5 additions & 2 deletions onnxruntime/core/platform/linux/device_discovery.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
#include <optional>
#include <regex>
#include <string_view>
#include <system_error>

#include "core/common/common.h"
#include "core/common/logging/logging.h"
#include "core/common/parse_string.h"
#include "core/common/string_utils.h"
#include "core/platform/linux/wsl_device_discovery.h"

namespace fs = std::filesystem;

Expand Down Expand Up @@ -127,8 +129,7 @@ Status GetPciBusId(const std::filesystem::path& sysfs_path, std::optional<std::s
if (std::regex_match(pci_bus_id_filename.string(), pci_bus_id_regex)) {
pci_bus_id = pci_bus_id_filename.string();
} else {
pci_bus_id = {};
LOGS_DEFAULT(WARNING) << MakeString("Skipping pci_bus_id for PCI path at \"",
pci_bus_id = {}; LOGS_DEFAULT(WARNING) << MakeString("Skipping pci_bus_id for PCI path at \"",
pci_bus_id_path.string(),
"\" because filename \"", pci_bus_id_filename, "\" dit not match expected pattern of ",
regex_pattern);
Expand Down Expand Up @@ -188,6 +189,8 @@ Status GetGpuDevices(std::vector<OrtHardwareDevice>& gpu_devices_out) {
gpu_devices.emplace_back(std::move(gpu_device));
}

ORT_RETURN_IF_ERROR(DetectGpuIfWsl(gpu_devices));

gpu_devices_out = std::move(gpu_devices);
return Status::OK();
}
Expand Down
Loading