%global maj_ver 17 %global min_ver 0 #global rc_ver 6 %global patch_ver 6 %global mlir_version %{maj_ver}.%{min_ver}.%{patch_ver} %global mlir_srcdir mlir-%{mlir_version}%{?rc_ver:rc%{rc_ver}}.src %define rel 1 %define major %{maj_ver}.%{min_ver} %define minor 1 %define libname %mklibname mlir %{major} %define devname %mklibname -d mlir %define staticname %mklibname -d mlir -s Name: mlir Version: %{mlir_version}%{?rc_ver:~rc%{rc_ver}} Release: %mkrel %{?rc_ver:0.rc%{rc_ver}.}%{rel} Summary: Multi-Level Intermediate Representation Overview Group: Development/Other License: ASL 2.0 with exceptions URL: https://mlir.llvm.org/ Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:-rc%{rc_ver}}/%{mlir_srcdir}.tar.xz Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:-rc%{rc_ver}}/%{mlir_srcdir}.tar.xz.sig Source2: release-keys.asc Patch1: 0001-mlir-python-Reuse-the-library-directory.patch %{lua: -- Return the maximum number of parallel jobs a build can run based on the -- amount of maximum memory used per process (per_proc_mem). function print_max_procs(per_proc_mem) local f = io.open("/proc/meminfo", "r") local mem = 0 local nproc_str = nil for line in f:lines() do _, _, mem = string.find(line, "MemTotal:%s+(%d+)%s+kB") if mem then break end end f:close() local proc_handle = io.popen("nproc") _, _, nproc_str = string.find(proc_handle:read("*a"), "(%d+)") proc_handle:close() local nproc = tonumber(nproc_str) if nproc < 1 then nproc = 1 end local mem_mb = mem / 1024 local cpu = math.floor(mem_mb / per_proc_mem) if cpu < 1 then cpu = 1 end if cpu > nproc then cpu = nproc end print(cpu) end } # The amount of RAM used per process has been set by trial and error. # This number may increase/decrease from time to time and may require changes. # We prefer to be on the safe side in order to avoid spurious errors. %global _smp_mflags -j%{lua: print_max_procs(6144)} # Exclude armv7 and i586 because there isn't enough virtual memory to # build ("caught: virtual memory exhausted: Cannot allocate memory"). # Support for i686 upstream is unclear with lots of tests failling. ExcludeArch: %{arm} %{ix86} BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: cmake BuildRequires: ninja-build BuildRequires: zlib-devel BuildRequires: llvm-devel = %{version} BuildRequires: llvm-cmake-utils = %{version} BuildRequires: llvm-googletest = %{version} BuildRequires: llvm-test = %{version} BuildRequires: python3-lit BuildRequires: python3-devel BuildRequires: python3-numpy-devel BuildRequires: python3-numpy BuildRequires: python3-pybind11 BuildRequires: python3-pyyaml # For origin certification BuildRequires: gnupg2 %description The MLIR project is a novel approach to building reusable and extensible compiler infrastructure. MLIR aims to address software fragmentation, improve compilation for heterogeneous hardware, significantly reduce the cost of building domain specific compilers, and aid in connecting existing compilers together. %package -n %libname Summary: Runtime libraries for MLIR Group: Development/Other %description -n %libname The MLIR project is a novel approach to building reusable and extensible compiler infrastructure. MLIR aims to address software fragmentation, improve compilation for heterogeneous hardware, significantly reduce the cost of building domain specific compilers, and aid in connecting existing compilers together. This package contains the runtime libraries for MLIR. %package -n %staticname Summary: MLIR static files Group: Development/Other Requires: %{libname} = %{version}-%{release} %description -n %staticname MLIR static files. %package -n %devname Summary: MLIR development files Group: Development/Other Provides: mlir-devel = %version-%release Requires: %{libname} = %{version}-%{release} Requires: %{staticname}%{?_isa} = %{version}-%{release} %description -n %devname MLIR development files. %package -n python3-%{name} Summary: MLIR python 3 bindings Group: Development/Python Requires: python3 Requires: python3-numpy %description -n python3-%{name} Python3 bindings for MLIR. %prep %{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}' %autosetup -n %{mlir_srcdir} -p2 %build %ifarch %{ix86} %{arm32} %global debug_package %{nil} %global _lto_cflags %{nil} %endif # On aarch64, dwz can take very long to process all the files. It either fails # reaching a timeout or consumes too much RAM. Restrict its resources in # order to stop dwz early. We prefer to miss the DWARF optimization than not # not being able to build this package on aarch64. %global _dwz_low_mem_die_limit_aarch64 1 %global _dwz_max_die_limit_aarch64 1000000 %cmake -GNinja \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_SKIP_RPATH=ON \ -DLLVM_LINK_LLVM_DYLIB:BOOL=ON \ -DLLVM_BUILD_LLVM_DYLIB=ON \ -DCMAKE_PREFIX_PATH=%{_libdir}/cmake/llvm/ \ -DLLVM_EXTERNAL_LIT=%{_bindir}/lit \ -DLLVM_THIRD_PARTY_DIR=%{_datadir}/llvm/src/utils \ -DLLVM_COMMON_CMAKE_UTILS=%{_datadir}/llvm/cmake \ -DLLVM_BUILD_TOOLS:BOOL=ON \ -DLLVM_BUILD_UTILS:BOOL=ON \ -DLLVM_LIBRARY_OUTPUT_INTDIR="." \ -DLLVM_SHLIB_OUTPUT_INTDIR="%{_builddir}/%{mlir_srcdir}/%{__cmake_builddir}/lib/ExecutionEngine/" \ -DMLIR_INCLUDE_DOCS:BOOL=ON \ -DMLIR_INCLUDE_TESTS:BOOL=ON \ -DMLIR_INCLUDE_INTEGRATION_TESTS:BOOL=OFF \ -DBUILD_SHARED_LIBS=OFF \ -DMLIR_INSTALL_AGGREGATE_OBJECTS=OFF \ -DMLIR_BUILD_MLIR_C_DYLIB=ON \ %ifarch aarch64 %{ix86} %{arm32} ppc64le x86_64 -DLLVM_PARALLEL_LINK_JOBS=1 \ %endif %ifarch %{ix86} %{arm32} -DMLIR_RUN_X86VECTOR_TESTS:BOOL=OFF \ %endif -DMLIR_ENABLE_BINDINGS_PYTHON:BOOL=ON \ %if 0%{?__isa_bits} == 64 -DLLVM_LIBDIR_SUFFIX=64 %else -DLLVM_LIBDIR_SUFFIX= %endif # build process .exe tools normally use rpath or static linkage export LD_LIBRARY_PATH=%{_builddir}/%{mlir_srcdir}/%{name}/%{_build}/%{_lib} %cmake_build %install %cmake_install mkdir -p %{buildroot}%{python3_sitearch} mv %{buildroot}/usr/python_packages/mlir_core/mlir %{buildroot}%{python3_sitearch} # These directories should be empty now. rmdir %{buildroot}/usr/python_packages/mlir_core %{buildroot}/usr/python_packages # Unneeded files. rm -rf %{buildroot}/usr/src/python %check # Remove tablegen tests, as they rely on includes from llvm/. rm -rf test/mlir-tblgen # Test execution normally relies on RPATH, so set LD_LIBRARY_PATH instead. export LD_LIBRARY_PATH=%{buildroot}%{_libdir}:%{buildroot}%{python3_sitearch}/mlir/_mlir_libs export PYTHONPATH=%{buildroot}%{python3_sitearch} # build process .exe tools normally use rpath or static linkage %cmake_build --target check-mlir || true %files -n %libname %license LICENSE.TXT %{_libdir}/libMLIR*.so.%{maj_ver}{,.*} %{_libdir}/libmlir_*.so.%{maj_ver}{,.*} %files -n %staticname %{_libdir}/libMLIR*.a %files -n %devname %{_bindir}/mlir-cpu-runner %{_bindir}/mlir-linalg-ods-yaml-gen %{_bindir}/mlir-lsp-server %{_bindir}/mlir-opt %{_bindir}/mlir-pdll %{_bindir}/mlir-pdll-lsp-server %{_bindir}/mlir-reduce %{_bindir}/mlir-tblgen %{_bindir}/mlir-translate %{_bindir}/tblgen-lsp-server %{_libdir}/libMLIR*.so %{_libdir}/libmlir_*.so %{_includedir}/mlir/ %{_includedir}/mlir-c/ %{_libdir}/cmake/mlir/ %files -n python3-%{name} %{python3_sitearch}/mlir/ %changelog * Mon Apr 01 2024 daviddavid <daviddavid> 17.0.6-1.mga10 + Revision: 2053525 - new version: 17.0.6 * Mon Jan 02 2023 tv <tv> 15.0.6-2.mga9 + Revision: 1929321 - Add mlir tools to mlir-devel * Thu Dec 08 2022 ghibo <ghibo> 15.0.6-1.mga9 + Revision: 1919345 - Update to release 15.0.6 * Fri Nov 04 2022 ghibo <ghibo> 15.0.4-1.mga9 + Revision: 1902643 - Update to release 15.0.4 * Mon Sep 26 2022 ghibo <ghibo> 15.0.0-1.mga9 + Revision: 1892551 - Fix file list - Fix sig release-keys.asc - Update to release 15.0.0 * Tue Jun 21 2022 tv <tv> 14.0.5-1.mga9 + Revision: 1865344 - Update to 14.0.5 * Wed Mar 30 2022 tv <tv> 14.0.0-1.mga9 + Revision: 1834910 - Update to LLVM 14.0.0 * Fri Feb 04 2022 tv <tv> 13.0.1-3.mga9 + Revision: 1771389 - Update to 13.0.1 final * Thu Oct 21 2021 tv <tv> 13.0.0-3.mga9 + Revision: 1752540 - Fix static pkg deps * Thu Oct 21 2021 tv <tv> 13.0.0-2.mga9 + Revision: 1752478 - Build with static pkg name + tmb <tmb> - fix static-devel package name * Wed Oct 20 2021 tv <tv> 13.0.0-1.mga9 + Revision: 1752306 - 13.0.0 Release - 13.0.0 Release - Split static subpkg * Mon Jul 19 2021 tv <tv> 12.0.1-1.mga9 + Revision: 1737069 - 12.0.0 final * Sat Apr 17 2021 tv <tv> 12.0.0-7.mga9 + Revision: 1716257 - 12.0.0 final * Fri Apr 09 2021 tv <tv> 12.0.0-0.7.rc5.mga9 + Revision: 1714302 - 12.0.0 RC5 * Fri Mar 12 2021 tv <tv> 12.0.0-0.4.rc3.mga9 + Revision: 1701751 - LLVM 12.0.0 rc3 * Mon Mar 01 2021 tv <tv> 12.0.0-0.2.rc2.mga9 + Revision: 1695633 - 12.0.0-rc2 release * Thu Jan 07 2021 tv <tv> 11.0.1-3.1.mga8 + Revision: 1669534 - LLVM 11.0.1 final * Thu Dec 31 2020 ghibo <ghibo> 11.0.1-0.rc2.1.mga8 + Revision: 1667284 - Update to release 11.0.1rc2 * Thu Dec 03 2020 ghibo <ghibo> 11.0.1-0.rc1.1.mga8 + Revision: 1652043 - Fix Requires * Wed Dec 02 2020 ghibo <ghibo> 11.0.1-0.rc1.mga8 + Revision: 1651820 - Fix baserelease - Sync to release 11.0.1-rc1 * Wed Dec 02 2020 ghibo <ghibo> 11.0.0-2.mga8 + Revision: 1651723 - Fix Requires * Wed Dec 02 2020 ghibo <ghibo> 11.0.0-1.mga8 + Revision: 1651638 - imported package mlir * Wed Dec 02 2020 ghibo <ghibo> 11.0.0-1.mga8 - initial release (required for flang), synched from FC.