[Mlir-commits] [mlir] 03ab306 - [MLIR] Split off MLIRExecutionEngineUtils to fix libMLIR.so build (PR54242)
Nikita Popov
llvmlistbot at llvm.org
Tue May 10 01:17:59 PDT 2022
Author: Nikita Popov
Date: 2022-05-10T10:17:52+02:00
New Revision: 03ab30686dc4db4b0c4a2652c0d610bb03f220d2
URL: https://github.com/llvm/llvm-project/commit/03ab30686dc4db4b0c4a2652c0d610bb03f220d2
DIFF: https://github.com/llvm/llvm-project/commit/03ab30686dc4db4b0c4a2652c0d610bb03f220d2.diff
LOG: [MLIR] Split off MLIRExecutionEngineUtils to fix libMLIR.so build (PR54242)
Building libMLIR.so currently fails with:
> /usr/bin/ld: /tmp/ccNzulEA.ltrans39.ltrans.o: in function `(anonymous namespace)::SerializeToHsacoPass::optimizeLlvm(llvm::Module&, llvm::TargetMachine&)':
> /builddir/build/BUILD/llvm-project-15.0.0.src/mlir/lib/Dialect/GPU/Transforms/SerializeToHsaco.cpp:328: undefined reference to `mlir::makeOptimizingTransformer(unsigned int, unsigned int, llvm::TargetMachine*)'
This is because MLIRGPUTransforms depends on MLIRExecutionEngine in
https://github.com/llvm/llvm-project/blob/61bb2e4ea82fc5499a271d70d4537383d1942208/mlir/lib/Dialect/GPU/Transforms/SerializeToHsaco.cpp#L328,
but MLIRExecutionEngine is marked as excluded from libMLIR.so.
However, this code doesn't require the full execution engine: It
only performs middle-end optimization, and does not need any of
the JIT/codegen infrastructure. As such, split off a separate
library MLIRExecutionEngineUtils, which only contains that part
and is not excluded from libMLIR.so.
Fixes https://github.com/llvm/llvm-project/issues/54242.
Differential Revision: https://reviews.llvm.org/D125214
Added:
Modified:
mlir/lib/Dialect/GPU/CMakeLists.txt
mlir/lib/ExecutionEngine/CMakeLists.txt
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/GPU/CMakeLists.txt b/mlir/lib/Dialect/GPU/CMakeLists.txt
index 56587d4130677..50921edb061b6 100644
--- a/mlir/lib/Dialect/GPU/CMakeLists.txt
+++ b/mlir/lib/Dialect/GPU/CMakeLists.txt
@@ -69,6 +69,7 @@ add_mlir_dialect_library(MLIRGPUTransforms
MLIRArithmetic
MLIRAsync
MLIRDataLayoutInterfaces
+ MLIRExecutionEngineUtils
MLIRGPUOps
MLIRIR
MLIRLLVMIR
diff --git a/mlir/lib/ExecutionEngine/CMakeLists.txt b/mlir/lib/ExecutionEngine/CMakeLists.txt
index e1f30470a9fd6..687f88fe81f97 100644
--- a/mlir/lib/ExecutionEngine/CMakeLists.txt
+++ b/mlir/lib/ExecutionEngine/CMakeLists.txt
@@ -23,9 +23,33 @@ if(LLVM_USE_PERF)
PerfJITEvents)
endif(LLVM_USE_PERF)
+# Use a separate library for OptUtils, to avoid pulling in the entire JIT and
+# codegen infrastructure. Unlike MLIRExecutionEngine, this is part of
+# libMLIR.so.
+add_mlir_library(MLIRExecutionEngineUtils
+ OptUtils.cpp
+
+ ADDITIONAL_HEADER_DIRS
+ ${MLIR_MAIN_INCLUDE_DIR}/mlir/ExecutionEngine
+
+ DEPENDS
+ intrinsics_gen
+
+ LINK_COMPONENTS
+ Analysis
+ Core
+ Coroutines
+ AggressiveInstCombine
+ InstCombine
+ ScalarOpts
+ Vectorize
+ TransformUtils
+ IPO
+ Passes
+ )
+
add_mlir_library(MLIRExecutionEngine
ExecutionEngine.cpp
- OptUtils.cpp
EXCLUDE_FROM_LIBMLIR
@@ -56,6 +80,7 @@ add_mlir_library(MLIRExecutionEngine
${LLVM_JIT_LISTENER_LIB}
LINK_LIBS PUBLIC
+ MLIRExecutionEngineUtils
MLIRLLVMIR
MLIRLLVMToLLVMIRTranslation
MLIRTargetLLVMIRExport
More information about the Mlir-commits
mailing list