blob: 7083a45a7bda889d2b33f1aa8ccd99ee573dd07b [file] [log] [blame]
# MHLO -> TOSA bridge.
load("//tensorflow:tensorflow.bzl", "get_compatible_with_cloud")
load("@llvm-project//mlir:tblgen.bzl", "gentbl_cc_library")
package(
default_visibility = [
":internal",
"//tensorflow/compiler/xla/mlir_hlo/tosa:__subpackages__",
],
licenses = ["notice"],
)
package_group(
name = "internal",
packages = [],
)
gentbl_cc_library(
name = "MHLOTOSAPDLLPatternsIncGen",
tbl_outs = [
(
["-x=cpp"],
"include/mhlo_tosa/Transforms/legalize_mhlo.pdll.h.inc",
),
],
tblgen = "@llvm-project//mlir:mlir-pdll",
td_file = "lib/Transforms/legalize_mhlo.pdll",
deps = [
"//tensorflow/compiler/xla/mlir_hlo:hlo_ops_td_files",
"@llvm-project//mlir:OpBaseTdFiles",
"@llvm-project//mlir:TosaDialectTdFiles",
],
)
gentbl_cc_library(
name = "MHLOTOSATransformsPassIncGen",
compatible_with = get_compatible_with_cloud(),
strip_include_prefix = "include",
tbl_outs = [
(
[
"-gen-pass-decls",
"-name=MHLOTOSATransforms",
],
"include/mhlo_tosa/Transforms/passes.h.inc",
),
],
tblgen = "@llvm-project//mlir:mlir-tblgen",
td_file = "include/mhlo_tosa/Transforms/passes.td",
deps = [
"@llvm-project//mlir:PassBaseTdFiles",
],
)
cc_library(
name = "MHLOTOSATransforms",
srcs = [
"lib/Transforms/legalize_mhlo.cc",
],
hdrs = [
"include/mhlo_tosa/Transforms/passes.h",
],
includes = ["include"],
textual_hdrs = [
"lib/Transforms/passes_detail.h",
],
deps = [
":MHLOTOSAPDLLPatternsIncGen",
":MHLOTOSATransformsPassIncGen",
"@llvm-project//mlir:FuncDialect",
"@llvm-project//mlir:IR",
"@llvm-project//mlir:Parser",
"@llvm-project//mlir:Pass",
"@llvm-project//mlir:QuantOps",
"@llvm-project//mlir:TosaDialect",
"@llvm-project//mlir:Transforms",
],
)
cc_binary(
name = "mhlo-tosa-opt",
srcs = ["mhlo_tosa_opt.cc"],
deps = [
":MHLOTOSATransforms",
"//tensorflow/compiler/xla/mlir_hlo:hlo_dialect_registration",
"@llvm-project//llvm:Support",
"@llvm-project//mlir:AllPassesAndDialects",
"@llvm-project//mlir:IR",
"@llvm-project//mlir:MlirOptLib",
"@llvm-project//mlir:Pass",
"@llvm-project//mlir:Support",
"@llvm-project//mlir:TosaDialect",
],
)