[all-commits] [llvm/llvm-project] 4f0f43: [MLIR] Adjust libMLIR building to more closely fol...

Valentin Churavy via All-commits all-commits at lists.llvm.org
Mon May 4 11:41:07 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 4f0f436749c264c16eb226c9b9b132e07e3650a6
      https://github.com/llvm/llvm-project/commit/4f0f436749c264c16eb226c9b9b132e07e3650a6
  Author: Valentin Churavy <v.churavy at gmail.com>
  Date:   2020-05-04 (Mon, 04 May 2020)

  Changed paths:
    M mlir/cmake/modules/AddMLIR.cmake
    M mlir/cmake/modules/MLIRConfig.cmake.in
    M mlir/examples/toy/Ch6/CMakeLists.txt
    M mlir/examples/toy/Ch7/CMakeLists.txt
    M mlir/lib/Analysis/CMakeLists.txt
    M mlir/lib/Conversion/AVX512ToLLVM/CMakeLists.txt
    M mlir/lib/Conversion/AffineToStandard/CMakeLists.txt
    M mlir/lib/Conversion/GPUToCUDA/CMakeLists.txt
    M mlir/lib/Conversion/GPUToNVVM/CMakeLists.txt
    M mlir/lib/Conversion/GPUToROCDL/CMakeLists.txt
    M mlir/lib/Conversion/GPUToVulkan/CMakeLists.txt
    M mlir/lib/Conversion/LinalgToLLVM/CMakeLists.txt
    M mlir/lib/Conversion/LoopToStandard/CMakeLists.txt
    M mlir/lib/Conversion/LoopsToGPU/CMakeLists.txt
    M mlir/lib/Conversion/StandardToLLVM/CMakeLists.txt
    M mlir/lib/Conversion/VectorToLLVM/CMakeLists.txt
    M mlir/lib/Conversion/VectorToLoops/CMakeLists.txt
    M mlir/lib/Dialect/AVX512/CMakeLists.txt
    M mlir/lib/Dialect/Affine/EDSC/CMakeLists.txt
    M mlir/lib/Dialect/Affine/IR/CMakeLists.txt
    M mlir/lib/Dialect/Affine/Transforms/CMakeLists.txt
    M mlir/lib/Dialect/Affine/Utils/CMakeLists.txt
    M mlir/lib/Dialect/GPU/CMakeLists.txt
    M mlir/lib/Dialect/LLVMIR/CMakeLists.txt
    M mlir/lib/Dialect/LLVMIR/Transforms/CMakeLists.txt
    M mlir/lib/Dialect/Linalg/Analysis/CMakeLists.txt
    M mlir/lib/Dialect/Linalg/EDSC/CMakeLists.txt
    M mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt
    M mlir/lib/Dialect/Linalg/Utils/CMakeLists.txt
    M mlir/lib/Dialect/LoopOps/CMakeLists.txt
    M mlir/lib/Dialect/LoopOps/Transforms/CMakeLists.txt
    M mlir/lib/Dialect/OpenMP/CMakeLists.txt
    M mlir/lib/Dialect/Quant/CMakeLists.txt
    M mlir/lib/Dialect/SDBM/CMakeLists.txt
    M mlir/lib/Dialect/SPIRV/CMakeLists.txt
    M mlir/lib/Dialect/SPIRV/Serialization/CMakeLists.txt
    M mlir/lib/Dialect/SPIRV/Transforms/CMakeLists.txt
    M mlir/lib/Dialect/Shape/CMakeLists.txt
    M mlir/lib/Dialect/StandardOps/CMakeLists.txt
    M mlir/lib/Dialect/Vector/CMakeLists.txt
    M mlir/lib/EDSC/CMakeLists.txt
    M mlir/lib/ExecutionEngine/CMakeLists.txt
    M mlir/lib/IR/CMakeLists.txt
    M mlir/lib/Interfaces/CMakeLists.txt
    M mlir/lib/Parser/CMakeLists.txt
    M mlir/lib/Pass/CMakeLists.txt
    M mlir/lib/Support/CMakeLists.txt
    M mlir/lib/TableGen/CMakeLists.txt
    M mlir/lib/Target/CMakeLists.txt
    M mlir/lib/Transforms/CMakeLists.txt
    M mlir/lib/Transforms/Utils/CMakeLists.txt
    M mlir/lib/Translation/CMakeLists.txt
    M mlir/test/EDSC/CMakeLists.txt
    M mlir/test/SDBM/CMakeLists.txt
    M mlir/test/lib/Dialect/Affine/CMakeLists.txt
    M mlir/test/lib/Dialect/SPIRV/CMakeLists.txt
    M mlir/test/lib/Dialect/Test/CMakeLists.txt
    M mlir/test/lib/IR/CMakeLists.txt
    M mlir/test/lib/Pass/CMakeLists.txt
    M mlir/test/lib/Transforms/CMakeLists.txt
    M mlir/tools/mlir-cpu-runner/CMakeLists.txt
    M mlir/tools/mlir-linalg-ods-gen/CMakeLists.txt
    M mlir/tools/mlir-opt/CMakeLists.txt
    M mlir/tools/mlir-shlib/CMakeLists.txt
    M mlir/tools/mlir-tblgen/CMakeLists.txt
    M mlir/tools/mlir-translate/CMakeLists.txt

  Log Message:
  -----------
  [MLIR] Adjust libMLIR building to more closely follow libClang

