Skip to content

Commit 36b3606

Browse files
authored
[mlir][spirv] Fix cyclical dependency in bazel (#132785)
1 parent a29b0d7 commit 36b3606

File tree

3 files changed

+47
-28
lines changed

3 files changed

+47
-28
lines changed

mlir/include/mlir/Dialect/SPIRV/Interfaces/SPIRVImageInterfaces.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#ifndef MLIR_DIALECT_SPIRV_IMAGE_INTERFACES
1414
#define MLIR_DIALECT_SPIRV_IMAGE_INTERFACES
1515

16-
include "mlir/Dialect/SPIRV/IR/SPIRVBase.td"
16+
include "mlir/IR/OpBase.td"
1717

1818
// -----
1919

mlir/lib/Dialect/SPIRV/Interfaces/SPIRVImageInterfaces.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
9+
#include "mlir/IR/OpDefinition.h"
10+
11+
#include "mlir/Dialect/SPIRV/Interfaces/SPIRVImageInterfaces.h"
1012

1113
using namespace mlir;
1214

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

Lines changed: 43 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6486,6 +6486,7 @@ cc_library(
64866486
":Pass",
64876487
":SPIRVCommonAttrToLLVMConversion",
64886488
":SPIRVDialect",
6489+
":SPIRVImageInterfaces",
64896490
":SPIRVUtils",
64906491
":Support",
64916492
":TransformUtils",
@@ -7389,14 +7390,16 @@ cc_library(
73897390
],
73907391
)
73917392

7393+
td_library(
7394+
name = "SPIRVImageInterfacesTdFiles",
7395+
srcs = ["include/mlir/Dialect/SPIRV/Interfaces/SPIRVImageInterfaces.td"],
7396+
includes = ["include"],
7397+
deps = [":OpBaseTdFiles"],
7398+
)
7399+
73927400
td_library(
73937401
name = "SPIRVOpsTdFiles",
7394-
srcs = glob(["include/mlir/Dialect/SPIRV/IR/*.td"]) + [
7395-
# TODO: resolve circular dep, e.g.
7396-
# * SPIRVImageInterfaces.td uses SPIRVBase.td
7397-
# * SPIRVOps.h uses SPIRVImageInterfaces.h
7398-
"include/mlir/Dialect/SPIRV/Interfaces/SPIRVImageInterfaces.td",
7399-
],
7402+
srcs = glob(["include/mlir/Dialect/SPIRV/IR/*.td"]),
74007403
includes = ["include"],
74017404
deps = [
74027405
":BuiltinDialectTdFiles",
@@ -7405,10 +7408,43 @@ td_library(
74057408
":FunctionInterfacesTdFiles",
74067409
":InferTypeOpInterfaceTdFiles",
74077410
":OpBaseTdFiles",
7411+
":SPIRVImageInterfacesTdFiles",
74087412
":SideEffectInterfacesTdFiles",
74097413
],
74107414
)
74117415

7416+
gentbl_cc_library(
7417+
name = "SPIRVImageInterfacesIncGen",
7418+
tbl_outs = [
7419+
(
7420+
["-gen-op-interface-decls"],
7421+
"include/mlir/Dialect/SPIRV/Interfaces/SPIRVImageInterfaces.h.inc",
7422+
),
7423+
(
7424+
["-gen-op-interface-defs"],
7425+
"include/mlir/Dialect/SPIRV/Interfaces/SPIRVImageInterfaces.cpp.inc",
7426+
),
7427+
],
7428+
tblgen = ":mlir-tblgen",
7429+
td_file = "include/mlir/Dialect/SPIRV/Interfaces/SPIRVImageInterfaces.td",
7430+
deps = [
7431+
":SPIRVImageInterfacesTdFiles",
7432+
":SPIRVOpsTdFiles",
7433+
],
7434+
)
7435+
7436+
cc_library(
7437+
name = "SPIRVImageInterfaces",
7438+
srcs = ["lib/Dialect/SPIRV/Interfaces/SPIRVImageInterfaces.cpp"],
7439+
hdrs = ["include/mlir/Dialect/SPIRV/Interfaces/SPIRVImageInterfaces.h"],
7440+
includes = ["include"],
7441+
deps = [
7442+
":IR",
7443+
":SPIRVImageInterfacesIncGen",
7444+
"//llvm:Support",
7445+
],
7446+
)
7447+
74127448
gentbl_cc_library(
74137449
name = "SPIRVOpsIncGen",
74147450
tbl_outs = [
@@ -7536,33 +7572,14 @@ gentbl_cc_library(
75367572
deps = [":SPIRVOpsTdFiles"],
75377573
)
75387574

7539-
gentbl_cc_library(
7540-
name = "SPIRVImageInterfacesIncGen",
7541-
tbl_outs = [
7542-
(
7543-
["-gen-op-interface-decls"],
7544-
"include/mlir/Dialect/SPIRV/Interfaces/SPIRVImageInterfaces.h.inc",
7545-
),
7546-
(
7547-
["-gen-op-interface-defs"],
7548-
"include/mlir/Dialect/SPIRV/Interfaces/SPIRVImageInterfaces.cpp.inc",
7549-
),
7550-
],
7551-
tblgen = ":mlir-tblgen",
7552-
td_file = "include/mlir/Dialect/SPIRV/Interfaces/SPIRVImageInterfaces.td",
7553-
deps = [":SPIRVOpsTdFiles"],
7554-
)
7555-
75567575
cc_library(
75577576
name = "SPIRVDialect",
75587577
srcs = glob([
75597578
"lib/Dialect/SPIRV/IR/*.cpp",
75607579
"lib/Dialect/SPIRV/IR/*.h",
7561-
"lib/Dialect/SPIRV/Interfaces/*.cpp",
75627580
]),
75637581
hdrs = glob([
75647582
"include/mlir/Dialect/SPIRV/IR/*.h",
7565-
"include/mlir/Dialect/SPIRV/Interfaces/*.h",
75667583
]),
75677584
includes = ["include"],
75687585
deps = [
@@ -7580,7 +7597,7 @@ cc_library(
75807597
":SPIRVAttributesIncGen",
75817598
":SPIRVAvailabilityIncGen",
75827599
":SPIRVCanonicalizationIncGen",
7583-
":SPIRVImageInterfacesIncGen",
7600+
":SPIRVImageInterfaces",
75847601
":SPIRVOpsIncGen",
75857602
":SideEffectInterfaces",
75867603
":Support",

0 commit comments

Comments
 (0)