[PATCH] D73653: [MLIR] Fixes for shared library dependencies.

Stephen Neuendorffer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 29 11:40:27 PST 2020


stephenneuendorffer created this revision.
Herald added subscribers: llvm-commits, liufengdb, aartbik, herhut, lucyrfox, mgester, arpith-jacob, csigg, antiagainst, shauheen, burmako, jpienaar, rriddle, mehdi_amini, mgorny, jholewinski.
Herald added a reviewer: mravishankar.
Herald added a reviewer: antiagainst.
Herald added a reviewer: nicolasvasilache.
Herald added a reviewer: nicolasvasilache.
Herald added a project: LLVM.
stephenneuendorffer added a child revision: D73654: [MLIR] break cyclic dependency between VectorOps and Analysis.

This patch is a step towards enabling BUILD_SHARED_LIBS=on, which
builds most libraries as DLLs instead of statically linked libraries.
The main effect of this is that incremental build times are greatly
reduced, since usually only one library need be relinked in response
to isolated code changes.

The bulk of this patch is fixing incorrect usage of cmake, where library
dependencies are listed under add_dependencies rather than under
target_link_libraries or under the LINK_LIBS tag.  Correct usage should be
like this:

add_dependencies(MLIRfoo MLIRfooIncGen)
target_link_libraries(MLIRfoo MLIRlib1 MLIRlib2)

A separate issue is that in cmake, dependencies between static libraries
are automatically included in dependencies.  In the above example, if MLIBlib1
depends on MLIRlib2, then it is sufficient to have only MLIRlib1 in the
target_link_libraries.  When compiling with shared libraries, it is necessary
to have both MLIRlib1 and MLIRlib2 specified.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73653

Files:
  mlir/cmake/modules/AddMLIR.cmake
  mlir/lib/Conversion/AffineToStandard/CMakeLists.txt
  mlir/lib/Conversion/GPUToNVVM/CMakeLists.txt
  mlir/lib/Conversion/GPUToROCDL/CMakeLists.txt
  mlir/lib/Conversion/LinalgToLLVM/CMakeLists.txt
  mlir/lib/Conversion/LoopsToGPU/CMakeLists.txt
  mlir/lib/Conversion/VectorToLLVM/CMakeLists.txt
  mlir/lib/Conversion/VectorToLoops/CMakeLists.txt
  mlir/lib/Dialect/FxpMathOps/CMakeLists.txt
  mlir/lib/Dialect/GPU/CMakeLists.txt
  mlir/lib/Dialect/LLVMIR/CMakeLists.txt
  mlir/lib/Dialect/LoopOps/CMakeLists.txt
  mlir/lib/Dialect/QuantOps/CMakeLists.txt
  mlir/lib/Dialect/SPIRV/Serialization/CMakeLists.txt
  mlir/lib/Dialect/VectorOps/CMakeLists.txt
  mlir/lib/EDSC/CMakeLists.txt
  mlir/lib/ExecutionEngine/CMakeLists.txt
  mlir/lib/Quantizer/CMakeLists.txt
  mlir/lib/Support/CMakeLists.txt
  mlir/test/Dialect/SPIRV/CMakeLists.txt
  mlir/test/lib/IR/CMakeLists.txt
  mlir/test/lib/Pass/CMakeLists.txt
  mlir/test/lib/TestDialect/CMakeLists.txt
  mlir/test/lib/Transforms/CMakeLists.txt
  mlir/tools/mlir-opt/CMakeLists.txt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73653.241239.patch
Type: text/x-patch
Size: 14102 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200129/7b491e14/attachment.bin>


More information about the llvm-commits mailing list