- Exports MLIR targets to be used out-of-tree.
- mimicks `add_clang_library` and `add_flang_library`.
- Fixes libMLIR.so

After https://reviews.llvm.org/D77515 libMLIR.so was no longer containing
any object files. We originally had a cludge there that made it work with
the static initalizers and when switchting away from that to the way the
clang shlib does it, I noticed that MLIR doesn't create a `obj.{name}` target,
and doesn't export it's targets to `lib/cmake/mlir`.

This is due to MLIR using `add_llvm_library` under the hood, which adds
the target to `llvmexports`.

Differential Revision: https://reviews.llvm.org/D78773

[MLIR] Fix libMLIR.so and LLVM_LINK_LLVM_DYLIB

Primarily, this patch moves all mlir references to LLVM libraries into
either LLVM_LINK_COMPONENTS or LINK_COMPONENTS.  This enables magic in
the llvm cmake files to automatically replace reference to LLVM components
with references to libLLVM.so when necessary.  Among other things, this
completes fixing libMLIR.so, which has been broken for some configurations
since D77515.

Unlike previously, the pattern is now that mlir libraries should almost
always use add_mlir_library.  Previously, some libraries still used
add_llvm_library.  However, this confuses the export of targets for use
out of tree because libraries specified with add_llvm_library are exported
by LLVM.  Instead users which don't need/can't be linked into libMLIR.so
can specify EXCLUDE_FROM_LIBMLIR

A common error mode is linking with LLVM libraries outside of LINK_COMPONENTS.
This almost always results in symbol confusion or multiply defined options
in LLVM when the same object file is included as a static library and
as part of libLLVM.so.  To catch these errors more directly, there's now
mlir_check_all_link_libraries.

To simplify usage of add_mlir_library, we assume that all mlir
libraries depend on LLVMSupport, so it's not necessary to separately specify
it.

tested with:
BUILD_SHARED_LIBS=on,
BUILD_SHARED_LIBS=off + LLVM_BUILD_LLVM_DYLIB,
BUILD_SHARED_LIBS=off + LLVM_BUILD_LLVM_DYLIB + LLVM_LINK_LLVM_DYLIB.

By: Stephen Neuendorffer <stephen.neuendorffer at xilinx.com>
Differential Revision: https://reviews.llvm.org/D79067

[MLIR] Move from using target_link_libraries to LINK_LIBS

This allows us to correctly generate dependencies for derived targets,
such as targets which are created for object libraries.

By: Stephen Neuendorffer <stephen.neuendorffer at xilinx.com>
Differential Revision: https://reviews.llvm.org/D79243

Three commits have been squashed to avoid intermediate build breakage.




More information about the All-commits mailing list