diff --git a/0005-Add-DISABLE_THREAD_AFFINITY_ERROR_LOG.patch b/0005-Add-DISABLE_THREAD_AFFINITY_ERROR_LOG.patch new file mode 100644 index 0000000000000000000000000000000000000000..f1a064f4117cadf310dab2d11454db3d84a71740 --- /dev/null +++ b/0005-Add-DISABLE_THREAD_AFFINITY_ERROR_LOG.patch @@ -0,0 +1,43 @@ +From 6cb00bbaf1c207ea2001ca5b74c039c30c2a7e30 Mon Sep 17 00:00:00 2001 +From: yinchuang +Date: Mon, 16 Jun 2025 11:25:07 +0800 +Subject: [PATCH] Add DISABLE_THREAD_AFFINITY_ERROR_LOG + +Signed-off-by: yinchuang +--- + third_party/onnxruntime/cmake/onnxruntime_common.cmake | 5 +++++ + .../onnxruntime/onnxruntime/core/platform/posix/env.cc | 2 +- + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/third_party/onnxruntime/cmake/onnxruntime_common.cmake b/third_party/onnxruntime/cmake/onnxruntime_common.cmake +index 687a231e..a765afd2 100644 +--- a/third_party/onnxruntime/cmake/onnxruntime_common.cmake ++++ b/third_party/onnxruntime/cmake/onnxruntime_common.cmake +@@ -141,6 +141,11 @@ if (onnxruntime_WINML_NAMESPACE_OVERRIDE STREQUAL "Windows") + target_compile_definitions(onnxruntime_common PRIVATE "BUILD_INBOX=1") + endif() + ++# Add DISABLE_THREAD_AFFINITY_ERROR_LOG to support not printing error logs when the call to pthread_setaffinity_np fails in Docker. ++if (DISABLE_THREAD_AFFINITY_ERROR_LOG STREQUAL "ON") ++ target_compile_definitions(onnxruntime_common PRIVATE DISABLE_THREAD_AFFINITY_ERROR_LOG) ++endif() ++ + # check if we need to link against libatomic due to std::atomic usage by the threadpool code + # e.g. Raspberry Pi requires this + if (onnxruntime_LINK_LIBATOMIC) +diff --git a/third_party/onnxruntime/onnxruntime/core/platform/posix/env.cc b/third_party/onnxruntime/onnxruntime/core/platform/posix/env.cc +index 7cd81d89..3e9ca274 100644 +--- a/third_party/onnxruntime/onnxruntime/core/platform/posix/env.cc ++++ b/third_party/onnxruntime/onnxruntime/core/platform/posix/env.cc +@@ -250,7 +250,7 @@ class PosixThread : public EnvThread { + << ", mask: " << *p->affinity; + } else { + auto [err_no, err_msg] = GetSystemError(ret); +-#if !defined(USE_MIGRAPHX) ++#if !defined(USE_MIGRAPHX) && !defined(DISABLE_THREAD_AFFINITY_ERROR_LOG) + LOGS_DEFAULT(ERROR) << "pthread_setaffinity_np failed for thread: " << syscall(SYS_gettid) + << ", index: " << p->index + << ", mask: " << *p->affinity +-- +2.25.1 + diff --git a/AI4C.spec b/AI4C.spec index a7c72810914a80b388b61a15b469ffe26d18b451..0f87af937269217e610e2ba5747555801638a28b 100644 --- a/AI4C.spec +++ b/AI4C.spec @@ -13,7 +13,7 @@ Summary: %{name} is a framework which enables compilers to integrate ML-driven compiler optimization. Name: AI4C Version: 1.0.4 -Release: 7 +Release: 8 # Package onnxruntime and SafeInt have MIT License. # Package onnx has Apache License 2.0. License: MIT and ASL 2.0 and Boost and BSD @@ -25,6 +25,7 @@ Patch1: 0001-Bugfix-for-undefined-np-symbol-in-ai4c-option-tuner.patch Patch2: 0002-Update-README.md.patch Patch3: 0003-Bugfix-and-update-inline-and-unroll-model.patch Patch4: 0004-Add-AI4C-UDF-to-optimize-UDF-code.patch +Patch5: 0005-Add-DISABLE_THREAD_AFFINITY_ERROR_LOG.patch BuildRequires: cmake >= 3.13 BuildRequires: make @@ -108,6 +109,7 @@ $cmake_path \ -Donnxruntime_USE_NEURAL_SPEED=OFF \ -Donnxruntime_ENABLE_PYTHON=OFF \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DDISABLE_THREAD_AFFINITY_ERROR_LOG=ON \ -S cmake make %{?_smp_mflags} && make %{?_smp_mflags} install @@ -144,6 +146,9 @@ pushd %{build_dir}/python %changelog +* Mon Jun 16 2025 Chuang Yin - 1.0.4-8 +- Add DISABLE_THREAD_AFFINITY_ERROR_LOG. + * Sun May 25 2025 Chuang Yin - 1.0.4-7 - Build cmake according to system version.