[Mlir-commits] [mlir] [MLIR][ExecutionEngine] Introduce shared library (PR #87067)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Mar 29 06:52:41 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-execution-engine
@llvm/pr-subscribers-mlir
Author: Christian Ulmann (Dinistro)
<details>
<summary>Changes</summary>
This commit introduces a shared library for the MLIR execution engine. This library is only built when `LLVM_BUILD_LLVM_DYLIB` is set. Having such a library allows downstream users to depend on the execution engine without giving up dynamic linkage. This is especially important for CPU runner-style tools, as they link against large parts of MLIR and LLVM.
It is alternatively possible to modify the `MLIRExecutionEngine` target when `LLVM_BUILD_LLVM_DYLIB` is set, to avoid duplicated libraries.
---
Full diff: https://github.com/llvm/llvm-project/pull/87067.diff
1 Files Affected:
- (modified) mlir/lib/ExecutionEngine/CMakeLists.txt (+23)
``````````diff
diff --git a/mlir/lib/ExecutionEngine/CMakeLists.txt b/mlir/lib/ExecutionEngine/CMakeLists.txt
index b7e448d5417ea9..a091944b9ee7df 100644
--- a/mlir/lib/ExecutionEngine/CMakeLists.txt
+++ b/mlir/lib/ExecutionEngine/CMakeLists.txt
@@ -97,6 +97,29 @@ add_mlir_library(MLIRExecutionEngine
MLIRTargetLLVMIRExport
)
+if(LLVM_BUILD_LLVM_DYLIB)
+ # Build a shared library for the execution engine. Some downstream projects
+ # use this library to build their own CPU runners while preserving dynamic
+ # linkage.
+ add_mlir_library(MLIRExecutionEngineShared
+ ExecutionEngine.cpp
+ SHARED
+
+ EXCLUDE_FROM_LIBMLIR
+
+ ADDITIONAL_HEADER_DIRS
+ ${MLIR_MAIN_INCLUDE_DIR}/mlir/ExecutionEngine
+
+ # Ensures that all necessary dependencies are resolved.
+ DEPENDS
+ MLIRExecutionEngine
+
+ LINK_LIBS PUBLIC
+ LLVM
+ MLIR
+ )
+endif()
+
get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
add_mlir_library(MLIRJitRunner
JitRunner.cpp
``````````
</details>
https://github.com/llvm/llvm-project/pull/87067
More information about the Mlir-commits
mailing list