torch-mlir/externals/llvm-external-projects/torch-mlir-dialects
Clément Fournier 886ad169e5
Fix out-of-tree build of torch-mlir-dialects (#726)
Follows up on #623 for out-of-tree builds of torch-mlir, which
added building `torch-mir-dialects` as a subdirectory.

Our goal is to support both in-tree and out-of-tree builds of
`torch-mlir` with minimum hassle, for instance by using the same
variable names in both setups.

Specific changes to `externals/llvm-external-projects/torch-mlir-dialects/CMakeLists.txt`:
- We use `MLIR_FOUND` to detect that it is being build as a subdirectory
and the llvm+mlir cmake infrastructure is already set up (via
find_package in the parent build) as opposed to an in-tree build.
- For in-tree, the setting of variables and loading of llvm+mlir cmake
infrastructure is now conditionally performed.
- For in-tree, the names of cmake variables being defined for are
adjusted to match those `llvm-project` makes available through
`find_package(MLIR REQUIRED CONFIG)`, under the assumption that those
are the more "standardized" names.

Co-authored-by: Clément Fournier <clement.fournier@amd.com>

Co-authored-by: Liam Fitzpatrick <liam.fitzpatrick@xilinx.com>
2022-04-04 11:37:28 +02:00
..
include [NFC] Rename external -> externals (#699) 2022-03-26 09:12:27 -07:00
lib [NFC] Rename external -> externals (#699) 2022-03-26 09:12:27 -07:00
test Fix out-of-tree build of torch-mlir-dialects (#726) 2022-04-04 11:37:28 +02:00
tools [NFC] Rename external -> externals (#699) 2022-03-26 09:12:27 -07:00
CMakeLists.txt Fix out-of-tree build of torch-mlir-dialects (#726) 2022-04-04 11:37:28 +02:00
README.md [NFC] Rename external -> externals (#699) 2022-03-26 09:12:27 -07:00

README.md

Torch-MLIR Dialects Project

Sources for torch-mlir's public dialects (containing ops/types/attributes that are unique to Torch-MLIR at the moment)

This project is intended to be used via LLVM's external projects setup:

  • -DLLVM_EXTERNAL_PROJECTS=torch-mlir-dialects
  • -DLLVM_EXTERNAL_TORCH_MLIR_DIALECTS_SOURCE_DIR={this_directory}

It depends on the mlir project.