From 3e97a33c80a85315122c56ac9dc6183d1e41998f Mon Sep 17 00:00:00 2001 From: Henry Tu Date: Mon, 8 Aug 2022 21:58:35 -0400 Subject: [PATCH] Revert "Reenable LTC in out-of-tree build (#1177)" (#1183) This reverts commit f85ae9c685d6c9f2d43fe60fdad2ad5d3183ec52. --- .github/workflows/buildAndTest.yml | 2 ++ .../dialects/torch/importer/jit_ir/csrc/CMakeLists.txt | 10 +++++++++- setup.py | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/buildAndTest.yml b/.github/workflows/buildAndTest.yml index 19d5e2f44..94cf6343e 100644 --- a/.github/workflows/buildAndTest.yml +++ b/.github/workflows/buildAndTest.yml @@ -87,6 +87,7 @@ jobs: externals/llvm-project/llvm cmake --build llvm-build + # TODO: Reenable LTC once OOT build is successful (https://github.com/llvm/torch-mlir/issues/1154) cmake -GNinja -Bbuild \ -DCMAKE_LINKER=lld \ -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ @@ -96,6 +97,7 @@ jobs: -DMLIR_ENABLE_BINDINGS_PYTHON=OFF \ -DTORCH_MLIR_ENABLE_MHLO=ON \ -DTORCH_MLIR_USE_INSTALLED_PYTORCH=${{ matrix.torch-binary }} \ + -DTORCH_MLIR_ENABLE_LTC=OFF \ -DPython3_EXECUTABLE=$(which python) \ . diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/CMakeLists.txt b/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/CMakeLists.txt index 5e5e87b6f..f07403ba5 100644 --- a/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/CMakeLists.txt +++ b/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/CMakeLists.txt @@ -10,7 +10,15 @@ include_directories(BEFORE ) link_directories("${TORCH_INSTALL_PREFIX}/lib") -add_library(TorchMLIRJITIRImporter SHARED +# TODO: Currently, out-of-tree build fails when LIBRARY_TYPE is set to SHARED, so we have this toggle. +# See https://github.com/llvm/torch-mlir/issues/1154 for more details. +if(TORCH_MLIR_ENABLE_LTC) + set(LIBRARY_TYPE "SHARED") +else() + set(LIBRARY_TYPE "MODULE") +endif() + +add_library(TorchMLIRJITIRImporter ${LIBRARY_TYPE} class_annotator.cpp class_annotator_pybind.cpp get_registered_ops.cpp diff --git a/setup.py b/setup.py index 85ce480fd..f16b7a362 100644 --- a/setup.py +++ b/setup.py @@ -76,6 +76,8 @@ class CMakeBuild(build_py): f"-DMLIR_ENABLE_BINDINGS_PYTHON=ON", f"-DLLVM_ENABLE_PROJECTS=mlir", f"-DTORCH_MLIR_ENABLE_MHLO=ON", + # TODO: Reenable LTC once JIT importer linkage issue is fixed (https://github.com/llvm/torch-mlir/issues/1154) + f"-DTORCH_MLIR_ENABLE_LTC=OFF", f"-DLLVM_EXTERNAL_PROJECTS=torch-mlir;torch-mlir-dialects", f"-DLLVM_EXTERNAL_TORCH_MLIR_SOURCE_DIR={src_dir}", f"-DLLVM_EXTERNAL_TORCH_MLIR_DIALECTS_SOURCE_DIR={src_dir}/externals/llvm-external-projects/torch-mlir-dialects",