Skip to content
Closed
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
27 changes: 27 additions & 0 deletions pkgs/by-name/on/onnxruntime/fix-cpuinfo-logging.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
diff --git a/onnxruntime/core/common/cpuid_info.cc b/onnxruntime/core/common/cpuid_info.cc
index 91961bf22c..2f742ad971 100644
--- a/onnxruntime/core/common/cpuid_info.cc
+++ b/onnxruntime/core/common/cpuid_info.cc
@@ -3,6 +3,7 @@
#include "core/common/cpuid_info.h"
#include "core/common/logging/logging.h"
#include "core/common/logging/severity.h"
+#include <iostream>

#ifdef __linux__

@@ -364,8 +365,12 @@ CPUIDInfo::CPUIDInfo() {
#if defined(CPUINFO_SUPPORTED)
pytorch_cpuinfo_init_ = cpuinfo_initialize();
if (!pytorch_cpuinfo_init_) {
- LOGS_DEFAULT(WARNING) << "Failed to initialize PyTorch cpuinfo library. May cause CPU EP performance degradation "
- "due to undetected CPU features.";
+ constexpr const char* message = "Failed to init pytorch cpuinfo library, may cause CPU EP performance degradation due to undetected CPU features.";
+ if (logging::LoggingManager::HasDefaultLogger()) {
+ LOGS_DEFAULT(WARNING) << message;
+ } else {
+ std::cerr << message << std::endl;
+ }
}
#endif // defined(CPUINFO_SUPPORTED)
#if defined(__linux__)
3 changes: 3 additions & 0 deletions pkgs/by-name/on/onnxruntime/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ effectiveStdenv.mkDerivation rec {
# We apply the referenced 1064.patch ourselves to our nix dependency.
# FIND_PACKAGE_ARGS for CUDA was added in https://github.com/microsoft/onnxruntime/commit/87744e5 so it might be possible to delete this patch after upgrading to 1.17.0
./nvcc-gsl.patch

# https://github.com/microsoft/onnxruntime/pull/15661
./fix-cpuinfo-logging.patch
];

nativeBuildInputs =
Expand Down
9 changes: 8 additions & 1 deletion pkgs/development/python-modules/onnxruntime/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,12 @@ buildPythonPackage {
# sympy
];

meta = onnxruntime.meta;
meta = onnxruntime.meta // {
badPlatforms = (onnxruntime.meta.badPlatforms or [ ]) ++ [
# Many downstream packages (vectorcode for e.g.) crash when importing `onnxruntime`:
# in onnxruntime/capi/_pybind_state.py
# Fatal Python error: Aborted
# "aarch64-linux"
];
};
}
Loading