From bb9842bc73a985e9069b538df9ed1bfff9045656 Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Thu, 21 Aug 2025 11:25:33 +0000 Subject: automatic import of ANNC --- ANNC.spec | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) (limited to 'ANNC.spec') 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 -- cgit v1.2.3