15#include "llvm/ADT/StringSet.h"
17#include "mlir/Dialect/Utils/DialectUtilsEnums.cpp.inc"
22 if (indexingMaps.size() != 3)
25 AffineMap map0 = cast<AffineMapAttr>(indexingMaps[0]).getValue();
26 AffineMap map1 = cast<AffineMapAttr>(indexingMaps[1]).getValue();
27 AffineMap map2 = cast<AffineMapAttr>(indexingMaps[2]).getValue();
39 auto *context = indexingMaps.getContext();
40 auto mapA = AffineMapAttr::get(
AffineMap::get(3, 0, {m, k}, context));
41 auto mapB = AffineMapAttr::get(
AffineMap::get(3, 0, {k, n}, context));
42 auto mapC = AffineMapAttr::get(
AffineMap::get(3, 0, {m, n}, context));
43 auto maps = ArrayAttr::get(context, {mapA, mapB, mapC});
44 return indexingMaps == maps;
48 if (indexingMaps.size() != 3)
51 AffineMap map0 = cast<AffineMapAttr>(indexingMaps[0]).getValue();
52 AffineMap map1 = cast<AffineMapAttr>(indexingMaps[1]).getValue();
53 AffineMap map2 = cast<AffineMapAttr>(indexingMaps[2]).getValue();
65 auto *context = indexingMaps.getContext();
66 auto mapA = AffineMapAttr::get(
AffineMap::get(3, 0, {k, m}, context));
67 auto mapB = AffineMapAttr::get(
AffineMap::get(3, 0, {n, k}, context));
68 auto mapC = AffineMapAttr::get(
AffineMap::get(3, 0, {n, m}, context));
69 auto maps = ArrayAttr::get(context, {mapA, mapB, mapC});
70 return indexingMaps == maps;
74 if (indexingMaps.size() != 3)
77 AffineMap map0 = cast<AffineMapAttr>(indexingMaps[0]).getValue();
78 AffineMap map1 = cast<AffineMapAttr>(indexingMaps[1]).getValue();
79 AffineMap map2 = cast<AffineMapAttr>(indexingMaps[2]).getValue();
92 auto *context = indexingMaps.getContext();
93 auto mapA = AffineMapAttr::get(
AffineMap::get(4, 0, {
b, m, k}, context));
94 auto mapB = AffineMapAttr::get(
AffineMap::get(4, 0, {
b, k, n}, context));
95 auto mapC = AffineMapAttr::get(
AffineMap::get(4, 0, {
b, m, n}, context));
96 auto maps = ArrayAttr::get(context, {mapA, mapB, mapC});
97 return indexingMaps == maps;
101 if (indexingMaps.size() != 3)
103 AffineMap map0 = cast<AffineMapAttr>(indexingMaps[0]).getValue();
104 AffineMap map1 = cast<AffineMapAttr>(indexingMaps[1]).getValue();
105 AffineMap map2 = cast<AffineMapAttr>(indexingMaps[2]).getValue();
116 auto *context = indexingMaps.getContext();
117 auto mapA = AffineMapAttr::get(
AffineMap::get(2, 0, {k}, context));
118 auto mapB = AffineMapAttr::get(
AffineMap::get(2, 0, {k, n}, context));
119 auto mapC = AffineMapAttr::get(
AffineMap::get(2, 0, {n}, context));
120 auto maps = ArrayAttr::get(context, {mapA, mapB, mapC});
121 return indexingMaps == maps;
125 if (indexingMaps.size() != 3)
127 AffineMap map0 = cast<AffineMapAttr>(indexingMaps[0]).getValue();
128 AffineMap map1 = cast<AffineMapAttr>(indexingMaps[1]).getValue();
129 AffineMap map2 = cast<AffineMapAttr>(indexingMaps[2]).getValue();
141 auto *context = indexingMaps.getContext();
143 auto mapB = AffineMapAttr::get(
AffineMap::get(3, 0, {
b, k, n}, context));
145 auto maps = ArrayAttr::get(context, {mapA, mapB, mapC});
146 return indexingMaps == maps;
150 if (indexingMaps.size() != 3)
152 AffineMap map0 = cast<AffineMapAttr>(indexingMaps[0]).getValue();
153 AffineMap map1 = cast<AffineMapAttr>(indexingMaps[1]).getValue();
154 AffineMap map2 = cast<AffineMapAttr>(indexingMaps[2]).getValue();
165 auto *context = indexingMaps.getContext();
166 auto mapA = AffineMapAttr::get(
AffineMap::get(2, 0, {n, k}, context));
167 auto mapB = AffineMapAttr::get(
AffineMap::get(2, 0, {k}, context));
168 auto mapC = AffineMapAttr::get(
AffineMap::get(2, 0, {n}, context));
169 auto maps = ArrayAttr::get(context, {mapA, mapB, mapC});
170 return indexingMaps == maps;
174 if (indexingMaps.size() != 3)
176 AffineMap map0 = cast<AffineMapAttr>(indexingMaps[0]).getValue();
177 AffineMap map1 = cast<AffineMapAttr>(indexingMaps[1]).getValue();
178 AffineMap map2 = cast<AffineMapAttr>(indexingMaps[2]).getValue();
190 auto *context = indexingMaps.getContext();
191 auto mapA = AffineMapAttr::get(
AffineMap::get(3, 0, {
b, n, k}, context));
194 auto maps = ArrayAttr::get(context, {mapA, mapB, mapC});
195 return indexingMaps == maps;
206 b.cloneRegionBefore(r, *newRegion, newRegion->
begin(), bvm);
208 return b.create(state);
217 for (
size_t cnt = 0, e = op->
getNumRegions(); cnt < e; ++cnt)
219 return b.create(state);
225 elidedAttrsSet.insert_range(elidedAttrs);
228 if (elidedAttrsSet.count(attr.getName()))
230 attrs.push_back(attr);
Base type for affine expression.
A multi-dimensional affine map Affine map's are immutable like Type's, and they are uniqued.
static AffineMap get(MLIRContext *context)
Returns a zero result affine map with no dimensions or symbols: () -> ().
unsigned getNumResults() const
unsigned getNumInputs() const
AffineExpr getResult(unsigned idx) const
This is a utility class for mapping one set of IR entities to another.
This class helps build Operations.
Operation is the basic unit of execution within MLIR.
unsigned getNumRegions()
Returns the number of regions held by this operation.
Location getLoc()
The source location the operation was defined or derived from.
Attribute getPropertiesAsAttribute()
Return the properties converted to an attribute.
OperationName getName()
The name of an operation is the key identifier for it.
DictionaryAttr getDiscardableAttrDictionary()
Return all of the discardable attributes on this operation as a DictionaryAttr.
MutableArrayRef< Region > getRegions()
Returns the regions held by this operation.
This class contains a list of basic blocks and a link to the parent operation it is attached to.
This class provides an abstraction over the various different ranges of value types.
This class provides an abstraction over the different types of ranges over Values.
Include the generated interface declarations.
bool isColumnMajorMatmul(ArrayAttr indexingMaps)
Tests whether the given maps describe a column major matmul.
bool isBatchMatvec(ArrayAttr indexingMaps)
Tests whether the given maps describe a batch matrix vector multiplication.
Operation * cloneWithoutRegions(OpBuilder &b, Operation *op, TypeRange newResultTypes, ValueRange newOperands)
bool isMatvec(ArrayAttr indexingMaps)
Tests whether the given maps describe a matrix vector multiplication.
bool isBatchVecmat(ArrayAttr indexingMaps)
Tests whether the given maps describe a batch vector matrix multiplication.
bool isRowMajorBatchMatmul(ArrayAttr indexingMaps)
Tests whether the given maps describe a row major batch matmul.
Operation * clone(OpBuilder &b, Operation *op, TypeRange newResultTypes, ValueRange newOperands)
bool isVecmat(ArrayAttr indexingMaps)
Tests whether the given maps describe a vector matrix multiplication.
bool isRowMajorMatmul(ArrayAttr indexingMaps)
Tests whether the given maps describe a row major matmul.
SmallVector< NamedAttribute > getPrunedAttributeList(Operation *op, ArrayRef< StringRef > elidedAttrs)
This represents an operation in an abstracted form, suitable for use with the builder APIs.
Attribute propertiesAttr
This Attribute is used to opaquely construct the properties of the operation.
Region * addRegion()
Create a region that should be attached to the operation.