[mlir] Add InferTensorType without supporting reifyReturnTypeShapes
authorChia-hung Duan <chiahungduan@google.com>
Fri, 25 Mar 2022 18:09:53 +0000 (18:09 +0000)
committerChia-hung Duan <chiahungduan@google.com>
Fri, 25 Mar 2022 19:04:34 +0000 (19:04 +0000)
This is useful for the case that we don't need to implement
reifyReturnTypeShapes.

Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D121403

mlir/include/mlir/Interfaces/InferTypeOpInterface.td

index eb18606..ef41a08 100644 (file)
@@ -135,7 +135,7 @@ def InferShapedTypeOpInterface : OpInterface<"InferShapedTypeOpInterface"> {
 
 // Convenience class grouping together type and shaped type op interfaces for
 // ops that have tensor return types.
-class InferTensorType<list<string> overridenMethods = []> : TraitList<
+class InferTensorTypeBase<list<string> overridenMethods = []> : TraitList<
   [
     // Op implements infer type op interface.
     InferTypeOpInterface,
@@ -146,9 +146,10 @@ class InferTensorType<list<string> overridenMethods = []> : TraitList<
     // along with knowledge that it is producing Tensors to infer the type.
     NativeOpTrait<"InferTensorType">
   ]>;
-def InferTensorTypeWithReify: TraitList<InferTensorType<[
-    "inferReturnTypeComponents", "reifyReturnTypeShapes"]>.traits>;
 
+def InferTensorType : InferTensorTypeBase<["inferReturnTypeComponents"]>;
+def InferTensorTypeWithReify: InferTensorTypeBase<[
+    "inferReturnTypeComponents", "reifyReturnTypeShapes"]>;
 
 def ReifyRankedShapedTypeOpInterface :
     OpInterface<"ReifyRankedShapedTypeOpInterface"> {