init for Multi-Version LLVM-18.1.8
Signed-off-by: liyunfei <liyunfei33@huawei.com>
This commit is contained in:
parent
8f4c48bf2f
commit
43e9820a06
@ -1,71 +0,0 @@
|
||||
From d8d712c632e925139a6e5e53ee64749301358b25 Mon Sep 17 00:00:00 2001
|
||||
From: Tulio Magno Quites Machado Filho <tuliom@redhat.com>
|
||||
Date: Tue, 5 Sep 2023 10:35:37 -0300
|
||||
Subject: [PATCH] [mlir][python] Reuse the library directory
|
||||
|
||||
Prefer to get the path to the shared libraries from config.llvm_shlib_dir.
|
||||
Fallback to the previous path only if config.llvm_shlib_dir is not
|
||||
defined.
|
||||
|
||||
This ensures the test will pass regardless of the build configuration
|
||||
used downstream.
|
||||
---
|
||||
mlir/test/lit.cfg.py | 1 +
|
||||
mlir/test/python/execution_engine.py | 12 +++++++-----
|
||||
2 files changed, 8 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/mlir/test/lit.cfg.py b/mlir/test/lit.cfg.py
|
||||
index 3a8bdbfcec28..eb8e66a2491c 100644
|
||||
--- a/mlir/test/lit.cfg.py
|
||||
+++ b/mlir/test/lit.cfg.py
|
||||
@@ -130,6 +130,7 @@ tools.extend(
|
||||
ToolSubst("toyc-ch7", unresolved="ignore"),
|
||||
ToolSubst('transform-opt-ch2', unresolved='ignore'),
|
||||
ToolSubst('transform-opt-ch3', unresolved='ignore'),
|
||||
+ ToolSubst("%llvm_shlib_dir", config.llvm_shlib_dir, unresolved="ignore"),
|
||||
ToolSubst("%mlir_lib_dir", config.mlir_lib_dir, unresolved="ignore"),
|
||||
ToolSubst("%mlir_src_dir", config.mlir_src_root, unresolved="ignore"),
|
||||
]
|
||||
diff --git a/mlir/test/python/execution_engine.py b/mlir/test/python/execution_engine.py
|
||||
index e8b47007a890..0cb78dd0bac6 100644
|
||||
--- a/mlir/test/python/execution_engine.py
|
||||
+++ b/mlir/test/python/execution_engine.py
|
||||
@@ -1,4 +1,4 @@
|
||||
-# RUN: %PYTHON %s 2>&1 | FileCheck %s
|
||||
+# RUN: env LLVM_SHLIB_DIR=%llvm_shlib_dir %PYTHON %s 2>&1 | FileCheck %s
|
||||
# REQUIRES: host-supports-jit
|
||||
import gc, sys, os, tempfile
|
||||
from mlir.ir import *
|
||||
@@ -6,6 +6,8 @@ from mlir.passmanager import *
|
||||
from mlir.execution_engine import *
|
||||
from mlir.runtime import *
|
||||
|
||||
+_DEFAULT_LIB_DIR = "../../../../lib"
|
||||
+LIB_DIR = os.getenv("LLVM_SHLIB_DIR", _DEFAULT_LIB_DIR)
|
||||
|
||||
# Log everything to stderr and flush so that we have a unified stream to match
|
||||
# errors/info emitted by MLIR to stderr.
|
||||
@@ -540,8 +542,8 @@ def testSharedLibLoad():
|
||||
]
|
||||
else:
|
||||
shared_libs = [
|
||||
- "../../../../lib/libmlir_runner_utils.so",
|
||||
- "../../../../lib/libmlir_c_runner_utils.so",
|
||||
+ LIB_DIR + "/libmlir_runner_utils.so",
|
||||
+ LIB_DIR + "/libmlir_c_runner_utils.so",
|
||||
]
|
||||
|
||||
execution_engine = ExecutionEngine(
|
||||
@@ -583,8 +585,8 @@ def testNanoTime():
|
||||
]
|
||||
else:
|
||||
shared_libs = [
|
||||
- "../../../../lib/libmlir_runner_utils.so",
|
||||
- "../../../../lib/libmlir_c_runner_utils.so",
|
||||
+ LIB_DIR + "/libmlir_runner_utils.so",
|
||||
+ LIB_DIR + "/libmlir_c_runner_utils.so",
|
||||
]
|
||||
|
||||
execution_engine = ExecutionEngine(
|
||||
--
|
||||
2.41.0
|
||||
@ -1,27 +1,22 @@
|
||||
%bcond_without sys_llvm
|
||||
%bcond_without check
|
||||
%bcond_without toolchain_clang
|
||||
%bcond_without bisheng_autotuner
|
||||
|
||||
%if %{with toolchain_clang}
|
||||
%global toolchain clang
|
||||
%endif
|
||||
|
||||
%global maj_ver 17
|
||||
%global min_ver 0
|
||||
%global patch_ver 6
|
||||
%global maj_ver 18
|
||||
%global min_ver 1
|
||||
%global patch_ver 8
|
||||
%global mlir_version %{maj_ver}.%{min_ver}.%{patch_ver}
|
||||
%global mlir_srcdir mlir-%{mlir_version}%{?rc_ver:rc%{rc_ver}}.src
|
||||
|
||||
%if %{with sys_llvm}
|
||||
%global pkg_name mlir
|
||||
%global install_prefix %{_prefix}
|
||||
%global install_datadir %{_datadir}
|
||||
%else
|
||||
%global pkg_name mlir%{maj_ver}
|
||||
%global install_prefix %{_libdir}/llvm%{maj_ver}
|
||||
%global install_datadir %{install_prefix}/share
|
||||
%endif
|
||||
%global _scl_prefix /opt/openEuler
|
||||
%{?scl:%scl_package %scl}
|
||||
%{!?scl:%global scl_prefix llvm-toolset-%{maj_ver}-}
|
||||
%{!?scl:%global pkg_name %{name}}
|
||||
%global install_prefix %{!?scl:%{_scl_prefix}/llvm-toolset-%{maj_ver}/root}%{_prefix}
|
||||
%global install_datadir %{!?scl:%{_scl_prefix}/llvm-toolset-%{maj_ver}/root}%{_datadir}
|
||||
|
||||
%global install_bindir %{install_prefix}/bin
|
||||
%if 0%{?__isa_bits} == 64
|
||||
@ -31,9 +26,9 @@
|
||||
%endif
|
||||
%global install_includedir %{install_prefix}/include
|
||||
|
||||
Name: %{pkg_name}
|
||||
Name: %{?scl_prefix}llvm-mlir
|
||||
Version: %{mlir_version}
|
||||
Release: 4
|
||||
Release: 1
|
||||
Summary: The MLIR project is a novel approach to building reusable and extensible compiler infrastructure.
|
||||
License: Apache-2.0
|
||||
URL: https://mlir.llvm.org/
|
||||
@ -41,21 +36,13 @@ URL: https://mlir.llvm.org/
|
||||
Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{mlir_version}/%{mlir_srcdir}.tar.xz
|
||||
Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{mlir_version}/%{mlir_srcdir}.tar.xz.sig
|
||||
|
||||
Patch0: fedora-0001-mlir-python-Reuse-the-library-directory.patch
|
||||
|
||||
BuildRequires: clang
|
||||
BuildRequires: gcc gcc-c++ cmake ninja-build zlib-devel python3-lit
|
||||
%if %{with sys_llvm}
|
||||
BuildRequires: llvm-devel = %{version}
|
||||
BuildRequires: llvm-googletest = %{version}
|
||||
BuildRequires: llvm-test = %{version}
|
||||
BuildRequires: llvm-cmake-utils = %{version}
|
||||
%else
|
||||
BuildRequires: llvm%{maj_ver}-devel = %{version}
|
||||
BuildRequires: llvm%{maj_ver}-googletest = %{version}
|
||||
BuildRequires: llvm%{maj_ver}-test = %{version}
|
||||
BuildRequires: llvm%{maj_ver}-cmake-utils = %{version}
|
||||
%endif
|
||||
BuildRequires: %{?scl_prefix}llvm-devel = %{version}
|
||||
BuildRequires: %{?scl_prefix}llvm-googletest = %{version}
|
||||
BuildRequires: %{?scl_prefix}llvm-test = %{version}
|
||||
BuildRequires: %{?scl_prefix}llvm-cmake-utils = %{version}
|
||||
|
||||
BuildRequires: python3-devel
|
||||
BuildRequires: python3-numpy
|
||||
BuildRequires: python3-pybind11
|
||||
@ -69,25 +56,25 @@ existing compilers together.
|
||||
|
||||
%package static
|
||||
Summary: MLIR static files
|
||||
Requires: %{name} = %{version}
|
||||
Requires: %{pkg_name} = %{version}
|
||||
|
||||
%description static
|
||||
MLIR static files.
|
||||
|
||||
%package devel
|
||||
Summary: MLIR development files
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: %{name}-static = %{version}-%{release}
|
||||
Requires: %{pkg_name} = %{version}-%{release}
|
||||
Requires: %{pkg_name}-static = %{version}-%{release}
|
||||
|
||||
%description devel
|
||||
MLIR development files.
|
||||
|
||||
%package -n python3-%{name}
|
||||
%package -n python3-mlir
|
||||
Summary: MLIR python bindings
|
||||
Requires: python3
|
||||
Requires: python3-numpy
|
||||
|
||||
%description -n python3-%{name}
|
||||
%description -n python3-mlir
|
||||
%{summary}
|
||||
|
||||
%prep
|
||||
@ -112,13 +99,12 @@ Requires: python3-numpy
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DMLIR_INSTALL_AGGREGATE_OBJECTS=OFF \
|
||||
-DMLIR_BUILD_MLIR_C_DYLIB=ON \
|
||||
-DLLVM_EXTERNAL_LIT=%{_bindir}/lit \
|
||||
-DCMAKE_INSTALL_PREFIX=%{install_prefix} \
|
||||
%if "%{toolchain}" == "clang"
|
||||
-DCMAKE_C_COMPILER=clang \
|
||||
-DCMAKE_CXX_COMPILER=clang++ \
|
||||
%endif
|
||||
%if %{with bisheng_autotuner}
|
||||
-DLLVM_ENABLE_AUTOTUNER=ON \
|
||||
%endif
|
||||
%ifarch aarch64 %ix86 ppc64le x86_64
|
||||
-DLLVM_PARALLEL_LINK_JOBS=1 \
|
||||
%endif
|
||||
@ -129,7 +115,7 @@ Requires: python3-numpy
|
||||
%if 0%{?__isa_bits} == 64
|
||||
-DLLVM_LIBDIR_SUFFIX=64 \
|
||||
%else
|
||||
-DLLVM_LIBDIR_SUFFIX=
|
||||
-DLLVM_LIBDIR_SUFFIX= \
|
||||
%endif
|
||||
%ifarch %ix86 x86_64
|
||||
-DLLVM_TARGETS_TO_BUILD="X86"
|
||||
@ -138,17 +124,17 @@ Requires: python3-numpy
|
||||
-DLLVM_TARGETS_TO_BUILD="AArch64"
|
||||
%endif
|
||||
|
||||
%cmake_build
|
||||
%ninja_build
|
||||
|
||||
%install
|
||||
%cmake_install
|
||||
%ninja_install
|
||||
|
||||
mkdir -p %{buildroot}/%{python3_sitearch}
|
||||
mv %{buildroot}/usr/python_packages/mlir_core/mlir %{buildroot}/%{python3_sitearch}
|
||||
mv %{buildroot}%{install_prefix}/python_packages/mlir_core/mlir %{buildroot}/%{python3_sitearch}/mlir
|
||||
# These directories should be empty now.
|
||||
rmdir %{buildroot}/usr/python_packages/mlir_core %{buildroot}/usr/python_packages
|
||||
rmdir %{buildroot}%{install_prefix}/python_packages/mlir_core %{buildroot}%{install_prefix}/python_packages
|
||||
# Unneeded files.
|
||||
rm -rf %{buildroot}/usr/src/python
|
||||
rm -rf %{buildroot}%{install_prefix}/src/python
|
||||
|
||||
%if %{with check}
|
||||
%check
|
||||
@ -177,14 +163,16 @@ rm -rf test/tblgen-lsp-server/document-links.test
|
||||
rm -rf test/tblgen-lsp-server/hover.test
|
||||
|
||||
# build process .exe tools normally use rpath or static linkage
|
||||
export LD_LIBRARY_PATH=%{buildroot}/%{_libdir}:%{buildroot}/%{python3_sitearch}/mlir/_mlir_libs
|
||||
export LD_LIBRARY_PATH=%{buildroot}/%{install_libdir}:%{buildroot}/%{python3_sitearch}/mlir/_mlir_libs
|
||||
export PYTHONPATH=%{buildroot}/%{python3_sitearch}
|
||||
%cmake_build --target check-mlir
|
||||
%ninja_build check-mlir
|
||||
%endif
|
||||
|
||||
%files
|
||||
%license LICENSE.TXT
|
||||
%{install_libdir}/libMLIR*.so.*
|
||||
%{install_libdir}/libmlir_arm_runner_utils.so.%{maj_ver}*
|
||||
%{install_libdir}/libmlir_arm_sme_abi_stubs.so.%{maj_ver}*
|
||||
%{install_libdir}/libmlir_runner_utils.so.*
|
||||
%{install_libdir}/libmlir_c_runner_utils.so.*
|
||||
%{install_libdir}/libmlir_float16_utils.so.%{maj_ver}*
|
||||
@ -197,6 +185,9 @@ export PYTHONPATH=%{buildroot}/%{python3_sitearch}
|
||||
%{install_bindir}/mlir-tblgen
|
||||
%{install_bindir}/mlir-pdll
|
||||
%{install_libdir}/libMLIR*.so
|
||||
%{install_bindir}/tblgen-to-irdl
|
||||
%{install_libdir}/libmlir_arm_runner_utils.so
|
||||
%{install_libdir}/libmlir_arm_sme_abi_stubs.so
|
||||
%{install_libdir}/libmlir_runner_utils.so
|
||||
%{install_libdir}/libmlir_c_runner_utils.so
|
||||
%{install_libdir}/libmlir_float16_utils.so
|
||||
@ -205,10 +196,13 @@ export PYTHONPATH=%{buildroot}/%{python3_sitearch}
|
||||
%{install_includedir}/mlir-c
|
||||
%{install_libdir}/cmake/mlir
|
||||
|
||||
%files -n python3-%{name}
|
||||
%files -n python3-mlir
|
||||
%{python3_sitearch}/mlir/
|
||||
|
||||
%changelog
|
||||
* Fri Dec 6 2024 liyunfei <liyunfei33@huawei.com> - 18.1.8-1
|
||||
- init for Multi-Version LLVM-18.1.8
|
||||
|
||||
* Mon Nov 11 2024 Funda Wang <fundawang@yeah.net> - 17.0.6-4
|
||||
- adopt to new cmake macro
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
BIN
mlir-18.1.8.src.tar.xz
Normal file
BIN
mlir-18.1.8.src.tar.xz
Normal file
Binary file not shown.
BIN
mlir-18.1.8.src.tar.xz.sig
Normal file
BIN
mlir-18.1.8.src.tar.xz.sig
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user