14#include "llvm/ADT/StringSet.h"
16#include "mlir/Dialect/Utils/DialectUtilsEnums.cpp.inc"
21 if (indexingMaps.size() != 3)
24 AffineMap map0 = cast<AffineMapAttr>(indexingMaps[0]).getValue();
25 AffineMap map1 = cast<AffineMapAttr>(indexingMaps[1]).getValue();
26 AffineMap map2 = cast<AffineMapAttr>(indexingMaps[2]).getValue();
39 auto mapA = AffineMapAttr::get(
AffineMap::get(3, 0, {m, k}, context));
40 auto mapB = AffineMapAttr::get(
AffineMap::get(3, 0, {k, n}, context));
41 auto mapC = AffineMapAttr::get(
AffineMap::get(3, 0, {m, n}, context));
42 auto maps = ArrayAttr::get(context, {mapA, mapB, mapC});
43 return indexingMaps == maps;
47 if (indexingMaps.size() != 3)
50 AffineMap map0 = cast<AffineMapAttr>(indexingMaps[0]).getValue();
51 AffineMap map1 = cast<AffineMapAttr>(indexingMaps[1]).getValue();
52 AffineMap map2 = cast<AffineMapAttr>(indexingMaps[2]).getValue();
65 auto mapA = AffineMapAttr::get(
AffineMap::get(3, 0, {k, m}, context));
66 auto mapB = AffineMapAttr::get(
AffineMap::get(3, 0, {n, k}, context));
67 auto mapC = AffineMapAttr::get(
AffineMap::get(3, 0, {n, m}, context));
68 auto maps = ArrayAttr::get(context, {mapA, mapB, mapC});
69 return indexingMaps == maps;
73 if (indexingMaps.size() != 3)
76 AffineMap map0 = cast<AffineMapAttr>(indexingMaps[0]).getValue();
77 AffineMap map1 = cast<AffineMapAttr>(indexingMaps[1]).getValue();
78 AffineMap map2 = cast<AffineMapAttr>(indexingMaps[2]).getValue();
92 auto mapA = AffineMapAttr::get(
AffineMap::get(4, 0, {
b, m, k}, context));
93 auto mapB = AffineMapAttr::get(
AffineMap::get(4, 0, {
b, k, n}, context));
94 auto mapC = AffineMapAttr::get(
AffineMap::get(4, 0, {
b, m, n}, context));
95 auto maps = ArrayAttr::get(context, {mapA, mapB, mapC});
96 return indexingMaps == maps;
100 if (indexingMaps.size() != 3)
102 AffineMap map0 = cast<AffineMapAttr>(indexingMaps[0]).getValue();
103 AffineMap map1 = cast<AffineMapAttr>(indexingMaps[1]).getValue();
104 AffineMap map2 = cast<AffineMapAttr>(indexingMaps[2]).getValue();
116 auto mapA = AffineMapAttr::get(
AffineMap::get(2, 0, {k}, context));
117 auto mapB = AffineMapAttr::get(
AffineMap::get(2, 0, {k, n}, context));
118 auto mapC = AffineMapAttr::get(
AffineMap::get(2, 0, {n}, context));
119 auto maps = ArrayAttr::get(context, {mapA, mapB, mapC});
120 return indexingMaps == maps;
124 if (indexingMaps.size() != 3)
126 AffineMap map0 = cast<AffineMapAttr>(indexingMaps[0]).getValue();
127 AffineMap map1 = cast<AffineMapAttr>(indexingMaps[1]).getValue();
128 AffineMap map2 = cast<AffineMapAttr>(indexingMaps[2]).getValue();
142 auto mapB = AffineMapAttr::get(
AffineMap::get(3, 0, {
b, k, n}, context));
144 auto maps = ArrayAttr::get(context, {mapA, mapB, mapC});
145 return indexingMaps == maps;
149 if (indexingMaps.size() != 3)
151 AffineMap map0 = cast<AffineMapAttr>(indexingMaps[0]).getValue();
152 AffineMap map1 = cast<AffineMapAttr>(indexingMaps[1]).getValue();
153 AffineMap map2 = cast<AffineMapAttr>(indexingMaps[2]).getValue();
165 auto mapA = AffineMapAttr::get(
AffineMap::get(2, 0, {n, k}, context));
166 auto mapB = AffineMapAttr::get(
AffineMap::get(2, 0, {k}, context));
167 auto mapC = AffineMapAttr::get(
AffineMap::get(2, 0, {n}, context));
168 auto maps = ArrayAttr::get(context, {mapA, mapB, mapC});
169 return indexingMaps == maps;
173 if (indexingMaps.size() != 3)
175 AffineMap map0 = cast<AffineMapAttr>(indexingMaps[0]).getValue();
176 AffineMap map1 = cast<AffineMapAttr>(indexingMaps[1]).getValue();
177 AffineMap map2 = cast<AffineMapAttr>(indexingMaps[2]).getValue();
190 auto mapA = AffineMapAttr::get(
AffineMap::get(3, 0, {
b, n, k}, context));
193 auto maps = ArrayAttr::get(context, {mapA, mapB, mapC});
194 return indexingMaps == maps;
204 b.cloneRegionBefore(r, *newRegion, newRegion->
begin(), bvm);
206 return b.create(state);
214 for (
size_t cnt = 0, e = op->
getNumRegions(); cnt < e; ++cnt)
216 return b.create(state);
222 elidedAttrsSet.insert_range(elidedAttrs);
225 if (elidedAttrsSet.count(attr.getName()))
227 attrs.push_back(attr);
Base type for affine expression.
MLIRContext * getContext() const
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.
ArrayRef< NamedAttribute > getAttrs()
Return all of the attributes on this operation.
unsigned getNumRegions()
Returns the number of regions held by this operation.
Location getLoc()
The source location the operation was defined or derived from.
OperationName getName()
The name of an operation is the key identifier for it.
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.
Region * addRegion()
Create a region that should be attached to the operation.