From f202ae00129e5f03b14e3d04d63e3eca4da17ed5 Mon Sep 17 00:00:00 2001 From: powderluv Date: Thu, 7 Jul 2022 15:42:08 -0700 Subject: [PATCH] Revert to using local PyTorch binaries (#1024) Temporarily revert to using PyTorch binaries until source builds are ready to land. TORCH_MLIR_USE_INSTALLED_PYTORCH can be turned to OFF if you want to link against libtorch and/or source builds. --- .../dialects/torch/importer/jit_ir/CMakeLists.txt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/CMakeLists.txt b/python/torch_mlir/dialects/torch/importer/jit_ir/CMakeLists.txt index aa23274ed..f5051e01a 100644 --- a/python/torch_mlir/dialects/torch/importer/jit_ir/CMakeLists.txt +++ b/python/torch_mlir/dialects/torch/importer/jit_ir/CMakeLists.txt @@ -5,9 +5,20 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") include(TorchMLIRPyTorch) set(Torch_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../libtorch/share/cmake/Torch") + +option(TORCH_MLIR_USE_INSTALLED_PYTORCH "Build from local PyTorch in environment" ON) + +if(TORCH_MLIR_USE_INSTALLED_PYTORCH) + TorchMLIRProbeForPyTorchInstall() +endif() + find_package(Torch 1.11 REQUIRED) -TorchMLIRConfigureLibTorch() +if(TORCH_MLIR_USE_INSTALLED_PYTORCH) + TorchMLIRConfigurePyTorch() +else() + TorchMLIRConfigureLibTorch() +endif() message(STATUS "libtorch_python CXXFLAGS is ...${TORCH_CXXFLAGS}") #-------------------------------------------------------------------------------