diff --git a/tensorflow/compiler/mlir/tensorflow/BUILD b/tensorflow/compiler/mlir/tensorflow/BUILD index b7f1d22009e..95d916c4051 100644 --- a/tensorflow/compiler/mlir/tensorflow/BUILD +++ b/tensorflow/compiler/mlir/tensorflow/BUILD @@ -44,6 +44,7 @@ filegroup( "@llvm-project//mlir:OpBaseTdFiles", "@llvm-project//mlir:SideEffectTdFiles", "@llvm-project//mlir:include/mlir/Interfaces/CallInterfaces.td", + "@llvm-project//mlir:include/mlir/Interfaces/ControlFlowInterfaces.td", "@llvm-project//mlir:include/mlir/Interfaces/InferTypeOpInterface.td", "@llvm-project//mlir:include/mlir/Interfaces/LoopLikeInterface.td", ], @@ -285,8 +286,10 @@ gentbl( tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "ir/tf_device_ops.td", td_srcs = [ - "@llvm-project//mlir:include/mlir/IR/OpBase.td", + "@llvm-project//mlir:SideEffectTdFiles", "@llvm-project//mlir:include/mlir/Dialect/StandardOps/IR/Ops.td", + "@llvm-project//mlir:include/mlir/IR/OpBase.td", + "@llvm-project//mlir:include/mlir/Interfaces/ControlFlowInterfaces.td", ], test = True, ) @@ -408,6 +411,7 @@ cc_library( ":tensorflow_traits", ":tensorflow_types", "@llvm-project//llvm:Support", + "@llvm-project//mlir:ControlFlowInterfaces", "@llvm-project//mlir:DerivedAttributeOpInterface", "@llvm-project//mlir:Dialect", "@llvm-project//mlir:IR", @@ -453,6 +457,7 @@ cc_library( "//tensorflow/core:framework", "//tensorflow/core:lib", "@llvm-project//llvm:Support", + "@llvm-project//mlir:ControlFlowInterfaces", "@llvm-project//mlir:DerivedAttributeOpInterface", "@llvm-project//mlir:Dialect", "@llvm-project//mlir:IR", @@ -495,6 +500,7 @@ cc_library( "//tensorflow/core:framework", "//tensorflow/core:lib", "@llvm-project//llvm:Support", + "@llvm-project//mlir:ControlFlowInterfaces", "@llvm-project//mlir:DerivedAttributeOpInterface", "@llvm-project//mlir:Dialect", "@llvm-project//mlir:IR", @@ -533,6 +539,7 @@ cc_library( ":tensorflow_remaining_ops", ":tensorflow_tfrt_ops", "@llvm-project//llvm:Support", + "@llvm-project//mlir:ControlFlowInterfaces", "@llvm-project//mlir:DerivedAttributeOpInterface", "@llvm-project//mlir:Dialect", "@llvm-project//mlir:IR", @@ -640,6 +647,7 @@ cc_library( "@llvm-project//llvm:Support", "@llvm-project//mlir:Analysis", "@llvm-project//mlir:CallOpInterfacesIncGen", + "@llvm-project//mlir:ControlFlowInterfaces", "@llvm-project//mlir:DerivedAttributeOpInterface", "@llvm-project//mlir:Dialect", "@llvm-project//mlir:IR", diff --git a/tensorflow/compiler/mlir/tensorflow/ir/tf_device.h b/tensorflow/compiler/mlir/tensorflow/ir/tf_device.h index 921c3c32fa8..2d5307ec39d 100644 --- a/tensorflow/compiler/mlir/tensorflow/ir/tf_device.h +++ b/tensorflow/compiler/mlir/tensorflow/ir/tf_device.h @@ -24,6 +24,8 @@ limitations under the License. #include "mlir/IR/Dialect.h" // from @llvm-project #include "mlir/IR/OpDefinition.h" // from @llvm-project #include "mlir/IR/Value.h" // from @llvm-project +#include "mlir/Interfaces/ControlFlowInterfaces.h" // from @llvm-project +#include "mlir/Interfaces/SideEffectInterfaces.h" // from @llvm-project namespace mlir { namespace tf_device { diff --git a/tensorflow/compiler/mlir/tensorflow/ir/tf_device_ops.td b/tensorflow/compiler/mlir/tensorflow/ir/tf_device_ops.td index b0c3ff3574c..e9c2a054252 100644 --- a/tensorflow/compiler/mlir/tensorflow/ir/tf_device_ops.td +++ b/tensorflow/compiler/mlir/tensorflow/ir/tf_device_ops.td @@ -19,6 +19,8 @@ limitations under the License. #define TF_DEVICE_DIALECT include "mlir/IR/OpBase.td" +include "mlir/Interfaces/ControlFlowInterfaces.td" +include "mlir/Interfaces/SideEffectInterfaces.td" //===----------------------------------------------------------------------===// // TensorFlow Device Dialect definitions @@ -85,7 +87,7 @@ This op captures all needed live-in values. let hasCanonicalizer = 1; } -def TfDevice_ReturnOp : TfDevice_Op<"return", [Terminator]> { +def TfDevice_ReturnOp : TfDevice_Op<"return", [NoSideEffect, ReturnLike, Terminator]> { let summary = [{ The `tf_device.return` operation terminates and returns values from a `tf_device` dialect operation. diff --git a/tensorflow/compiler/mlir/tensorflow/ir/tf_ops.h b/tensorflow/compiler/mlir/tensorflow/ir/tf_ops.h index 524ac9b82ce..e5da007625e 100644 --- a/tensorflow/compiler/mlir/tensorflow/ir/tf_ops.h +++ b/tensorflow/compiler/mlir/tensorflow/ir/tf_ops.h @@ -29,6 +29,7 @@ limitations under the License. #include "mlir/IR/StandardTypes.h" // from @llvm-project #include "mlir/IR/TypeUtilities.h" // from @llvm-project #include "mlir/Interfaces/CallInterfaces.h" // from @llvm-project +#include "mlir/Interfaces/ControlFlowInterfaces.h" // from @llvm-project #include "mlir/Interfaces/DerivedAttributeOpInterface.h" // from @llvm-project #include "mlir/Interfaces/InferTypeOpInterface.h" // from @llvm-project #include "mlir/Interfaces/LoopLikeInterface.h" // from @llvm-project diff --git a/tensorflow/compiler/mlir/tensorflow/ir/tf_ops.td b/tensorflow/compiler/mlir/tensorflow/ir/tf_ops.td index 20a3a9d8a7e..c3214d94bb2 100644 --- a/tensorflow/compiler/mlir/tensorflow/ir/tf_ops.td +++ b/tensorflow/compiler/mlir/tensorflow/ir/tf_ops.td @@ -30,8 +30,10 @@ limitations under the License. include "tensorflow/compiler/mlir/tensorflow/ir/tf_generated_ops.td" include "tensorflow/compiler/mlir/tensorflow/ir/tf_op_base.td" include "mlir/Interfaces/CallInterfaces.td" +include "mlir/Interfaces/ControlFlowInterfaces.td" include "mlir/Interfaces/InferTypeOpInterface.td" include "mlir/Interfaces/LoopLikeInterface.td" +include "mlir/Interfaces/SideEffectInterfaces.td" include "mlir/IR/OpBase.td" class TF_TensorListInitOp : TF_Op { @@ -352,7 +354,8 @@ else_branch: A function that takes 'inputs' and returns a list of } def TF_YieldOp : TF_Op<"Yield", - [Terminator, ParentOneOf<["CaseRegionOp", "IfRegionOp", "WhileRegionOp"]>]> { + [NoSideEffect, ReturnLike, Terminator, + ParentOneOf<["CaseRegionOp", "IfRegionOp", "WhileRegionOp"]>]> { let summary = "Yield operation"; let description = [{ diff --git a/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_a_m.h b/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_a_m.h index 1038356cd11..fe788ac608e 100644 --- a/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_a_m.h +++ b/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_a_m.h @@ -26,6 +26,7 @@ limitations under the License. #include "mlir/IR/StandardTypes.h" // from @llvm-project #include "mlir/IR/TypeUtilities.h" // from @llvm-project #include "mlir/Interfaces/CallInterfaces.h" // from @llvm-project +#include "mlir/Interfaces/ControlFlowInterfaces.h" // from @llvm-project #include "mlir/Interfaces/DerivedAttributeOpInterface.h" // from @llvm-project #include "mlir/Interfaces/InferTypeOpInterface.h" // from @llvm-project #include "mlir/Interfaces/LoopLikeInterface.h" // from @llvm-project diff --git a/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_n_z.h b/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_n_z.h index 69dff8f7334..353c1c6f1d4 100644 --- a/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_n_z.h +++ b/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_n_z.h @@ -26,6 +26,7 @@ limitations under the License. #include "mlir/IR/StandardTypes.h" // from @llvm-project #include "mlir/IR/TypeUtilities.h" // from @llvm-project #include "mlir/Interfaces/CallInterfaces.h" // from @llvm-project +#include "mlir/Interfaces/ControlFlowInterfaces.h" // from @llvm-project #include "mlir/Interfaces/DerivedAttributeOpInterface.h" // from @llvm-project #include "mlir/Interfaces/InferTypeOpInterface.h" // from @llvm-project #include "mlir/Interfaces/LoopLikeInterface.h" // from @llvm-project