From 5eb892ac3ce323d3db5b1dc1724d57ba61f8d28d Mon Sep 17 00:00:00 2001 From: Jakub Kuderski Date: Thu, 23 Mar 2023 09:35:58 -0400 Subject: [PATCH] [mhlo] Drop unnecessary build dependencies (#12728) Also update the bazel-cmake target mapping to avoid pulling in unused cmake targets. Issue: https://github.com/openxla/iree/issues/12678 --- build_tools/bazel_to_cmake/bazel_to_cmake_targets.py | 11 +++-------- .../iree/compiler/InputConversion/MHLO/BUILD.bazel | 2 -- .../iree/compiler/InputConversion/MHLO/CMakeLists.txt | 4 ---- compiler/src/iree/compiler/Tools/BUILD.bazel | 1 - 4 files changed, 3 insertions(+), 15 deletions(-) diff --git a/build_tools/bazel_to_cmake/bazel_to_cmake_targets.py b/build_tools/bazel_to_cmake/bazel_to_cmake_targets.py index fd5884ef9794..9948c768bd0a 100644 --- a/build_tools/bazel_to_cmake/bazel_to_cmake_targets.py +++ b/build_tools/bazel_to_cmake/bazel_to_cmake_targets.py @@ -84,11 +84,6 @@ "ChloOps", "MhloDialect", ], - "@mlir-hlo//:map_lmhlo_to_scalar_op": [ - "tensorflow::external_mhlo_includes", - "LmhloDialect", # Unfortunate. - "MhloDialect", - ], "@mlir-hlo//:map_mhlo_to_scalar_op": [ "tensorflow::external_mhlo_includes", "MhloDialect", @@ -97,12 +92,12 @@ "tensorflow::external_mhlo_includes", "MhloPasses", "MhloShapeOpsToStandard", - "MhloToArithmeticConversion", - "MhloToLhloConversion", "MhloToLinalg", - "MhloToMemrefConversion", "MhloToStandard", "StablehloToMhlo", + # Note: We deliberately omit some passes that we do not use in IREE, + # e.g.: MhloToArithmeticConversion, MhloToLhloConversion, or + # MhloToMemrefConversion. ], "@mlir-hlo//:unfuse_batch_norm": [ "tensorflow::external_mhlo_includes", diff --git a/compiler/src/iree/compiler/InputConversion/MHLO/BUILD.bazel b/compiler/src/iree/compiler/InputConversion/MHLO/BUILD.bazel index 7912457470bb..1cbd07c1ceb3 100644 --- a/compiler/src/iree/compiler/InputConversion/MHLO/BUILD.bazel +++ b/compiler/src/iree/compiler/InputConversion/MHLO/BUILD.bazel @@ -100,11 +100,9 @@ iree_compiler_cc_library( "@llvm-project//mlir:Transforms", "@mlir-hlo//:chlo_legalize_to_hlo", "@mlir-hlo//:map_chlo_to_hlo_op", - "@mlir-hlo//:map_lmhlo_to_scalar_op", "@mlir-hlo//:map_mhlo_to_scalar_op", "@mlir-hlo//:mhlo_passes", "@mlir-hlo//:mlir_hlo", - "@mlir-hlo//:unfuse_batch_norm", "@mlir-hlo//stablehlo:broadcast_utils", "@mlir-hlo//stablehlo:chlo_ops", ], diff --git a/compiler/src/iree/compiler/InputConversion/MHLO/CMakeLists.txt b/compiler/src/iree/compiler/InputConversion/MHLO/CMakeLists.txt index 4afeac3b6c71..b3dc7f15ef3a 100644 --- a/compiler/src/iree/compiler/InputConversion/MHLO/CMakeLists.txt +++ b/compiler/src/iree/compiler/InputConversion/MHLO/CMakeLists.txt @@ -59,7 +59,6 @@ iree_cc_library( IREELinalgExtDialect IREELinalgExtPasses LLVMSupport - LmhloDialect MLIRAffineDialect MLIRAffineUtils MLIRArithDialect @@ -87,10 +86,7 @@ iree_cc_library( MhloDialect MhloPasses MhloShapeOpsToStandard - MhloToArithmeticConversion - MhloToLhloConversion MhloToLinalg - MhloToMemrefConversion MhloToStandard StablehloBroadcastUtils StablehloToMhlo diff --git a/compiler/src/iree/compiler/Tools/BUILD.bazel b/compiler/src/iree/compiler/Tools/BUILD.bazel index bfd07e9c7181..a3294fd66c7c 100644 --- a/compiler/src/iree/compiler/Tools/BUILD.bazel +++ b/compiler/src/iree/compiler/Tools/BUILD.bazel @@ -43,7 +43,6 @@ iree_compiler_cc_library( "@llvm-project//mlir:ConversionPasses", "@llvm-project//mlir:IR", "@llvm-project//mlir:TosaDialect", - "@mlir-hlo//:lhlo", "@mlir-hlo//:mlir_hlo", "@mlir-hlo//stablehlo:chlo_ops", "@mlir-hlo//stablehlo:stablehlo_ops",