-
Notifications
You must be signed in to change notification settings - Fork 14.7k
[mlir][cmake] Fix MLIR shared library installation #152195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-mlir Author: Boyana Norris (brnorris03) ChangesWhen Patch verified here. Closes #151247 Full diff: https://github.com/llvm/llvm-project/pull/152195.diff 1 Files Affected:
diff --git a/mlir/cmake/modules/AddMLIR.cmake b/mlir/cmake/modules/AddMLIR.cmake
index ff4269ed7acd2..93b5b4766146b 100644
--- a/mlir/cmake/modules/AddMLIR.cmake
+++ b/mlir/cmake/modules/AddMLIR.cmake
@@ -388,6 +388,9 @@ function(add_mlir_library name)
if(TARGET ${name})
target_link_libraries(${name} INTERFACE ${LLVM_COMMON_LIBS})
+ if(ARG_INSTALL_WITH_TOOLCHAIN)
+ set_target_properties(${name} PROPERTIES MLIR_INSTALL_WITH_TOOLCHAIN TRUE)
+ endif()
if(NOT ARG_DISABLE_INSTALL)
add_mlir_library_install(${name})
endif()
@@ -617,7 +620,8 @@ endfunction(add_mlir_aggregate)
# This is usually done as part of add_mlir_library but is broken out for cases
# where non-standard library builds can be installed.
function(add_mlir_library_install name)
- if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ get_target_property(_install_with_toolchain ${name} MLIR_INSTALL_WITH_TOOLCHAIN)
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR _install_with_toolchain)
get_target_export_arg(${name} MLIR export_to_mlirtargets UMBRELLA mlir-libraries)
install(TARGETS ${name}
COMPONENT ${name}
|
As the reporter of #151247, this PR has my 👍 |
@christopherbate, can you please take a look? I was also looking to add an install check in CI for this, but it doesn't seem like the install is being tested atm, so my own local check and the independent verification by @PHHargrove are all I have as proof that this works. |
Hello! This commit causes failure in our 3-stage LTO-PGO-BOLT build. loading initial cache file /local/home/work/llvm-project/build-3-stage/build_Release_LTO-PGO-BOLT_main/clang/cmake/caches/PGO-stage2-instrumented.cmake
-- The C compiler identification is Clang 22.0.0
-- The CXX compiler identification is Clang 22.0.0
-- The ASM compiler identification is Clang
-- Found assembler: /local/home/work/llvm-project/build-3-stage/build_Release_LTO-PGO-BOLT_main/build/./bin/clang
-- Detecting C compiler ABI info
--...
-- Found Python3: /usr/bin/python3.11 (found suitable version "3.11.4", minimum required is "3.8") found components: Interpreter
-- Performing Test LLVM_LIBSTDCXX_MIN
-- Performing Test LLVM_LIBSTDCXX_MIN - Success
-- Performing Test LLVM_LIBSTDCXX_SOFT_ERROR
-- Performing Test LLVM_LIBSTDCXX_SOFT_ERROR - Success
-- Looking for __GLIBC__
-- Looking for __GLIBC__ - found
...
-- Looking for pthread_create in pthread - found
-- Looking for pthread_rwlock_init in pthread
-- Looking for pthread_rwlock_init in pthread - found
-- Looking for pthread_mutex_lock in pthread
-- Looking for pthread_mutex_lock in pthread - found
-- Looking for dlopen in dl
-- Looking for dlopen in dl - found
-- Looking for shm_open in rt
-- Looking for shm_open in rt - found
-- Looking for pfm_initialize in pfm
-- Looking for pfm_initialize in pfm - not found
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
--...
-- Looking for __unw_add_dynamic_fde
-- Looking for __unw_add_dynamic_fde - not found
-- Looking for _Unwind_Backtrace
--
-- Looking for setenv
--
--
-- Performing Test HAVE_STEADY_CLOCK -- success
-- Compiling and running to test HAVE_PTHREAD_AFFINITY
-- Performing Test HAVE_PTHREAD_AFFINITY -- failed to compile
-- Configuring done
CMake Error in /local/home/work/llvm-project/build-3-stage/build_Release_LTO-PGO-BOLT_main/flang/cmake/modules/CMakeLists.txt:
export called with target "FortranLower" which requires target
"MLIRAffineAnalysis" that is not in any export set.
Make Error in /local/home/work/llvm-project/build-3-stage/build_Release_LTO-PGO-BOLT_main/flang/cmake/modules/CMakeLists.txt:
export called with target "FortranLower" which requires target
"MLIRAffineDialect" that is not in any export set.
CMake Error in /local/home/work/llvm-project/build-3-stage/build_Release_LTO-PGO-BOLT_main/flang/cmake/modules/CMakeLists.txt:
export called with target "FortranLower" which requires target
"MLIRAffineTransforms" that is not in any export set.
CMake Error in /local/home/work/llvm-project/build-3-stage/build_Release_LTO-PGO-BOLT_main/flang/cmake/modules/CMakeLists.txt:
export called with target "FortranLower" which requires target
"MLIRAffineTransformOps" that is not in any export set.
CMake Error in /local/home/work/llvm-project/build-3-stage/build_Release_LTO-PGO-BOLT_main/flang/cmake/modules/CMakeLists.txt:
export called with target "FortranLower" which requires target
"MLIRAffineUtils" that is not in any export set.
CMake Error in /local/home/work/llvm-project/build-3-stage/build_Release_LTO-PGO-BOLT_main/flang/cmake/modules/CMakeLists.txt:
export called with target "FortranLower" which requires target
"MLIRAMDGPUDialect" that is not in any export set.
CMake Error in /local/home/work/llvm-project/build-3-stage/build_Release_LTO-PGO-BOLT_main/flang/cmake/modules/CMakeLists.txt:
export called with target "FortranLower" which requires target
"MLIRAMDGPUTransforms" that is not in any export set. |
What configure options are you using? (Or if it's easier to answer -- how do I reproduce?) Also, can you please check if applying this patch fixes the issue?
|
We use standard 3-stage LTO-PGO-BOLT builds based on https://github.com/llvm/llvm-project/blob/main/clang/cmake/caches/BOLT-PGO.cmake. -DLLVM_ENABLE_PROJECTS=bolt;clang;flang;lld
-DLLVM_ENABLE_RUNTIMES=openmp;compier-rt
-DLLVM_TARGETS_TO_BUILD=AArch64
-DCLANG_DEFAULT_LINKER=lld
-DCMAKE_BUILD_TYPE=Release
-C /local/home/work/llvm-project/llvm/../clang/cmake/caches/BOLT-PGO.cmake
-DBOOTSTRAP_LLVM_ENABLE_LLD=ON
-DBOOTSTRAP_BOOTSTRAP_LLVM_ENABLE_LLD=ON
-DBOOTSTRAP_CLANG_DEFAULT_LINKER=lld
-DBOOTSTRAP_BOOTSTRAP_CLANG_DEFAULT_LINKER=lld
-DPGO_INSTRUMENT_LTO=Thin |
@brnorris03 I tried your Draft PR, it fixes the issue. Thank you! |
When
LLVM_INSTALL_TOOLCHAIN_ONLY=ON
, the MLIR shared library (libMLIR*
) is not installed even though it is built with theINSTALL_WITH_TOOLCHAIN
argument to theadd_mlir_library
cmake function. This patch ensures thatlibMLIR*
is installed whenLLVM_INSTALL_TOOLCHAIN_ONLY=ON
.Patch verified here.
fixes #151247