From 6923207925486aa907c7dd74960999dfe486d6b5 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Mon, 16 Mar 2020 17:35:31 -0700 Subject: [PATCH] Bump open source LLVM revision to 378b1e60809df7cc72436093f160b7ed228dad5a Adjust code for refactorings that happened in MLIR. PiperOrigin-RevId: 301272688 Change-Id: I1c08aefcb6ccebcb643481bffad0eebc11cea10f --- tensorflow/compiler/mlir/lite/BUILD | 14 +-- tensorflow/compiler/mlir/lite/ir/tfl_ops.h | 2 +- tensorflow/compiler/mlir/lite/ir/tfl_ops.td | 2 +- .../mlir/lite/quantization/quantization.td | 2 +- tensorflow/workspace.bzl | 4 +- third_party/mlir/BUILD | 94 +++++++++++++++---- 6 files changed, 89 insertions(+), 29 deletions(-) diff --git a/tensorflow/compiler/mlir/lite/BUILD b/tensorflow/compiler/mlir/lite/BUILD index feed48f4ca7..c917af71f92 100644 --- a/tensorflow/compiler/mlir/lite/BUILD +++ b/tensorflow/compiler/mlir/lite/BUILD @@ -30,8 +30,8 @@ filegroup( "ir/tfl_ops.td", "//tensorflow/compiler/mlir/lite/quantization:quantization_td_files", "@llvm-project//mlir:OpBaseTdFiles", + "@llvm-project//mlir:include/mlir/Interfaces/LoopLikeInterface.td", "@llvm-project//mlir:include/mlir/Interfaces/SideEffects.td", - "@llvm-project//mlir:include/mlir/Transforms/LoopLikeInterface.td", ], ) @@ -222,21 +222,21 @@ cc_library( deps = [ ":tensorflow_lite_ops_inc_gen", ":validators", + "//tensorflow/compiler/mlir/tensorflow", + "//tensorflow/compiler/mlir/tensorflow:tensorflow_types", + "//tensorflow/lite/schema:schema_fbs", "@llvm-project//llvm:support", "@llvm-project//mlir:Analysis", "@llvm-project//mlir:DerivedAttributeOpInterface", "@llvm-project//mlir:Dialect", "@llvm-project//mlir:IR", + "@llvm-project//mlir:LoopLikeInterface", "@llvm-project//mlir:Pass", "@llvm-project//mlir:QuantOps", "@llvm-project//mlir:SideEffects", "@llvm-project//mlir:StandardOps", "@llvm-project//mlir:Support", - # TODO(jpienaar): Move this out after splitting out LoopLikeOpInterface. - "@llvm-project//mlir:Transforms", - "//tensorflow/compiler/mlir/tensorflow", - "//tensorflow/compiler/mlir/tensorflow:tensorflow_types", - "//tensorflow/lite/schema:schema_fbs", + "@llvm-project//mlir:TransformUtils", ], alwayslink = 1, ) @@ -439,7 +439,7 @@ genrule( srcs = [ "ir/tfl_ops.td", "ir/tfl_op_interfaces.td", - "@llvm-project//mlir:include/mlir/Transforms/LoopLikeInterface.td", + "@llvm-project//mlir:include/mlir/Interfaces/LoopLikeInterface.td", "//tensorflow/compiler/mlir/lite/quantization:quantization_td_files", ], outs = [ diff --git a/tensorflow/compiler/mlir/lite/ir/tfl_ops.h b/tensorflow/compiler/mlir/lite/ir/tfl_ops.h index ff7b8334c73..cfe18a218bc 100644 --- a/tensorflow/compiler/mlir/lite/ir/tfl_ops.h +++ b/tensorflow/compiler/mlir/lite/ir/tfl_ops.h @@ -26,10 +26,10 @@ limitations under the License. #include "mlir/IR/OpImplementation.h" // TF:llvm-project #include "mlir/IR/StandardTypes.h" // TF:llvm-project #include "mlir/Interfaces/DerivedAttributeOpInterface.h" // TF:llvm-project +#include "mlir/Interfaces/LoopLikeInterface.h" // TF:llvm-project #include "mlir/Interfaces/SideEffects.h" // TF:llvm-project #include "mlir/Support/Functional.h" // TF:llvm-project #include "mlir/Support/LLVM.h" // TF:llvm-project -#include "mlir/Transforms/LoopLikeInterface.h" // TF:llvm-project #include "tensorflow/compiler/mlir/lite/quantization/quantization_traits.h" #include "tensorflow/lite/schema/schema_generated.h" diff --git a/tensorflow/compiler/mlir/lite/ir/tfl_ops.td b/tensorflow/compiler/mlir/lite/ir/tfl_ops.td index 970bfaca0fd..5624c7e2b73 100644 --- a/tensorflow/compiler/mlir/lite/ir/tfl_ops.td +++ b/tensorflow/compiler/mlir/lite/ir/tfl_ops.td @@ -19,8 +19,8 @@ limitations under the License. #define TFL_OPS include "mlir/IR/OpBase.td" +include "mlir/Interfaces/LoopLikeInterface.td" include "mlir/Interfaces/SideEffects.td" -include "mlir/Transforms/LoopLikeInterface.td" include "tensorflow/compiler/mlir/lite/ir/tfl_op_interfaces.td" include "tensorflow/compiler/mlir/lite/quantization/quantization.td" diff --git a/tensorflow/compiler/mlir/lite/quantization/quantization.td b/tensorflow/compiler/mlir/lite/quantization/quantization.td index 416c3d1719d..966740e605f 100644 --- a/tensorflow/compiler/mlir/lite/quantization/quantization.td +++ b/tensorflow/compiler/mlir/lite/quantization/quantization.td @@ -20,7 +20,7 @@ limitations under the License. #define TF_Quantization include "mlir/IR/OpBase.td" -include "mlir/Dialect/QuantOps/QuantPredicates.td" +include "mlir/Dialect/QuantOps/QuantOpsBase.td" //===----------------------------------------------------------------------===// // QuantizedType definitions. diff --git a/tensorflow/workspace.bzl b/tensorflow/workspace.bzl index a1eaad62bc8..c29d5953fe0 100755 --- a/tensorflow/workspace.bzl +++ b/tensorflow/workspace.bzl @@ -597,8 +597,8 @@ def tf_repositories(path_prefix = "", tf_repo_name = ""): ) # Check out LLVM and MLIR from llvm-project. - LLVM_COMMIT = "b2bb8b6cd6402d5495c0b20b27697df34de6c1c8" - LLVM_SHA256 = "79264ade6997dc0d63ea46a308a6740ffe87b6ce8ed7cade42e9d725ac9ad542" + LLVM_COMMIT = "378b1e60809df7cc72436093f160b7ed228dad5a" + LLVM_SHA256 = "bdd3da501a5dce693d945fe331443e1dca0dcb0bac382599a8879d105b3e041e" LLVM_URLS = [ "https://storage.googleapis.com/mirror.tensorflow.org/github.com/llvm/llvm-project/archive/{commit}.tar.gz".format(commit = LLVM_COMMIT), "https://github.com/llvm/llvm-project/archive/{commit}.tar.gz".format(commit = LLVM_COMMIT), diff --git a/third_party/mlir/BUILD b/third_party/mlir/BUILD index 2d01bf2553a..22b91ba36a8 100644 --- a/third_party/mlir/BUILD +++ b/third_party/mlir/BUILD @@ -144,8 +144,8 @@ filegroup( srcs = [ "include/mlir/Dialect/AffineOps/AffineOps.td", "include/mlir/Dialect/AffineOps/AffineOpsBase.td", + "include/mlir/Interfaces/LoopLikeInterface.td", "include/mlir/Interfaces/SideEffects.td", - "include/mlir/Transforms/LoopLikeInterface.td", ":OpBaseTdFiles", ], ) @@ -162,6 +162,10 @@ gentbl( "-gen-op-defs", "include/mlir/Dialect/AffineOps/AffineOps.cpp.inc", ), + ( + "-gen-dialect-decls", + "include/mlir/Dialect/AffineOps/AffineOpsDialect.h.inc", + ), ], tblgen = ":mlir-tblgen", td_file = "include/mlir/Dialect/AffineOps/AffineOps.td", @@ -174,8 +178,8 @@ filegroup( name = "LoopOpsTdFiles", srcs = [ "include/mlir/Dialect/LoopOps/LoopOps.td", + "include/mlir/Interfaces/LoopLikeInterface.td", "include/mlir/Interfaces/SideEffects.td", - "include/mlir/Transforms/LoopLikeInterface.td", ":OpBaseTdFiles", ], ) @@ -192,6 +196,10 @@ gentbl( "-gen-op-defs", "include/mlir/Dialect/LoopOps/LoopOps.cpp.inc", ), + ( + "-gen-dialect-decls", + "include/mlir/Dialect/LoopOps/LoopOpsDialect.h.inc", + ), ], tblgen = ":mlir-tblgen", td_file = "include/mlir/Dialect/LoopOps/LoopOps.td", @@ -241,6 +249,10 @@ gentbl( "-gen-op-defs", "include/mlir/Dialect/StandardOps/IR/Ops.cpp.inc", ), + ( + "-gen-dialect-decls", + "include/mlir/Dialect/StandardOps/IR/OpsDialect.h.inc", + ), ( "-gen-enum-decls", "include/mlir/Dialect/StandardOps/IR/OpsEnums.h.inc", @@ -300,7 +312,6 @@ cc_library( ], ) + [ "include/mlir/Transforms/InliningUtils.h", - "include/mlir/Transforms/LoopLikeInterface.h", ], hdrs = glob([ "include/mlir/Dialect/AffineOps/*.h", @@ -311,7 +322,7 @@ cc_library( ":AffineOpsIncGen", ":EDSC", ":IR", - ":LoopLikeOpInterfaceIncGen", + ":LoopLikeInterface", ":SideEffects", ":StandardOps", ":Support", @@ -370,14 +381,12 @@ cc_library( hdrs = glob([ "include/mlir/Dialect/LoopOps/*.h", "include/mlir/Dialect/LoopOps/EDSC/*.h", - ]) + [ - "include/mlir/Transforms/LoopLikeInterface.h", - ], + ]), includes = ["include"], deps = [ ":EDSC", ":IR", - ":LoopLikeOpInterfaceIncGen", + ":LoopLikeInterface", ":LoopOpsIncGen", ":SideEffects", ":StandardOps", @@ -386,6 +395,17 @@ cc_library( ], ) +cc_library( + name = "LoopLikeInterface", + srcs = ["lib/Interfaces/LoopLikeInterface.cpp"], + hdrs = ["include/mlir/Interfaces/LoopLikeInterface.h"], + includes = ["include"], + deps = [ + ":IR", + ":LoopLikeInterfaceIncGen", + ], +) + cc_library( name = "StandardOps", srcs = glob( @@ -559,6 +579,10 @@ gentbl( "-gen-op-defs", "include/mlir/Dialect/GPU/GPUOps.cpp.inc", ), + ( + "-gen-dialect-decls -dialect=gpu", + "include/mlir/Dialect/GPU/GPUOpsDialect.h.inc", + ), ], tblgen = ":mlir-tblgen", td_file = "include/mlir/Dialect/GPU/GPUOps.td", @@ -798,6 +822,10 @@ gentbl( "-gen-op-defs", "include/mlir/Dialect/LLVMIR/LLVMOps.cpp.inc", ), + ( + "-gen-dialect-decls", + "include/mlir/Dialect/LLVMIR/LLVMOpsDialect.h.inc", + ), ( "-gen-enum-decls", "include/mlir/Dialect/LLVMIR/LLVMOpsEnums.h.inc", @@ -882,6 +910,10 @@ gentbl( "-gen-op-defs", "include/mlir/Dialect/LLVMIR/NVVMOps.cpp.inc", ), + ( + "-gen-dialect-decls -dialect=nvvm", + "include/mlir/Dialect/LLVMIR/NVVMOpsDialect.h.inc", + ), ], tblgen = ":mlir-tblgen", td_file = "include/mlir/Dialect/LLVMIR/NVVMOps.td", @@ -950,6 +982,10 @@ gentbl( "-gen-op-defs", "include/mlir/Dialect/LLVMIR/ROCDLOps.cpp.inc", ), + ( + "-gen-dialect-decls -dialect=rocdl", + "include/mlir/Dialect/LLVMIR/ROCDLOpsDialect.h.inc", + ), ], tblgen = ":mlir-tblgen", td_file = "include/mlir/Dialect/LLVMIR/ROCDLOps.td", @@ -997,6 +1033,10 @@ gentbl( "-gen-op-defs", "include/mlir/Dialect/SPIRV/SPIRVOps.cpp.inc", ), + ( + "-gen-dialect-decls", + "include/mlir/Dialect/SPIRV/SPIRVOpsDialect.h.inc", + ), ( "-gen-op-doc", "g3doc/Dialects/SPIRV/SPIRVOps.md", @@ -1296,7 +1336,7 @@ cc_library( ":Analysis", ":ControlFlowInterfaces", ":IR", - ":LoopLikeOpInterfaceIncGen", + ":LoopLikeInterface", ":LoopOps", ":SideEffects", ":StandardOps", @@ -1343,20 +1383,20 @@ cc_library( ) gentbl( - name = "LoopLikeOpInterfaceIncGen", + name = "LoopLikeInterfaceIncGen", strip_include_prefix = "include", tbl_outs = [ ( "-gen-op-interface-decls", - "include/mlir/Transforms/LoopLikeInterface.h.inc", + "include/mlir/Interfaces/LoopLikeInterface.h.inc", ), ( "-gen-op-interface-defs", - "include/mlir/Transforms/LoopLikeInterface.cpp.inc", + "include/mlir/Interfaces/LoopLikeInterface.cpp.inc", ), ], tblgen = ":mlir-tblgen", - td_file = "include/mlir/Transforms/LoopLikeInterface.td", + td_file = "include/mlir/Interfaces/LoopLikeInterface.td", td_srcs = [ ":OpBaseTdFiles", ], @@ -1376,7 +1416,7 @@ cc_library( ":AffineOps", ":Analysis", ":IR", - ":LoopLikeOpInterfaceIncGen", + ":LoopLikeInterface", ":LoopOps", ":Pass", ":SideEffects", @@ -2164,6 +2204,10 @@ gentbl( "-gen-op-defs", "include/mlir/Dialect/OpenMP/OpenMPOps.cpp.inc", ), + ( + "-gen-dialect-decls", + "include/mlir/Dialect/OpenMP/OpenMPOpsDialect.h.inc", + ), ( "-gen-op-doc", "g3doc/Dialects/OpenMP/OpenMPOps.md", @@ -2199,7 +2243,7 @@ filegroup( name = "QuantizationOpsTdFiles", srcs = [ "include/mlir/Dialect/QuantOps/QuantOps.td", - "include/mlir/Dialect/QuantOps/QuantPredicates.td", + "include/mlir/Dialect/QuantOps/QuantOpsBase.td", "include/mlir/Interfaces/SideEffects.td", ":OpBaseTdFiles", ], @@ -2218,6 +2262,10 @@ gentbl( "-gen-op-defs", "include/mlir/Dialect/QuantOps/QuantOps.cpp.inc", ), + ( + "-gen-dialect-decls", + "include/mlir/Dialect/QuantOps/QuantOpsDialect.h.inc", + ), ( "-gen-op-doc", "g3doc/Dialects/QuantOps/QuantOps.md", @@ -2266,7 +2314,7 @@ filegroup( name = "FxpMathOpsTdFiles", srcs = [ "include/mlir/Dialect/FxpMathOps/FxpMathOps.td", - "include/mlir/Dialect/QuantOps/QuantPredicates.td", + "include/mlir/Dialect/QuantOps/QuantOpsBase.td", "include/mlir/Interfaces/SideEffects.td", ":OpBaseTdFiles", ], @@ -2285,6 +2333,10 @@ gentbl( "-gen-op-defs", "include/mlir/Dialect/FxpMathOps/FxpMathOps.cpp.inc", ), + ( + "-gen-dialect-decls -dialect=fxpmath", + "include/mlir/Dialect/FxpMathOps/FxpMathOpsDialect.h.inc", + ), ( "-gen-op-doc", "g3doc/Dialects/FxpMathOps/FxpMathOps.md", @@ -2342,6 +2394,10 @@ gentbl( "-gen-op-defs", "include/mlir/Dialect/Linalg/IR/LinalgOps.cpp.inc", ), + ( + "-gen-dialect-decls -dialect=linalg", + "include/mlir/Dialect/Linalg/IR/LinalgOpsDialect.h.inc", + ), ], tblgen = ":mlir-tblgen", td_file = "include/mlir/Dialect/Linalg/IR/LinalgOps.td", @@ -2629,6 +2685,10 @@ gentbl( "-gen-op-defs", "include/mlir/Dialect/VectorOps/VectorOps.cpp.inc", ), + ( + "-gen-dialect-decls -dialect=vector", + "include/mlir/Dialect/VectorOps/VectorOpsDialect.h.inc", + ), ( "-gen-op-doc", "g3doc/Dialects/Vector/VectorOps.md", @@ -2747,7 +2807,7 @@ exports_files( exports_files( [ "include/mlir/Interfaces/InferTypeOpInterface.td", - "include/mlir/Transforms/LoopLikeInterface.td", + "include/mlir/Interfaces/LoopLikeInterface.td", ], visibility = ["@llvm-project//mlir:friends"], )