[Mlir-commits] [mlir] fb0dbc5 - [mlir][memref] Introduce UnrankedMemRefOf to tablegen definitions
Stephan Herhut
llvmlistbot at llvm.org
Fri Jun 25 09:52:15 PDT 2021
Author: Stephan Herhut
Date: 2021-06-25T18:52:04+02:00
New Revision: fb0dbc54813473f438bc07f38ef61557de2da216
URL: https://github.com/llvm/llvm-project/commit/fb0dbc54813473f438bc07f38ef61557de2da216
DIFF: https://github.com/llvm/llvm-project/commit/fb0dbc54813473f438bc07f38ef61557de2da216.diff
LOG: [mlir][memref] Introduce UnrankedMemRefOf to tablegen definitions
This enables specifying operations that only support some element types for
unranked memrefs.
Differential Revision: https://reviews.llvm.org/D104906
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 952e3a36e457b..2b17731e95d02 100644
--- a/mlir/include/mlir/IR/OpBase.td
+++ b/mlir/include/mlir/IR/OpBase.td
@@ -211,10 +211,14 @@ def IsTensorTypePred : CPred<"$_self.isa<::mlir::TensorType>()">;
// Whether a type is a MemRefType.
def IsMemRefTypePred : CPred<"$_self.isa<::mlir::MemRefType>()">;
-// Whether a type is an IsUnrankedMemRefType
+// Whether a type is an UnrankedMemRefType
def IsUnrankedMemRefTypePred
: CPred<"$_self.isa<::mlir::UnrankedMemRefType>()">;
+// Whether a type is a BaseMemRefType
+def IsBaseMemRefTypePred
+ : CPred<"$_self.isa<::mlir::BaseMemRefType>()">;
+
// Whether a type is a ShapedType.
def IsShapedTypePred : CPred<"$_self.isa<::mlir::ShapedType>()">;
@@ -651,10 +655,13 @@ class 3DTensorOf<list<Type> allowedTypes> : TensorRankOf<allowedTypes, [3]>;
class 4DTensorOf<list<Type> allowedTypes> : TensorRankOf<allowedTypes, [4]>;
// Unranked Memref type
-def AnyUnrankedMemRef :
- ShapedContainerType<[AnyType],
+class UnrankedMemRefOf<list<Type> allowedTypes> :
+ ShapedContainerType<allowedTypes,
IsUnrankedMemRefTypePred, "unranked.memref",
"::mlir::UnrankedMemRefType">;
+
+def AnyUnrankedMemRef : UnrankedMemRefOf<[AnyType]>;
+
// Memref type.
// Memrefs are blocks of data with fixed type and rank.
@@ -664,6 +671,9 @@ class MemRefOf<list<Type> allowedTypes> :
def AnyMemRef : MemRefOf<[AnyType]>;
+class RankedOrUnrankedMemRefOf<list<Type> allowedTypes>:
+ AnyTypeOf<[UnrankedMemRefOf<allowedTypes>, MemRefOf<allowedTypes>]>;
+
def AnyRankedOrUnrankedMemRef: AnyTypeOf<[AnyUnrankedMemRef, AnyMemRef]>;
// Memref declarations handle any memref, independent of rank, size, (static or
More information about the Mlir-commits
mailing list