2024-11-25 00:29:39 +08:00
|
|
|
%global pkg_version %{name}-v%{version}-alpha
|
|
|
|
|
|
|
|
|
|
%global build_dir %{_builddir}/%{pkg_version}
|
|
|
|
|
%global build_dir_dep %{build_dir}/third_party
|
|
|
|
|
%global build_dir_frm %{build_dir}/aiframe/build
|
|
|
|
|
%global build_libdir %{build_dir_frm}/%{_lib}
|
|
|
|
|
%global build_includedir %{build_dir_frm}/include
|
|
|
|
|
|
|
|
|
|
%global install_libdir %{buildroot}%{_libdir}
|
2024-11-25 20:52:59 +08:00
|
|
|
%global install_includedir %{buildroot}%{_includedir}
|
2024-11-25 00:29:39 +08:00
|
|
|
%global install_dir_model %{install_libdir}/%{name}
|
|
|
|
|
|
|
|
|
|
%global max_jobs 16
|
|
|
|
|
|
|
|
|
|
Summary: %{name} is a framework which enables compilers compilers to integrate ML-driven compiler optimization.
|
|
|
|
|
Name: AI4C
|
2024-12-04 16:49:29 +08:00
|
|
|
Version: 1.0.4
|
2024-12-09 22:15:36 +08:00
|
|
|
Release: 3
|
2024-11-25 00:29:39 +08:00
|
|
|
# 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
|
|
|
|
|
Source0: %{pkg_version}.tar.gz
|
|
|
|
|
|
2024-12-08 15:25:23 +08:00
|
|
|
Patch1: 0001-Bugfix-for-undefined-np-symbol-in-ai4c-option-tuner.patch
|
2024-12-09 22:15:36 +08:00
|
|
|
Patch2: 0002-Update-README.md.patch
|
2024-12-08 15:25:23 +08:00
|
|
|
|
2024-11-25 00:29:39 +08:00
|
|
|
BuildRequires: cmake >= 3.13
|
|
|
|
|
BuildRequires: make
|
|
|
|
|
BuildRequires: gcc
|
|
|
|
|
BuildRequires: gcc-c++
|
|
|
|
|
BuildRequires: abseil-cpp-devel
|
|
|
|
|
BuildRequires: boost-devel >= 1.66
|
|
|
|
|
BuildRequires: bzip2
|
|
|
|
|
BuildRequires: python3-devel
|
|
|
|
|
BuildRequires: python3-numpy
|
|
|
|
|
BuildRequires: python3-setuptools
|
|
|
|
|
BuildRequires: python3-pip
|
2024-11-25 20:52:59 +08:00
|
|
|
BuildRequires: python3-wheel
|
2024-11-25 00:29:39 +08:00
|
|
|
BuildRequires: openssl
|
|
|
|
|
BuildRequires: openssl-devel
|
2024-11-25 20:52:59 +08:00
|
|
|
BuildRequires: yaml-cpp
|
|
|
|
|
BuildRequires: yaml-cpp-devel
|
|
|
|
|
BuildRequires: gcc-plugin-devel
|
|
|
|
|
BuildRequires: libstdc++-static
|
2024-11-25 00:29:39 +08:00
|
|
|
|
|
|
|
|
%description
|
|
|
|
|
%{name} is a framework which enables compilers compilers to integrate ML-driven compiler optimization.
|
|
|
|
|
|
|
|
|
|
%prep
|
|
|
|
|
tar -xzf %{SOURCE0} -C .
|
|
|
|
|
|
|
|
|
|
%autosetup -S git -n %{pkg_version}
|
|
|
|
|
|
|
|
|
|
%build
|
|
|
|
|
# Broken test in aarch64 architecture.
|
|
|
|
|
cd %{build_dir_dep}/onnxruntime
|
|
|
|
|
%ifarch aarch64
|
|
|
|
|
rm -v onnxruntime/test/optimizer/nhwc_transformer_test.cc
|
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
# Construct dependency package `onnxruntime`.
|
|
|
|
|
mkdir -p %{build_libdir}
|
|
|
|
|
mkdir -p %{build_includedir}
|
2024-11-25 20:52:59 +08:00
|
|
|
cmake \
|
2024-11-25 00:29:39 +08:00
|
|
|
-DCMAKE_INSTALL_PREFIX=%{build_dir_frm} \
|
|
|
|
|
-DCMAKE_INSTALL_LIBDIR=%{build_libdir} \
|
|
|
|
|
-DCMAKE_INSTALL_INCLUDEDIR=%{build_includedir} \
|
|
|
|
|
-Donnxruntime_BUILD_SHARED_LIB=ON \
|
|
|
|
|
-Donnxruntime_BUILD_UNIT_TESTS=ON \
|
|
|
|
|
-Donnxruntime_INSTALL_UNIT_TESTS=OFF \
|
|
|
|
|
-Donnxruntime_BUILD_BENCHMARKS=OFF \
|
|
|
|
|
-Donnxruntime_USE_FULL_PROTOBUF=ON \
|
|
|
|
|
-DPYTHON_VERSION=%{python3_version} \
|
|
|
|
|
-Donnxruntime_ENABLE_CPUINFO=ON \
|
|
|
|
|
-Donnxruntime_DISABLE_ABSEIL=ON \
|
|
|
|
|
-Donnxruntime_USE_NEURAL_SPEED=OFF \
|
|
|
|
|
-Donnxruntime_ENABLE_PYTHON=OFF \
|
|
|
|
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
|
|
|
|
-S cmake
|
|
|
|
|
make -j %{max_jobs} && make install
|
|
|
|
|
|
2024-11-25 20:52:59 +08:00
|
|
|
|
|
|
|
|
pushd %{build_dir}/python
|
|
|
|
|
%{__python3} setup.py bdist_wheel \
|
2024-11-25 00:29:39 +08:00
|
|
|
-Donnxruntime_ROOTDIR=%{build_dir_frm} \
|
2024-11-25 20:52:59 +08:00
|
|
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo
|
2024-11-25 00:29:39 +08:00
|
|
|
|
|
|
|
|
%install
|
2024-11-25 20:52:59 +08:00
|
|
|
install -d %{install_includedir}
|
|
|
|
|
install %{build_includedir}/onnxruntime/* -t %{install_includedir}
|
2024-11-25 00:29:39 +08:00
|
|
|
install -d %{install_dir_model}
|
2024-11-25 20:52:59 +08:00
|
|
|
install %{build_dir}/models/* -t %{install_dir_model}
|
2024-11-25 00:29:39 +08:00
|
|
|
install %{build_libdir}/libonnxruntime.so* -t %{install_libdir}
|
|
|
|
|
pushd %{install_libdir}
|
|
|
|
|
ln -sf libonnxruntime.so.1.* libonnxruntime.so
|
|
|
|
|
popd
|
|
|
|
|
|
2024-11-25 20:52:59 +08:00
|
|
|
pushd %{build_dir}/python
|
|
|
|
|
%py3_install
|
2024-11-25 00:29:39 +08:00
|
|
|
|
|
|
|
|
%files
|
2024-11-25 20:52:59 +08:00
|
|
|
%{_includedir}/*
|
|
|
|
|
%{_libdir}/*
|
2024-12-04 16:49:29 +08:00
|
|
|
%{python3_sitelib}/*egg-info
|
|
|
|
|
%{python3_sitelib}/ai4c
|
2024-11-25 20:52:59 +08:00
|
|
|
/usr/bin/ai4c-autotune
|
|
|
|
|
/usr/bin/ai4c-g++
|
|
|
|
|
/usr/bin/ai4c-gcc
|
|
|
|
|
/usr/bin/ai4c-option-tune
|
|
|
|
|
/usr/bin/ai4c-tune
|
2024-11-25 00:29:39 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
%changelog
|
2024-12-09 22:15:36 +08:00
|
|
|
* Mon Dec 09 2024 Feiyang Liu <liufeiyang6@huawei.com> - 1.0.4-3
|
|
|
|
|
- Update README.md.
|
|
|
|
|
|
2024-12-08 15:25:23 +08:00
|
|
|
* Sun Dec 08 2024 Feiyang Liu <liufeiyang6@huawei.com> - 1.0.4-2
|
|
|
|
|
- Bugfix for undefined "np" symbol in ai4c-option-tuner.
|
|
|
|
|
|
2024-12-04 16:49:29 +08:00
|
|
|
* Wed Dec 04 2024 Feiyang Liu <liufeiyang6@huawei.com> - 1.0.4-1
|
|
|
|
|
- Update AI4C from v1.0.3 to v1.0.4.
|
|
|
|
|
|
2024-11-27 17:12:58 +08:00
|
|
|
* Wed Nov 27 2024 Chenhui Zheng <zhengchenhui1@huawei.com> - 1.0.3-2
|
|
|
|
|
- Add inline_unroll plugin and models
|
|
|
|
|
|
2024-11-25 20:52:59 +08:00
|
|
|
* Fri Nov 22 2024 Feiyang Liu <liufeiyang6@huawei.com> - 1.0.3-1
|
|
|
|
|
- Update AI4C from v0.2.0 to v1.0.3.
|
|
|
|
|
|
2024-11-25 00:29:39 +08:00
|
|
|
* Mon Nov 25 2024 Zhenyu Zhao <zhaozhenyu17@huawei.com> - 0.2.0-1
|
|
|
|
|
- Sync patch from 22.03 SP4.
|