Skip to content

Commit a5e6ccf

Browse files
authored
[mlir][bazel] Port 517800e (#127544)
Introduces a `LinalgInterfaces` target so that `TensorDialect` doesn't need to depend on `LinalgDialect`, which would introduce a circular dependency.
1 parent d09cce1 commit a5e6ccf

File tree

4 files changed

+67
-25
lines changed

4 files changed

+67
-25
lines changed

mlir/lib/Dialect/Linalg/IR/LinalgInterfaces.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
#include "mlir/Dialect/Arith/Utils/Utils.h"
1414
#include "mlir/Dialect/Complex/IR/Complex.h"
1515
#include "mlir/Dialect/Linalg/IR/Linalg.h"
16-
#include "mlir/Dialect/MemRef/IR/MemRef.h"
17-
#include "mlir/Dialect/Tensor/IR/Tensor.h"
1816
#include "mlir/IR/AffineExpr.h"
1917
#include "mlir/IR/AffineExprVisitor.h"
2018
#include "mlir/IR/AffineMap.h"

mlir/lib/Dialect/Tensor/IR/TensorOps.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include "mlir/Dialect/Arith/IR/Arith.h"
1111
#include "mlir/Dialect/Arith/Utils/Utils.h"
1212
#include "mlir/Dialect/Complex/IR/Complex.h"
13-
#include "mlir/Dialect/Linalg/IR/Linalg.h"
13+
#include "mlir/Dialect/Linalg/IR/LinalgInterfaces.h"
1414
#include "mlir/Dialect/Tensor/IR/Tensor.h"
1515
#include "mlir/Dialect/Tensor/Utils/Utils.h"
1616
#include "mlir/Dialect/Utils/IndexingUtils.h"

utils/bazel/llvm-project-overlay/mlir/BUILD.bazel

Lines changed: 65 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7763,7 +7763,6 @@ td_library(
77637763
name = "TensorOpsTdFiles",
77647764
srcs = [
77657765
"include/mlir/Dialect/Tensor/IR/TensorBase.td",
7766-
"include/mlir/Dialect/Tensor/IR/TensorInterfaces.td",
77677766
"include/mlir/Dialect/Tensor/IR/TensorOps.td",
77687767
],
77697768
includes = ["include"],
@@ -7813,23 +7812,6 @@ gentbl_cc_library(
78137812
deps = [":TensorOpsTdFiles"],
78147813
)
78157814

7816-
gentbl_cc_library(
7817-
name = "TensorInterfacesIncGen",
7818-
tbl_outs = [
7819-
(
7820-
["--gen-op-interface-decls"],
7821-
"include/mlir/Dialect/Tensor/IR/TensorInterfaces.h.inc",
7822-
),
7823-
(
7824-
["--gen-op-interface-defs"],
7825-
"include/mlir/Dialect/Tensor/IR/TensorInterfaces.cpp.inc",
7826-
),
7827-
],
7828-
tblgen = ":mlir-tblgen",
7829-
td_file = "include/mlir/Dialect/Tensor/IR/TensorInterfaces.td",
7830-
deps = [":TensorOpsTdFiles"],
7831-
)
7832-
78337815
cc_library(
78347816
name = "TensorDialect",
78357817
srcs = [
@@ -7859,13 +7841,13 @@ cc_library(
78597841
":InferIntRangeInterface",
78607842
":InferTypeOpInterface",
78617843
":InliningUtils",
7844+
":LinalgInterfaces",
78627845
":LoopLikeInterface",
78637846
":ParallelCombiningOpInterface",
78647847
":ShapedOpInterfaces",
78657848
":SideEffectInterfaces",
78667849
":SubsetOpInterface",
78677850
":Support",
7868-
":TensorInterfacesIncGen",
78697851
":TensorOpsIncGen",
78707852
":TilingInterface",
78717853
":TransformDialectInterfaces",
@@ -11206,6 +11188,23 @@ gentbl_cc_library(
1120611188
deps = [":LinalgOpsTdFiles"],
1120711189
)
1120811190

11191+
gentbl_cc_library(
11192+
name = "LinalgRelayoutOpsIncGen",
11193+
tbl_outs = [
11194+
(
11195+
["-gen-op-decls"],
11196+
"include/mlir/Dialect/Linalg/IR/LinalgRelayoutOps.h.inc",
11197+
),
11198+
(
11199+
["-gen-op-defs"],
11200+
"include/mlir/Dialect/Linalg/IR/LinalgRelayoutOps.cpp.inc",
11201+
),
11202+
],
11203+
tblgen = ":mlir-tblgen",
11204+
td_file = "include/mlir/Dialect/Linalg/IR/LinalgRelayoutOps.td",
11205+
deps = [":LinalgOpsTdFiles"],
11206+
)
11207+
1120911208
gentbl_cc_library(
1121011209
name = "LinalgEnumsIncGen",
1121111210
tbl_outs = [
@@ -11532,10 +11531,50 @@ cc_library(
1153211531
],
1153311532
)
1153411533

11534+
cc_library(
11535+
name = "LinalgInterfaces",
11536+
srcs = [
11537+
"include/mlir/Dialect/Linalg/IR/Linalg.h",
11538+
"lib/Dialect/Linalg/IR/LinalgInterfaces.cpp",
11539+
],
11540+
hdrs = ["include/mlir/Dialect/Linalg/IR/LinalgInterfaces.h"],
11541+
includes = ["include"],
11542+
deps = [
11543+
":AffineDialect",
11544+
":ArithDialect",
11545+
":ArithUtils",
11546+
":BytecodeOpInterface",
11547+
":ComplexDialect",
11548+
":ControlFlowInterfaces",
11549+
":CopyOpInterface",
11550+
":DestinationStyleOpInterface",
11551+
":DialectUtils",
11552+
":IR",
11553+
":InferTypeOpInterface",
11554+
":LinalgEnumsIncGen",
11555+
":LinalgInterfacesIncGen",
11556+
":LinalgOpsIncGen",
11557+
":LinalgRelayoutOpsIncGen",
11558+
":LinalgStructuredOpsIncGen",
11559+
":SideEffectInterfaces",
11560+
":Support",
11561+
":TilingInterface",
11562+
":ViewLikeInterface",
11563+
"//third_party/llvm/llvm-project/llvm:Support",
11564+
],
11565+
)
11566+
1153511567
cc_library(
1153611568
name = "LinalgDialect",
11537-
srcs = glob(["lib/Dialect/Linalg/IR/*.cpp"]),
11538-
hdrs = glob(["include/mlir/Dialect/Linalg/IR/*.h"]),
11569+
srcs = [
11570+
"lib/Dialect/Linalg/IR/LinalgDialect.cpp",
11571+
"lib/Dialect/Linalg/IR/LinalgOps.cpp",
11572+
"lib/Dialect/Linalg/IR/ValueBoundsOpInterfaceImpl.cpp",
11573+
],
11574+
hdrs = [
11575+
"include/mlir/Dialect/Linalg/IR/Linalg.h",
11576+
"include/mlir/Dialect/Linalg/IR/ValueBoundsOpInterfaceImpl.h",
11577+
],
1153911578
includes = ["include"],
1154011579
deps = [
1154111580
":AffineDialect",
@@ -11554,9 +11593,10 @@ cc_library(
1155411593
":InferTypeOpInterface",
1155511594
":InliningUtils",
1155611595
":LinalgEnumsIncGen",
11557-
":LinalgInterfacesIncGen",
11596+
":LinalgInterfaces",
1155811597
":LinalgNamedStructuredOpsYamlIncGen",
1155911598
":LinalgOpsIncGen",
11599+
":LinalgRelayoutOpsIncGen",
1156011600
":LinalgStructuredOpsIncGen",
1156111601
":MathDialect",
1156211602
":MemRefDialect",
@@ -11568,6 +11608,7 @@ cc_library(
1156811608
":SubsetOpInterface",
1156911609
":Support",
1157011610
":TensorDialect",
11611+
":TensorUtils",
1157111612
":TilingInterface",
1157211613
":ValueBoundsOpInterface",
1157311614
":ViewLikeInterface",
@@ -11599,6 +11640,7 @@ cc_library(
1159911640
":IR",
1160011641
":IndexDialect",
1160111642
":LinalgDialect",
11643+
":LinalgInterfaces",
1160211644
":LinalgMatchOpsIncGen",
1160311645
":LinalgTransformEnumsIncGen",
1160411646
":LinalgTransformOpsIncGen",
@@ -11710,6 +11752,7 @@ cc_library(
1171011752
":IR",
1171111753
":IndexDialect",
1171211754
":LinalgDialect",
11755+
":LinalgInterfaces",
1171311756
":LinalgPassIncGen",
1171411757
":LinalgStructuredOpsIncGen",
1171511758
":LinalgUtils",

utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ cc_library(
425425
"//mlir:LLVMDialect",
426426
"//mlir:LLVMIRToLLVMTranslation",
427427
"//mlir:LinalgDialect",
428+
"//mlir:LinalgInterfaces",
428429
"//mlir:LoopLikeInterface",
429430
"//mlir:MemorySlotInterfaces",
430431
"//mlir:Pass",

0 commit comments

Comments
 (0)