[Mlir-commits] [mlir] c494ff0 - [mlir] NFC - Add predicates and types for VectorOfRank
Nicolas Vasilache
llvmlistbot at llvm.org
Mon Mar 9 09:57:27 PDT 2020
Author: Nicolas Vasilache
Date: 2020-03-09T12:53:37-04:00
New Revision: c494ff05ed59712ef90ffb66bfade6bac45a0ab1
URL: https://github.com/llvm/llvm-project/commit/c494ff05ed59712ef90ffb66bfade6bac45a0ab1
DIFF: https://github.com/llvm/llvm-project/commit/c494ff05ed59712ef90ffb66bfade6bac45a0ab1.diff
LOG: [mlir] NFC - Add predicates and types for VectorOfRank
Summary:
This is the counterpart of VectorOfLength for ranks.
This will be used in lowering vector.contract operations to llvm.matrix
Differential Revision: https://reviews.llvm.org/D75771
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 419ca0d1f63f..d1491903eb7c 100644
--- a/mlir/include/mlir/IR/OpBase.td
+++ b/mlir/include/mlir/IR/OpBase.td
@@ -485,6 +485,29 @@ class HasAnyRankOfPred<list<int> ranks> : And<[
class VectorOf<list<Type> allowedTypes> :
ShapedContainerType<allowedTypes, IsVectorTypePred, "vector">;
+// Whether the number of elements of a vector is from the given
+// `allowedRanks` list
+class IsVectorOfRankPred<list<int> allowedRanks> :
+ And<[IsVectorTypePred,
+ Or<!foreach(allowedlength, allowedRanks,
+ CPred<[{$_self.cast<VectorType>().getRank()
+ == }]
+ # allowedlength>)>]>;
+
+// Any vector where the rank is from the given `allowedRanks` list
+class VectorOfRank<list<int> allowedRanks> : Type<
+ IsVectorOfRankPred<allowedRanks>,
+ " of ranks " # StrJoinInt<allowedRanks, "/">.result>;
+
+// Any vector where the rank is from the given `allowedRanks` list and the type
+// is from the given `allowedTypes` list
+class VectorOfRankAndType<list<int> allowedRanks,
+ list<Type> allowedTypes> : Type<
+ And<[VectorOf<allowedTypes>.predicate,
+ VectorOfRank<allowedRanks>.predicate]>,
+ VectorOf<allowedTypes>.description #
+ VectorOfRank<allowedRanks>.description>;
+
// Whether the number of elements of a vector is from the given
// `allowedLengths` list
class IsVectorOfLengthPred<list<int> allowedLengths> :
More information about the Mlir-commits
mailing list