[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
This commit is contained in:
Nicolas Vasilache 2020-03-09 12:53:04 -04:00
parent 0e93f3b0a0
commit c494ff05ed

@ -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> :