summaryrefslogtreecommitdiff
path: root/ANNC.spec
diff options
context:
space:
mode:
Diffstat (limited to 'ANNC.spec')
-rw-r--r--ANNC.spec83
1 files changed, 61 insertions, 22 deletions
diff --git a/ANNC.spec b/ANNC.spec
index fca393d..ca85e5a 100644
--- a/ANNC.spec
+++ b/ANNC.spec
@@ -7,24 +7,30 @@
%global max_jobs 16
-%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
Version: 0.0.2
-Release: 1
+Release: 3
# 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: external.tar.gz.ac
+Source4: XNNPACK.tar.gz
+Source5: v3.2.tar.gz
%ifarch x86_64
Patch0: x86_64_external_files.patch
%endif
+Patch1: 0001-fix-pattern-conflicts.patch
+Patch2: 0002-Add-graph-optimizer-and-embedding_fused-kernels.patch
BuildRequires: cmake >= 3.9.9
+BuildRequires: make
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: bzip2
@@ -43,21 +49,29 @@ 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} %{SOURCE3} > external.tar.gz
+tar xf external.tar.gz -C .
%ifarch x86_64
-%patch 0 -p0 -d .
+%patch0 -p1 -d .
%endif
-
-%autosetup -S git -n %{pkg_version}
+tar xf %{SOURCE4} -C .
+mkdir proxy
+cp %{SOURCE5} ./proxy
+%setup -q -n %{pkg_version}
+%patch1 -p1
+%patch2 -p1
%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" CXXFLAGS="-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 +89,12 @@ run_bazel_build() {
--verbose_failures \
--action_env="baila=548" \
--define tflite_with_xnnpack=false \
- --copt="-g" \
- --copt="-DNDBUG" \
- annc/service/cpu:libannc.so
+ --local_ram_resources=512 \
+ --distdir=%{_builddir}/proxy \
+ annc/service/cpu:libannc.so
+ # --copt="-g" \
+ # --copt="-DNDBUG" \
+ # annc/service/cpu:libannc.so
}
fix_action() {
@@ -85,7 +102,7 @@ fix_action() {
external_path=$(find . -name "external" | head -n 1)
if [ -n "$external_path" ]; then
rm -rf $external_path/*
- cp -r %{_builddir}/external/* $external_path
+ cp -LR %{_builddir}/external/* $external_path
else
echo "Not find external directory."
fi
@@ -106,12 +123,17 @@ pushd %{build_dir}/python
%install
install -d %{install_includedir}
install %{build_dir}/annc/service/cpu/kdnn_rewriter.h -t %{install_includedir}
-install %{build_dir}/install/*.patch -t %{install_includedir}
+install %{build_dir}/annc/service/cpu/annc_flags.h -t %{install_includedir}
+install %{build_dir}/annc/service/cpu/xla/*.h -t %{install_includedir}
+install -d %{install_includedir}/bisheng-cpu
+install %{build_dir}/annc/service/bisheng-cpu/*.h -t %{install_includedir}/bisheng-cpu
+cp -r %{build_dir}/annc/tensorflow %{install_includedir}
+cp -r %{build_dir}/install/* %{install_includedir}
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
@@ -121,9 +143,26 @@ pushd %{build_dir}/python
%{_libdir}/*
%{python3_sitelib}/*
/usr/bin/annc-opt
-/usr/bin/annc-apply-tf
%changelog
+* Tue Nov 11 2025 Chenhui Zheng <zhengchenhui1@huawei.com> - 0.0.2-3
+- Type:Update
+- ID:NA
+- SUG:NA
+- DEC: Add graph optimize and embedding_fused kernels.
+
+* Thu Sep 11 2025 Chenhui Zheng <zhengchenhui1@huawei.com> - 0.0.2-2
+- Type:Fix
+- ID:NA
+- SUG:NA
+- DEC:Fix pattern conflict & missing header files.
+
+* Fri Aug 22 2025 Chenhui Zheng <zhengchenhui1@huawei.com> - 0.0.2-1
+- Type:Update
+- ID:NA
+- SUG:NA
+- DEC:Release v0.0.2
+
* Mon May 12 2025 Chenhui Zheng <zhengchenhui1@huawei.com> - 0.0.1-1
- Type:Init
- ID:NA