[llvm] [mlir][bazel] Create a separate target for BytecodeOpInterface. (PR #86655)
Christian Sigg via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 26 04:55:30 PDT 2024
https://github.com/chsigg created https://github.com/llvm/llvm-project/pull/86655
This reduces the number of headers that need to be included in multiple targets.
>From b8966c7e284b5451dcd820e08582ceb08010a8c9 Mon Sep 17 00:00:00 2001
From: Christian Sigg <csigg at google.com>
Date: Tue, 26 Mar 2024 12:49:39 +0100
Subject: [PATCH] [mlir][bazel] Create a separate target for
BytecodeOpInterface.
This reduces the number of headers that need to be included in multiple targets.
---
.../llvm-project-overlay/mlir/BUILD.bazel | 45 ++++++++++++++-----
.../mlir/test/BUILD.bazel | 3 ++
2 files changed, 38 insertions(+), 10 deletions(-)
diff --git a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
index 1d9260e022c506..5dcaf0265c9265 100644
--- a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
@@ -326,16 +326,15 @@ cc_library(
"lib/IR/*.h",
"lib/IR/PDL/*.cpp",
"lib/Bytecode/Writer/*.h",
+ "include/mlir/Bytecode/*.h",
]) + [
"include/mlir/IR/PDLPatternMatch.h.inc",
"include/mlir/Interfaces/CallInterfaces.h",
"include/mlir/Interfaces/DataLayoutInterfaces.h",
"include/mlir/Interfaces/SideEffectInterfaces.h",
- "lib/Bytecode/BytecodeOpInterface.cpp",
],
hdrs = glob([
"include/mlir/IR/*.h",
- "include/mlir/Bytecode/*.h",
]) + [
"include/mlir/Interfaces/FoldInterfaces.h",
],
@@ -3123,6 +3122,7 @@ cc_library(
deps = [
":ArithDialect",
":BufferizationInterfaces",
+ ":BytecodeOpInterface",
":DialectUtils",
":IR",
":InferTypeOpInterface",
@@ -3755,6 +3755,7 @@ cc_library(
hdrs = ["include/mlir/Dialect/XeGPU/IR/XeGPU.h"],
includes = ["include"],
deps = [
+ ":BytecodeOpInterface",
":DialectUtils",
":IR",
":ShapedOpInterfaces",
@@ -4700,6 +4701,7 @@ cc_library(
deps = [
":ArithDialect",
":BufferizationInterfaces",
+ ":BytecodeOpInterface",
":CommonFolders",
":ControlFlowInterfaces",
":ControlFlowOpsIncGen",
@@ -5222,13 +5224,11 @@ cc_library(
srcs = glob([
"lib/Bytecode/Reader/*.cpp",
]),
- hdrs = glob([
- "include/mlir/Bytecode/*.h",
- ]),
+ hdrs = ["include/mlir/Bytecode/BytecodeReader.h"],
includes = ["include"],
deps = [
":AsmParser",
- ":BytecodeOpInterfaceIncGen",
+ ":BytecodeOpInterface",
":IR",
":Support",
"//llvm:Support",
@@ -5241,12 +5241,10 @@ cc_library(
"lib/Bytecode/Writer/*.cpp",
"lib/Bytecode/Writer/*.h",
]),
- hdrs = glob([
- "include/mlir/Bytecode/*.h",
- ]),
+ hdrs = ["include/mlir/Bytecode/BytecodeWriter.h"],
includes = ["include"],
deps = [
- ":BytecodeOpInterfaceIncGen",
+ ":BytecodeOpInterface",
":IR",
":Support",
"//llvm:Support",
@@ -6608,6 +6606,7 @@ cc_library(
]),
includes = ["include"],
deps = [
+ ":BytecodeOpInterface",
":IR",
":InferTypeOpInterface",
":PDLOpsIncGen",
@@ -7308,6 +7307,7 @@ cc_library(
":ArithDialect",
":ArithUtils",
":BufferizationInterfaces",
+ ":BytecodeOpInterface",
":CastInterfaces",
":ComplexDialect",
":ControlFlowInterfaces",
@@ -8436,6 +8436,23 @@ gentbl_cc_library(
deps = [":BytecodeOpInterfaceTdFiles"],
)
+cc_library(
+ name = "BytecodeOpInterface",
+ srcs = ["lib/Bytecode/BytecodeOpInterface.cpp"],
+ hdrs = [
+ "include/mlir/Bytecode/BytecodeImplementation.h",
+ "include/mlir/Bytecode/BytecodeOpInterface.h",
+ "include/mlir/Bytecode/Encoding.h",
+ ],
+ includes = ["include"],
+ deps = [
+ ":BytecodeOpInterfaceIncGen",
+ ":IR",
+ ":Support",
+ "//llvm:Support",
+ ],
+)
+
gentbl_cc_library(
name = "CallOpInterfacesIncGen",
tbl_outs = [
@@ -10386,6 +10403,7 @@ cc_library(
includes = ["include"],
deps = [
":ArithDialect",
+ ":BytecodeOpInterface",
":FuncDialect",
":IR",
":InferTypeOpInterface",
@@ -10970,6 +10988,7 @@ cc_library(
":AsmParser",
":BufferizationDialect",
":BufferizationInterfaces",
+ ":BytecodeOpInterface",
":ComplexDialect",
":ControlFlowInterfaces",
":CopyOpInterface",
@@ -12356,6 +12375,7 @@ cc_library(
includes = ["include"],
deps = [
":ArithDialect",
+ ":BytecodeOpInterface",
":ComplexAttributesIncGen",
":ComplexBaseIncGen",
":ComplexOpsIncGen",
@@ -12621,6 +12641,7 @@ cc_library(
":ArithOpsIncGen",
":ArithOpsInterfacesIncGen",
":BufferizationInterfaces",
+ ":BytecodeOpInterface",
":CallOpInterfaces",
":CastInterfaces",
":CommonFolders",
@@ -12791,6 +12812,7 @@ cc_library(
includes = ["include"],
deps = [
":ArithDialect",
+ ":BytecodeOpInterface",
":CommonFolders",
":ConvertToLLVMInterface",
":IR",
@@ -12935,6 +12957,7 @@ cc_library(
":ArithDialect",
":ArithUtils",
":BufferizationInterfaces",
+ ":BytecodeOpInterface",
":CallOpInterfaces",
":CastInterfaces",
":ComplexDialect",
@@ -13199,6 +13222,7 @@ cc_library(
hdrs = glob(["include/mlir/Dialect/MLProgram/IR/*.h"]),
includes = ["include"],
deps = [
+ ":BytecodeOpInterface",
":CallOpInterfaces",
":ControlFlowInterfaces",
":FunctionInterfaces",
@@ -13595,6 +13619,7 @@ cc_library(
":BufferizationBaseIncGen",
":BufferizationInterfaces",
":BufferizationOpsIncGen",
+ ":BytecodeOpInterface",
":CallOpInterfaces",
":ControlFlowInterfaces",
":CopyOpInterface",
diff --git a/utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel
index 57b29eb46e0840..821b0446f64d3b 100644
--- a/utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel
@@ -358,6 +358,7 @@ cc_library(
deps = [
":TestTransformDialectExtensionIncGen",
"//llvm:Support",
+ "//mlir:BytecodeOpInterface",
"//mlir:IR",
"//mlir:PDLDialect",
"//mlir:Pass",
@@ -388,6 +389,7 @@ cc_library(
":TestTypeDefsIncGen",
"//llvm:Support",
"//mlir:ArithDialect",
+ "//mlir:BytecodeOpInterface",
"//mlir:CallOpInterfaces",
"//mlir:ControlFlowInterfaces",
"//mlir:CopyOpInterface",
@@ -439,6 +441,7 @@ cc_library(
"//llvm:Support",
"//mlir:Analysis",
"//mlir:ArithDialect",
+ "//mlir:BytecodeOpInterface",
"//mlir:BytecodeReader",
"//mlir:BytecodeWriter",
"//mlir:FuncDialect",
More information about the llvm-commits
mailing list