From f3bf120b10a51fb1df68958e3a783bb4fcbf2119 Mon Sep 17 00:00:00 2001 From: Stephan Seitz Date: Wed, 28 Jan 2026 10:35:36 +0100 Subject: [PATCH 1/2] [CORE]: Address review dog lints in #26210 (Linux device discovery) Review dog lints: https://github.com/microsoft/onnxruntime/pull/26210/changes Plus a typo: `dit` -> `did` --- onnxruntime/core/platform/linux/device_discovery.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/onnxruntime/core/platform/linux/device_discovery.cc b/onnxruntime/core/platform/linux/device_discovery.cc index db6ac73996863..6b17e27560705 100644 --- a/onnxruntime/core/platform/linux/device_discovery.cc +++ b/onnxruntime/core/platform/linux/device_discovery.cc @@ -8,6 +8,7 @@ #include #include #include +#include #include #include "core/common/common.h" @@ -130,9 +131,9 @@ Status GetPciBusId(const std::filesystem::path& sysfs_path, std::optional Date: Wed, 28 Jan 2026 10:50:20 +0100 Subject: [PATCH 2/2] [CORE]: Improve filesystem error messages during Linux device discovery ErrorCodeToStatus currently does not include the filesystem path that caused the error. This could it make difficult to know the root cause of a reported filesystem error. --- onnxruntime/core/platform/linux/device_discovery.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/onnxruntime/core/platform/linux/device_discovery.cc b/onnxruntime/core/platform/linux/device_discovery.cc index 6b17e27560705..3076d3a1e33b6 100644 --- a/onnxruntime/core/platform/linux/device_discovery.cc +++ b/onnxruntime/core/platform/linux/device_discovery.cc @@ -22,14 +22,17 @@ namespace onnxruntime { namespace { -Status ErrorCodeToStatus(const std::error_code& ec) { +Status ErrorCodeToStatus(const std::error_code& ec, const fs::path& path, std::string_view context) { if (!ec) { return Status::OK(); } return Status{common::StatusCategory::ONNXRUNTIME, common::StatusCode::FAIL, MakeString("Error: std::error_code with category name: ", ec.category().name(), - ", value: ", ec.value(), ", message: ", ec.message())}; + ", value: ", ec.value(), + ", message: ", ec.message(), + ", filesystem path: ", path, + ", context: ", context)}; } struct GpuSysfsPathInfo { @@ -41,7 +44,7 @@ Status DetectGpuSysfsPaths(std::vector& gpu_sysfs_paths_out) { std::error_code error_code{}; const fs::path sysfs_class_drm_path = "/sys/class/drm"; const bool sysfs_class_drm_path_exists = fs::exists(sysfs_class_drm_path, error_code); - ORT_RETURN_IF_ERROR(ErrorCodeToStatus(error_code)); + ORT_RETURN_IF_ERROR(ErrorCodeToStatus(error_code, sysfs_class_drm_path, "Checking existance of DRM sysfs path")); if (!sysfs_class_drm_path_exists) { gpu_sysfs_paths_out = std::vector{}; @@ -70,7 +73,7 @@ Status DetectGpuSysfsPaths(std::vector& gpu_sysfs_paths_out) { std::vector gpu_sysfs_paths{}; auto dir_iterator = fs::directory_iterator{sysfs_class_drm_path, error_code}; - ORT_RETURN_IF_ERROR(ErrorCodeToStatus(error_code)); + ORT_RETURN_IF_ERROR(ErrorCodeToStatus(error_code, sysfs_class_drm_path, "Iterating over DRM sysfs devices")); for (const auto& dir_item : dir_iterator) { const auto& dir_item_path = dir_item.path(); @@ -122,7 +125,7 @@ Status GetPciBusId(const std::filesystem::path& sysfs_path, std::optional