Adopt td_library

Following https://github.com/google/llvm-bazel/pull/156, this avoids
needing to list all transitive include dependencies and tracks include
directories.

PiperOrigin-RevId: 360952728
Change-Id: I415ee30f7880b34308bee052d9df031c84de12f3
This commit is contained in:
Geoffrey Martin-Noble 2021-03-04 10:44:46 -08:00 committed by TensorFlower Gardener
parent 3702573c45
commit a275a1467f
3 changed files with 388 additions and 320 deletions

663
third_party/mlir/BUILD vendored

File diff suppressed because it is too large Load Diff

View File

@ -321,6 +321,13 @@ def gentbl(
test: whether to create a shell test that invokes the tool too.
**kwargs: Extra keyword arguments to pass to all generated rules.
"""
# TODO(gcmn): Update callers to td_library and explicit includes and
# drop this hardcoded include.
hardcoded_includes = [
"external/llvm-project/mlir/include",
]
for (opts_string, out) in tbl_outs:
# TODO(gcmn): The API of opts as single string is preserved for backward
# compatibility. Change to taking a sequence.
@ -343,11 +350,7 @@ def gentbl(
td_srcs = td_srcs,
deps = deps,
includes = includes + td_relative_includes,
# TODO(gcmn): Update callers to td_library and explicit includes and
# drop this hardcoded include.
td_includes = td_includes + [
"external/llvm-project/mlir/include",
],
td_includes = td_includes + hardcoded_includes,
out = out,
**kwargs
)
@ -363,11 +366,7 @@ def gentbl(
td_srcs = td_srcs,
deps = deps,
includes = includes + td_relative_includes,
# TODO(gcmn): Update callers to td_library and explicit includes
# and drop this hardcoded include.
td_includes = td_includes + [
"external/llvm-project/mlir/include",
],
td_includes = td_includes + hardcoded_includes,
# Shell files not executable on Windows.
# TODO(gcmn): Support windows.
tags = ["no_windows"],

View File

@ -1,4 +1,4 @@
load("@org_tensorflow//third_party/mlir:tblgen.bzl", "gentbl")
load("@org_tensorflow//third_party/mlir:tblgen.bzl", "gentbl", "td_library")
package(
default_visibility = [":test_friends"],
@ -32,13 +32,11 @@ cc_library(
],
)
filegroup(
td_library(
name = "TestOpTdFiles",
srcs = [
"lib/Dialect/Test/TestInterfaces.td",
"lib/Dialect/Test/TestOps.td",
"@llvm-project//mlir:OpBaseTdFiles",
"@llvm-project//mlir:SideEffectTdFiles",
"@llvm-project//mlir:include/mlir/IR/OpAsmInterface.td",
"@llvm-project//mlir:include/mlir/IR/RegionKindInterface.td",
"@llvm-project//mlir:include/mlir/IR/SymbolInterfaces.td",
@ -47,6 +45,10 @@ filegroup(
"@llvm-project//mlir:include/mlir/Interfaces/CopyOpInterface.td",
"@llvm-project//mlir:include/mlir/Interfaces/InferTypeOpInterface.td",
],
deps = [
"@llvm-project//mlir:OpBaseTdFiles",
"@llvm-project//mlir:SideEffectTdFiles",
],
)
gentbl(
@ -88,10 +90,10 @@ gentbl(
],
tblgen = "@llvm-project//mlir:mlir-tblgen",
td_file = "lib/Dialect/Test/TestOps.td",
td_srcs = [
test = True,
deps = [
":TestOpTdFiles",
],
test = True,
)
gentbl(
@ -117,11 +119,11 @@ gentbl(
],
tblgen = "@llvm-project//mlir:mlir-tblgen",
td_file = "lib/Dialect/Test/TestInterfaces.td",
td_srcs = [
"@llvm-project//mlir:OpBaseTdFiles",
"@llvm-project//mlir:SideEffectBaseTdFiles",
],
test = True,
deps = [
"@llvm-project//mlir:OpBaseTdFiles",
"@llvm-project//mlir:SideEffectInterfacesTdFiles",
],
)
gentbl(
@ -160,10 +162,10 @@ gentbl(
],
tblgen = "@llvm-project//mlir:mlir-tblgen",
td_file = "lib/Dialect/Test/TestTypeDefs.td",
td_srcs = [
test = True,
deps = [
":TestOpTdFiles",
],
test = True,
)
cc_library(