summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2025-08-21 11:25:33 +0000
committerCoprDistGit <infra@openeuler.org>2025-08-21 11:25:33 +0000
commitbb9842bc73a985e9069b538df9ed1bfff9045656 (patch)
tree564fd666f3df9b5fa611208903d8d3061b5bfefe
parentd93a9b4610b60112b64caa0f699b7e8a5ca370f9 (diff)
automatic import of ANNC
-rw-r--r--.gitignore3
-rw-r--r--ANNC.spec43
-rw-r--r--sources7
3 files changed, 33 insertions, 20 deletions
diff --git a/.gitignore b/.gitignore
index cb59680..705c489 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,6 @@
/annc_external.tar.gz.aa
/annc_external.tar.gz.ab
/ANNC-v0.0.2.tar.gz
+/XNNPACK.tar.gz
+/external.tar.gz.aa
+/external.tar.gz.ab
diff --git a/ANNC.spec b/ANNC.spec
index fca393d..2379321 100644
--- a/ANNC.spec
+++ b/ANNC.spec
@@ -5,9 +5,9 @@
%global install_libdir %{buildroot}%{_libdir}
%global install_includedir %{buildroot}%{_includedir}/annc
-%global max_jobs 16
+%global max_jobs 8
-%define debug_package %{nil}
+%global debug_package %{nil}
Summary: %{name} is an AI compiler designed to optimize and compile ML model into high-performance executable code that can be executed on various targets.
Name: ANNC
@@ -16,15 +16,17 @@ Release: 1
# Package onnxruntime and SafeInt have MIT License.
# Package onnx has Apache License 2.0.
License: MIT and ASL 2.0 and Boost and BSD
-URL: https://gitee.com/openeuler/AI4C
+URL: https://gitee.com/openeuler/ANNC
Source0: %{pkg_version}.tar.gz
-Source1: annc_external.tar.gz.aa
-Source2: annc_external.tar.gz.ab
+Source1: external.tar.gz.aa
+Source2: external.tar.gz.ab
+Source3: XNNPACK.tar.gz
%ifarch x86_64
Patch0: x86_64_external_files.patch
%endif
BuildRequires: cmake >= 3.9.9
+BuildRequires: make
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: bzip2
@@ -43,21 +45,26 @@ BuildRequires: bazel
%{name} is is an AI compiler designed to optimize and compile ML model into high-performance executable code that can be executed on various targets.
%prep
-cat %{SOURCE1} %{SOURCE2} > annc_external.tar.gz
-tar -xzf annc_external.tar.gz -C .
+cat %{SOURCE1} %{SOURCE2} > external.tar.gz
+tar xf external.tar.gz -C .
+tar xf %{SOURCE3} -C .
%ifarch x86_64
-%patch 0 -p0 -d .
+%patch 0 -p1 -d .
%endif
%autosetup -S git -n %{pkg_version}
%build
export ANNC=%{build_dir}
-cd %{build_dir}/annc/service/cpu/xla/libs
-bash xnnpack.sh
-
-export XNNPACK_BASE="$ANNC/annc/service/cpu/xla/libs"
-export XNNPACK_DIR="$XNNPACK_BASE/XNNPACK"
+cd %{_builddir}/XNNPACK/build
+CFLAGS="-fPIC" cmake .. -DXNNPACK_BUILD_BENCHMARKS=OFF \
+ -DXNNPACK_BUILD_TESTS=OFF \
+ -DXNNPACK_LIBRARY_TYPE=shared \
+ -DCMAKE_BUILD_TYPE=Release
+make -j %{max_jobs}
+rm -rf $ANNC/annc/service/cpu/xla/libs/libXNNPACK.so
+cp %{_builddir}/XNNPACK/build/libXNNPACK.so $ANNC/annc/service/cpu/xla/libs
+export XNNPACK_DIR="%{_builddir}/XNNPACK"
CPLUS_INCLUDE_PATH+="$ANNC/annc/service/cpu/xla:"
CPLUS_INCLUDE_PATH+="$ANNC/annc/service/:"
@@ -75,9 +82,11 @@ run_bazel_build() {
--verbose_failures \
--action_env="baila=548" \
--define tflite_with_xnnpack=false \
- --copt="-g" \
- --copt="-DNDBUG" \
- annc/service/cpu:libannc.so
+ --jobs=%{max_jobs} \
+ annc/service/cpu:libannc.so \
+ # --copt="-g" \
+ # --copt="-DNDBUG" \
+ # annc/service/cpu:libannc.so
}
fix_action() {
@@ -111,7 +120,7 @@ install %{build_dir}/python/tensorflow/kernels/* -t %{install_includedir}
install -d %{install_libdir}
output_path=$(find %{build_dir} -type f -name "libannc.so")
install ${output_path} -t %{install_libdir}
-install %{build_dir}/annc/service/cpu/xla/libs/XNNPACK/build/*.so -t %{install_libdir}
+install %{build_dir}/annc/service/cpu/xla/libs/libXNNPACK.so -t %{install_libdir}
pushd %{build_dir}/python
%py3_install
diff --git a/sources b/sources
index 38f805f..a046932 100644
--- a/sources
+++ b/sources
@@ -1,3 +1,4 @@
-871ddedbfbb9aa75c2db497584667f61 ANNC-v0.0.2.tar.gz
-a3f0ec5120fa9b65af527332299c9d46 annc_external.tar.gz.aa
-f548d6ba0ad0163c0aa3df33250e97c6 annc_external.tar.gz.ab
+0313b1256cba759a7d2df869feb51d59 ANNC-v0.0.2.tar.gz
+20e5d643ae5e8981686f54d7838a959a XNNPACK.tar.gz
+956fd7bc04940fa879bab6f5fa141b98 external.tar.gz.aa
+ef0f2b2ac19f0e5037a60cc575ee896b external.tar.gz.ab