[llvm] [mlir][bazel] Move InliningUtils into a separate target. (PR #85411)
Christian Sigg via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 15 08:11:04 PDT 2024
https://github.com/chsigg created https://github.com/llvm/llvm-project/pull/85411
Various (in-tree as well as downstream) targets currently depend on `InliningUtils.h`, because they themselves depend on `TransformUtils`. This change exposes that header and it's implementation as a separate target. Having targets that implement all the declared functions is the preferred approach for bazel build graphs.
See also PR #84878, which moves the interface definitions to a separate file in the `Interfaces` directory. This turned out to be controversial and putting it in a different directory didn't seem to have any support either. Instead, this PR only changes the bazel build without moving any C++ code.
>From 8c8b320be6389002ceef578aee872039fb9c5f56 Mon Sep 17 00:00:00 2001
From: Christian Sigg <csigg at google.com>
Date: Fri, 15 Mar 2024 15:51:26 +0100
Subject: [PATCH] [mlir][bazel] Move InliningUtils into a separate target.
---
.../llvm-project-overlay/mlir/BUILD.bazel | 58 ++++++++++++++-----
.../mlir/test/BUILD.bazel | 24 ++++----
2 files changed, 56 insertions(+), 26 deletions(-)
diff --git a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
index a3243abde5bbc5..d1210d0531837c 100644
--- a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
@@ -3889,6 +3889,7 @@ cc_library(
":ControlFlowInterfaces",
":DialectUtils",
":IR",
+ ":InliningUtils",
":LoopLikeInterface",
":MemRefDialect",
":ShapedOpInterfaces",
@@ -4296,6 +4297,7 @@ cc_library(
":FunctionInterfaces",
":IR",
":InferTypeOpInterface",
+ ":InliningUtils",
":LoopLikeInterface",
":MemRefDialect",
":ParallelCombiningOpInterface",
@@ -4366,6 +4368,17 @@ cc_library(
],
)
+cc_library(
+ name = "InliningUtils",
+ srcs = ["lib/Transforms/Utils/InliningUtils.cpp"],
+ hdrs = ["include/mlir/Transforms/InliningUtils.h"],
+ includes = ["include"],
+ deps = [
+ ":IR",
+ "//llvm:Support",
+ ],
+)
+
cc_library(
name = "LoopLikeInterface",
srcs = ["lib/Interfaces/LoopLikeInterface.cpp"],
@@ -4543,6 +4556,7 @@ cc_library(
":FunctionInterfaces",
":IR",
":InferTypeOpInterface",
+ ":InliningUtils",
":MLIRShapeCanonicalizationIncGen",
":ShapeOpsIncGen",
":SideEffectInterfaces",
@@ -4706,6 +4720,7 @@ cc_library(
":ControlFlowOpsIncGen",
":ConvertToLLVMInterface",
":IR",
+ ":InliningUtils",
":SideEffectInterfaces",
":Support",
"//llvm:Support",
@@ -4742,7 +4757,7 @@ cc_library(
hdrs = glob([
"include/mlir/Dialect/Func/IR/*.h",
"include/mlir/Dialect/Func/Utils/*.h",
- ]) + ["include/mlir/Transforms/InliningUtils.h"],
+ ]),
includes = ["include"],
deps = [
":ArithDialect",
@@ -4756,6 +4771,7 @@ cc_library(
":FunctionInterfaces",
":IR",
":InferTypeOpInterface",
+ ":InliningUtils",
":SideEffectInterfaces",
":Support",
"//llvm:Support",
@@ -4772,6 +4788,7 @@ cc_library(
":FuncDialect",
":IR",
":InferTypeOpInterface",
+ ":InliningUtils",
":MeshShardingInterface",
],
)
@@ -4928,6 +4945,7 @@ cc_library(
":DialectUtils",
":IR",
":InferTypeOpInterface",
+ ":InliningUtils",
":MaskableOpInterface",
":MaskingOpInterface",
":MemRefDialect",
@@ -5336,7 +5354,6 @@ cc_library(
"include/mlir/Dialect/LLVMIR/*X86Vector*.h",
],
) + [
- "include/mlir/Transforms/InliningUtils.h",
"include/mlir/Transforms/Mem2Reg.h",
],
includes = ["include"],
@@ -5347,6 +5364,7 @@ cc_library(
":FunctionInterfaces",
":IR",
":InferTypeOpInterface",
+ ":InliningUtils",
":LLVMDialectInterfaceIncGen",
":LLVMIntrinsicOpsIncGen",
":LLVMOpsIncGen",
@@ -5553,6 +5571,7 @@ cc_library(
":IR",
":InferIntRangeInterface",
":InferTypeOpInterface",
+ ":InliningUtils",
":LLVMDialect",
":MemRefDialect",
":SCFDialect",
@@ -6887,7 +6906,7 @@ cc_library(
srcs = glob([
"lib/Dialect/SPIRV/IR/*.cpp",
"lib/Dialect/SPIRV/IR/*.h",
- ]) + ["include/mlir/Transforms/InliningUtils.h"],
+ ]),
hdrs = glob([
"include/mlir/Dialect/SPIRV/IR/*.h",
]),
@@ -6899,6 +6918,7 @@ cc_library(
":GPUDialect",
":IR",
":InferTypeOpInterface",
+ ":InliningUtils",
":Parser",
":SPIRVAttrUtilsGen",
":SPIRVAttributesIncGen",
@@ -7303,7 +7323,6 @@ gentbl_cc_library(
cc_library(
name = "TensorDialect",
srcs = [
- "include/mlir/Transforms/InliningUtils.h",
"lib/Dialect/Tensor/IR/TensorDialect.cpp",
"lib/Dialect/Tensor/IR/TensorOps.cpp",
"lib/Dialect/Tensor/IR/ValueBoundsOpInterfaceImpl.cpp",
@@ -7324,6 +7343,7 @@ cc_library(
":DialectUtils",
":IR",
":InferTypeOpInterface",
+ ":InliningUtils",
":LoopLikeInterface",
":ParallelCombiningOpInterface",
":ShapedOpInterfaces",
@@ -7514,15 +7534,19 @@ cc_library(
cc_library(
name = "TransformUtils",
- srcs = glob([
- "lib/Transforms/Utils/*.cpp",
- "lib/Transforms/Utils/*.h",
- ]),
+ srcs = glob(
+ include = [
+ "lib/Transforms/Utils/*.cpp",
+ "lib/Transforms/Utils/*.h",
+ ],
+ exclude = ["lib/Transforms/Utils/InliningUtils.cpp"],
+ ),
hdrs = glob(
- [
- "include/mlir/Transforms/*.h",
+ include = ["include/mlir/Transforms/*.h"],
+ exclude = [
+ "include/mlir/Transforms/InliningUtils.h",
+ "include/mlir/Transforms/Passes.h",
],
- exclude = ["include/mlir/Transforms/Passes.h"],
),
includes = ["include"],
deps = [
@@ -7530,6 +7554,7 @@ cc_library(
":ControlFlowInterfaces",
":FunctionInterfaces",
":IR",
+ ":InliningUtils",
":LoopLikeInterface",
":MemorySlotInterfaces",
":Pass",
@@ -7859,6 +7884,7 @@ cc_library(
":ControlFlowInterfaces",
":FunctionInterfaces",
":IR",
+ ":InliningUtils",
":LoopLikeInterface",
":MemorySlotInterfaces",
":Pass",
@@ -10955,6 +10981,7 @@ cc_library(
":FunctionInterfaces",
":IR",
":InferTypeOpInterface",
+ ":InliningUtils",
":LinalgEnumsIncGen",
":LinalgInterfacesIncGen",
":LinalgNamedStructuredOpsYamlIncGen",
@@ -11701,6 +11728,7 @@ cc_library(
":FuncDialect",
":IR",
":InferTypeOpInterface",
+ ":InliningUtils",
":LoopLikeInterface",
":MeshDialect",
":MeshShardingInterface",
@@ -12315,6 +12343,7 @@ cc_library(
":ConvertToLLVMInterface",
":IR",
":InferTypeOpInterface",
+ ":InliningUtils",
":SideEffectInterfaces",
"//llvm:Support",
],
@@ -12566,7 +12595,6 @@ cc_library(
],
hdrs = [
"include/mlir/Dialect/Arith/IR/Arith.h",
- "include/mlir/Transforms/InliningUtils.h",
],
includes = ["include"],
deps = [
@@ -12581,6 +12609,7 @@ cc_library(
":InferIntRangeCommon",
":InferIntRangeInterface",
":InferTypeOpInterface",
+ ":InliningUtils",
":Support",
":UBDialect",
":VectorInterfaces",
@@ -12742,6 +12771,7 @@ cc_library(
":ConvertToLLVMInterface",
":IR",
":InferTypeOpInterface",
+ ":InliningUtils",
":MathBaseIncGen",
":MathOpsIncGen",
":SideEffectInterfaces",
@@ -12890,6 +12920,7 @@ cc_library(
":DialectUtils",
":IR",
":InferTypeOpInterface",
+ ":InliningUtils",
":MemRefBaseIncGen",
":MemRefOpsIncGen",
":MemorySlotInterfaces",
@@ -13513,6 +13544,7 @@ cc_library(
":FunctionInterfaces",
":IR",
":InferTypeOpInterface",
+ ":InliningUtils",
":MemRefDialect",
":SparseTensorDialect",
":SubsetOpInterface",
@@ -13910,7 +13942,6 @@ gentbl_cc_library(
cc_library(
name = "UBDialect",
srcs = [
- "include/mlir/Transforms/InliningUtils.h",
"lib/Dialect/UB/IR/UBOps.cpp",
],
hdrs = ["include/mlir/Dialect/UB/IR/UBOps.h"],
@@ -13918,6 +13949,7 @@ cc_library(
deps = [
":ConvertToLLVMInterface",
":IR",
+ ":InliningUtils",
":SideEffectInterfaces",
":UBOpsIncGen",
":UBOpsInterfacesIncGen",
diff --git a/utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel
index 91706af935ac5e..ccfef3f243409d 100644
--- a/utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel
@@ -399,6 +399,7 @@ cc_library(
"//mlir:IR",
"//mlir:InferIntRangeInterface",
"//mlir:InferTypeOpInterface",
+ "//mlir:InliningUtils",
"//mlir:LLVMDialect",
"//mlir:LinalgDialect",
"//mlir:LoopLikeInterface",
@@ -407,7 +408,6 @@ cc_library(
"//mlir:SideEffectInterfaces",
"//mlir:Support",
"//mlir:TensorDialect",
- "//mlir:TransformUtils",
"//mlir:Transforms",
"//mlir:ViewLikeInterface",
],
@@ -532,7 +532,7 @@ cc_library(
"//mlir:PDLInterpDialect",
"//mlir:Pass",
"//mlir:Support",
- "//mlir:TransformUtils",
+ "//mlir:Transforms",
],
)
@@ -570,7 +570,7 @@ cc_library(
"//mlir:SCFDialect",
"//mlir:SPIRVDialect",
"//mlir:Support",
- "//mlir:TransformUtils",
+ "//mlir:Transforms",
],
)
@@ -600,7 +600,7 @@ cc_library(
"//mlir:Pass",
"//mlir:SCFDialect",
"//mlir:SCFTransforms",
- "//mlir:TransformUtils",
+ "//mlir:Transforms",
],
)
@@ -695,7 +695,6 @@ cc_library(
"//mlir:SCFToControlFlow",
"//mlir:SPIRVDialect",
"//mlir:ToLLVMIRTranslation",
- "//mlir:TransformUtils",
"//mlir:Transforms",
"//mlir:VectorDialect",
"//mlir:VectorToLLVM",
@@ -728,7 +727,6 @@ cc_library(
"//mlir:SCFTransforms",
"//mlir:TensorDialect",
"//mlir:TensorTransforms",
- "//mlir:TransformUtils",
"//mlir:Transforms",
"//mlir:VectorDialect",
"//mlir:VectorToSCF",
@@ -770,7 +768,7 @@ cc_library(
"//mlir:MathTransforms",
"//mlir:Pass",
"//mlir:SCFDialect",
- "//mlir:TransformUtils",
+ "//mlir:Transforms",
"//mlir:VectorDialect",
"//mlir:X86VectorDialect",
],
@@ -786,7 +784,7 @@ cc_library(
"//mlir:IR",
"//mlir:MathDialect",
"//mlir:Pass",
- "//mlir:TransformUtils",
+ "//mlir:Transforms",
"//mlir:VCIXDialect",
"//mlir:VectorDialect",
],
@@ -850,7 +848,7 @@ cc_library(
"//mlir:Pass",
"//mlir:SCFDialect",
"//mlir:Support",
- "//mlir:TransformUtils",
+ "//mlir:Transforms",
],
)
@@ -869,7 +867,7 @@ cc_library(
"//mlir:SCFDialect",
"//mlir:SCFTransforms",
"//mlir:SCFUtils",
- "//mlir:TransformUtils",
+ "//mlir:Transforms",
],
)
@@ -994,7 +992,7 @@ cc_library(
"//mlir:FuncTransforms",
"//mlir:IR",
"//mlir:Pass",
- "//mlir:TransformUtils",
+ "//mlir:Transforms",
],
)
@@ -1033,7 +1031,7 @@ cc_library(
"//mlir:SCFDialect",
"//mlir:Support",
"//mlir:TensorDialect",
- "//mlir:TransformUtils",
+ "//mlir:Transforms",
"//mlir:VectorDialect",
"//mlir:VectorToSCF",
"//mlir:VectorTransforms",
@@ -1119,6 +1117,6 @@ cc_library(
"//mlir:Parser",
"//mlir:Pass",
"//mlir:Support",
- "//mlir:TransformUtils",
+ "//mlir:Transforms",
],
)
More information about the llvm-commits
mailing list