已开启
Merge remote-tracking branch 'origin/openEuler-24.03-LTS-SP2' into ope… #52
Venland1创建于 2025年9月5日
Merge remote-tracking branch 'origin/openEuler-24.03-LTS-SP2' into ope… #52
已开启
Venland1创建于 2025年9月5日
从refs/pull/52/head合入到master
共 4 个文件变更+89-5
Binary files do not support preview
@@ -0,0 +1,43 @@
1+From 6cb00bbaf1c207ea2001ca5b74c039c30c2a7e30 Mon Sep 17 00:00:00 2001
2+From: yinchuang <yinchuang@huawei.com>
3+Date: Mon, 16 Jun 2025 11:25:07 +0800
4+Subject: [PATCH] Add DISABLE_THREAD_AFFINITY_ERROR_LOG
5+ 
6+Signed-off-by: yinchuang <yinchuang@huawei.com>
7+---
8+ third_party/onnxruntime/cmake/onnxruntime_common.cmake | 5 +++++
9+ .../onnxruntime/onnxruntime/core/platform/posix/env.cc | 2 +-
10+ 2 files changed, 6 insertions(+), 1 deletion(-)
11+ 
12+diff --git a/third_party/onnxruntime/cmake/onnxruntime_common.cmake b/third_party/onnxruntime/cmake/onnxruntime_common.cmake
13+index 687a231e..a765afd2 100644
14+--- a/third_party/onnxruntime/cmake/onnxruntime_common.cmake
15++++ b/third_party/onnxruntime/cmake/onnxruntime_common.cmake
16+@@ -141,6 +141,11 @@ if (onnxruntime_WINML_NAMESPACE_OVERRIDE STREQUAL "Windows")
17+ target_compile_definitions(onnxruntime_common PRIVATE "BUILD_INBOX=1")
18+ endif()
19+
20++# Add DISABLE_THREAD_AFFINITY_ERROR_LOG to support not printing error logs when the call to pthread_setaffinity_np fails in Docker.
21++if (DISABLE_THREAD_AFFINITY_ERROR_LOG STREQUAL "ON")
22++ target_compile_definitions(onnxruntime_common PRIVATE DISABLE_THREAD_AFFINITY_ERROR_LOG)
23++endif()
24++
25+ # check if we need to link against libatomic due to std::atomic usage by the threadpool code
26+ # e.g. Raspberry Pi requires this
27+ if (onnxruntime_LINK_LIBATOMIC)
28+diff --git a/third_party/onnxruntime/onnxruntime/core/platform/posix/env.cc b/third_party/onnxruntime/onnxruntime/core/platform/posix/env.cc
29+index 7cd81d89..3e9ca274 100644
30+--- a/third_party/onnxruntime/onnxruntime/core/platform/posix/env.cc
31++++ b/third_party/onnxruntime/onnxruntime/core/platform/posix/env.cc
32+@@ -250,7 +250,7 @@ class PosixThread : public EnvThread {
33+ << ", mask: " << *p->affinity;
34+ } else {
35+ auto [err_no, err_msg] = GetSystemError(ret);
36+-#if !defined(USE_MIGRAPHX)
37++#if !defined(USE_MIGRAPHX) && !defined(DISABLE_THREAD_AFFINITY_ERROR_LOG)
38+ LOGS_DEFAULT(ERROR) << "pthread_setaffinity_np failed for thread: " << syscall(SYS_gettid)
39+ << ", index: " << p->index
40+ << ", mask: " << *p->affinity
41+--
42+2.25.1
43+ 
MAI4C.spec+46-5
@@ -10,21 +10,22 @@
10%global install_includedir %{buildroot}%{_includedir}10%global install_includedir %{buildroot}%{_includedir}
11%global install_dir_model %{install_libdir}/%{name}11%global install_dir_model %{install_libdir}/%{name}
12 12 
13-%global max_jobs 16
14- 
15Summary: %{name} is a framework which enables compilers to integrate ML-driven compiler optimization.13Summary: %{name} is a framework which enables compilers to integrate ML-driven compiler optimization.
16Name: AI4C14Name: AI4C
17Version: 1.0.415Version: 1.0.4
18-Release: 516+Release: 8
19# Package onnxruntime and SafeInt have MIT License.17# Package onnxruntime and SafeInt have MIT License.
20# Package onnx has Apache License 2.0.18# Package onnx has Apache License 2.0.
21License: MIT and ASL 2.0 and Boost and BSD19License: MIT and ASL 2.0 and Boost and BSD
22URL: https://gitee.com/openeuler/AI4C20URL: https://gitee.com/openeuler/AI4C
23Source0: %{pkg_version}.tar.gz21Source0: %{pkg_version}.tar.gz
22+Source1: cmake-3.28.tar.gz
24 23 
25Patch1: 0001-Bugfix-for-undefined-np-symbol-in-ai4c-option-tuner.patch24Patch1: 0001-Bugfix-for-undefined-np-symbol-in-ai4c-option-tuner.patch
26Patch2: 0002-Update-README.md.patch25Patch2: 0002-Update-README.md.patch
27Patch3: 0003-Bugfix-and-update-inline-and-unroll-model.patch26Patch3: 0003-Bugfix-and-update-inline-and-unroll-model.patch
27+Patch4: 0004-Add-AI4C-UDF-to-optimize-UDF-code.patch
28+Patch5: 0005-Add-DISABLE_THREAD_AFFINITY_ERROR_LOG.patch
28 29 
29BuildRequires: cmake >= 3.1330BuildRequires: cmake >= 3.13
30BuildRequires: make31BuildRequires: make
@@ -51,10 +52,39 @@ BuildRequires: git
51 52 
52%prep53%prep
53tar -xzf %{SOURCE0} -C .54tar -xzf %{SOURCE0} -C .
55+tar -xzf %{SOURCE1} -C .
54 56 
55%autosetup -S git -n %{pkg_version}57%autosetup -S git -n %{pkg_version}
56 58 
57%build59%build
60+cmake_path=cmake
61+cmake_version=$(cmake --version | head -n1 | awk '{print $3}')
62+echo $cmake_version
63+if [[ "$cmake_version" =~ ^[0-9]+(\.[0-9]+){1,3}$ ]]; then
64+ major_minor=$(echo "$cmake_version" | cut -d. -f1-2)
65+ version_num=$(echo "$major_minor" | awk -F. '{printf "%d%02d", $1, $2}')
66+ echo $major_minor
67+ echo $version_num
68+ if [ "$version_num" -lt 326 ]; then
69+ echo "CMake version%{major_minor} < 3.26, build cmake for onnxruntime" >&2
70+ cd %{_builddir}/cmake
71+ mkdir -p build && cd build
72+ cmake .. -DCMAKE_INSTALL_PREFIX=./install
73+ make %{?_smp_mflags} install
74+ cmake_path=%{_builddir}/cmake/build/install/bin/cmake
75+ else
76+ echo "CMake version%{major_minor} >= 3.26, skip build cmake for onnxruntime" >&2
77+ fi
78+else
79+ echo "Can't get cmake version, build cmake for onnxruntime" >&2
80+ cd %{_builddir}/cmake
81+ mkdir -p build && cd build
82+ cmake .. -DCMAKE_INSTALL_PREFIX=./install
83+ make %{?_smp_mflags} install
84+ cmake_path=%{_builddir}/cmake/build/install/bin/cmake
85+fi
86+echo $cmake_path
87+ 
58# Broken test in aarch64 architecture.88# Broken test in aarch64 architecture.
59cd %{build_dir_dep}/onnxruntime89cd %{build_dir_dep}/onnxruntime
60%ifarch aarch6490%ifarch aarch64
@@ -64,7 +94,7 @@ rm -v onnxruntime/test/optimizer/nhwc_transformer_test.cc
64# Construct dependency package `onnxruntime`.94# Construct dependency package `onnxruntime`.
65mkdir -p %{build_libdir}95mkdir -p %{build_libdir}
66mkdir -p %{build_includedir}96mkdir -p %{build_includedir}
67-cmake \97+$cmake_path \
68 -DCMAKE_INSTALL_PREFIX=%{build_dir_frm} \98 -DCMAKE_INSTALL_PREFIX=%{build_dir_frm} \
69 -DCMAKE_INSTALL_LIBDIR=%{build_libdir} \99 -DCMAKE_INSTALL_LIBDIR=%{build_libdir} \
70 -DCMAKE_INSTALL_INCLUDEDIR=%{build_includedir} \100 -DCMAKE_INSTALL_INCLUDEDIR=%{build_includedir} \
@@ -79,8 +109,9 @@ cmake \
79 -Donnxruntime_USE_NEURAL_SPEED=OFF \109 -Donnxruntime_USE_NEURAL_SPEED=OFF \
80 -Donnxruntime_ENABLE_PYTHON=OFF \110 -Donnxruntime_ENABLE_PYTHON=OFF \
81 -DCMAKE_BUILD_TYPE=RelWithDebInfo \111 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
112+ -DDISABLE_THREAD_AFFINITY_ERROR_LOG=ON \
82 -S cmake113 -S cmake
83-make -j %{max_jobs} && make install114+make %{?_smp_mflags} && make %{?_smp_mflags} install
84 115 
85 116 
86pushd %{build_dir}/python117pushd %{build_dir}/python
@@ -111,9 +142,19 @@ pushd %{build_dir}/python
111/usr/bin/ai4c-gcc142/usr/bin/ai4c-gcc
112/usr/bin/ai4c-option-tune143/usr/bin/ai4c-option-tune
113/usr/bin/ai4c-tune144/usr/bin/ai4c-tune
145+/usr/bin/ai4c-udf
114 146 
115 147 
116%changelog148%changelog
149+* Mon Jun 16 2025 Chuang Yin <yinchuang@huawei.com> - 1.0.4-8
150+- Add DISABLE_THREAD_AFFINITY_ERROR_LOG.
151+ 
152+* Sun May 25 2025 Chuang Yin <yinchuang@huawei.com> - 1.0.4-7
153+- Build cmake according to system version.
154+ 
155+* Wed May 21 2025 Feiyang Liu <liufeiyang6@huawei.com> - 1.0.4-6
156+- Add AI4C-UDF to optimize UDF code.
157+ 
117* Wed Feb 05 2025 Feiyang Liu <liufeiyang6@huawei.com> - 1.0.4-5158* Wed Feb 05 2025 Feiyang Liu <liufeiyang6@huawei.com> - 1.0.4-5
118- Add BuildRequires for git and fix description typo in spec file.159- Add BuildRequires for git and fix description typo in spec file.
119 160 
Binary files do not support preview