[Mlir-commits] [mlir] 07fc852 - [mlir][ODS] Small fixes for ODS classes

Mehdi Amini llvmlistbot at llvm.org
Thu Feb 4 09:05:59 PST 2021


Author: Vladislav Vinogradov
Date: 2021-02-04T17:05:30Z
New Revision: 07fc852897134cfa29a1baf9e10247e9456df462

URL: https://github.com/llvm/llvm-project/commit/07fc852897134cfa29a1baf9e10247e9456df462
DIFF: https://github.com/llvm/llvm-project/commit/07fc852897134cfa29a1baf9e10247e9456df462.diff

LOG: [mlir][ODS] Small fixes for ODS classes

* Introduce separate `RankedTensorOf` class. Use it as base class for `AnyRankedTensor`.
* Add C++ class specification (`::mlir::MemRefType`) to `MemRefRankOf` and `StaticShapeMemRefOf`.

Reviewed By: ftynse

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

Added: 
    

Modified: 
    mlir/include/mlir/IR/OpBase.td

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/IR/OpBase.td b/mlir/include/mlir/IR/OpBase.td
index 1379bf157623..0bd1ee38bf1f 100644
--- a/mlir/include/mlir/IR/OpBase.td
+++ b/mlir/include/mlir/IR/OpBase.td
@@ -604,11 +604,13 @@ class TensorOf<list<Type> allowedTypes> :
   ShapedContainerType<allowedTypes, IsTensorTypePred, "tensor",
                       "::mlir::TensorType">;
 
+class RankedTensorOf<list<Type> allowedTypes> :
+  ShapedContainerType<allowedTypes, And<[IsTensorTypePred, HasRankPred]>,
+  "ranked tensor", "::mlir::TensorType">;
+
 def AnyTensor : TensorOf<[AnyType]>;
 
-def AnyRankedTensor :
-  ShapedContainerType<[AnyType], And<[IsTensorTypePred, HasRankPred]>,
-  "ranked tensor", "::mlir::TensorType">;
+def AnyRankedTensor : RankedTensorOf<[AnyType]>;
 
 // TODO: Have an easy way to add another constraint to a type.
 class StaticShapeTensorOf<list<Type> allowedTypes>
@@ -675,11 +677,13 @@ def F64MemRef  : MemRefOf<[F64]>;
 class MemRefRankOf<list<Type> allowedTypes, list<int> ranks> :
     Type<And<[MemRefOf<allowedTypes>.predicate, HasAnyRankOfPred<ranks>]>,
          !interleave(!foreach(rank, ranks, rank # "D"), "/") # " " #
-         MemRefOf<allowedTypes>.summary>;
+         MemRefOf<allowedTypes>.summary,
+         "::mlir::MemRefType">;
 
 class StaticShapeMemRefOf<list<Type> allowedTypes>
     : Type<And<[MemRefOf<allowedTypes>.predicate, HasStaticShapePred]>,
-           "statically shaped " # MemRefOf<allowedTypes>.summary>;
+           "statically shaped " # MemRefOf<allowedTypes>.summary,
+           "::mlir::MemRefType">;
 
 def AnyStaticShapeMemRef : StaticShapeMemRefOf<[AnyType]>;
 


        


More information about the Mlir-commits mailing list