MLIR: lib/Dialect/Utils/StructuredOpsUtils.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

14 #include "llvm/ADT/StringSet.h"

15

16 #include "mlir/Dialect/Utils/DialectUtilsEnums.cpp.inc"

17

18 using namespace mlir;

19

21 if (indexingMaps.size() != 3)

22 return false;

23

24 AffineMap map0 = cast(indexingMaps[0]).getValue();

25 AffineMap map1 = cast(indexingMaps[1]).getValue();

26 AffineMap map2 = cast(indexingMaps[2]).getValue();

27

31 return false;

32 }

33

34

38 auto *context = indexingMaps.getContext();

42 auto maps = ArrayAttr::get(context, {mapA, mapB, mapC});

43 return indexingMaps == maps;

44 }

45

47 if (indexingMaps.size() != 3)

48 return false;

49

50 AffineMap map0 = cast(indexingMaps[0]).getValue();

51 AffineMap map1 = cast(indexingMaps[1]).getValue();

52 AffineMap map2 = cast(indexingMaps[2]).getValue();

53

57 return false;

58 }

59

60

64 auto *context = indexingMaps.getContext();

68 auto maps = ArrayAttr::get(context, {mapA, mapB, mapC});

69 return indexingMaps == maps;

70 }

71

73 if (indexingMaps.size() != 3)

74 return false;

75

76 AffineMap map0 = cast(indexingMaps[0]).getValue();

77 AffineMap map1 = cast(indexingMaps[1]).getValue();

78 AffineMap map2 = cast(indexingMaps[2]).getValue();

79

83 return false;

84 }

85

86

91 auto *context = indexingMaps.getContext();

95 auto maps = ArrayAttr::get(context, {mapA, mapB, mapC});

96 return indexingMaps == maps;

97 }

98

100 if (indexingMaps.size() != 3)

101 return false;

102 AffineMap map0 = cast(indexingMaps[0]).getValue();

103 AffineMap map1 = cast(indexingMaps[1]).getValue();

104 AffineMap map2 = cast(indexingMaps[2]).getValue();

105

109 return false;

110 }

111

112

115 auto *context = indexingMaps.getContext();

119 auto maps = ArrayAttr::get(context, {mapA, mapB, mapC});

120 return indexingMaps == maps;

121 }

122

124 if (indexingMaps.size() != 3)

125 return false;

126 AffineMap map0 = cast(indexingMaps[0]).getValue();

127 AffineMap map1 = cast(indexingMaps[1]).getValue();

128 AffineMap map2 = cast(indexingMaps[2]).getValue();

129

133 return false;

134 }

135

136

140 auto *context = indexingMaps.getContext();

144 auto maps = ArrayAttr::get(context, {mapA, mapB, mapC});

145 return indexingMaps == maps;

146 }

147

149 if (indexingMaps.size() != 3)

150 return false;

151 AffineMap map0 = cast(indexingMaps[0]).getValue();

152 AffineMap map1 = cast(indexingMaps[1]).getValue();

153 AffineMap map2 = cast(indexingMaps[2]).getValue();

154

158 return false;

159 }

160

161

164 auto *context = indexingMaps.getContext();

168 auto maps = ArrayAttr::get(context, {mapA, mapB, mapC});

169 return indexingMaps == maps;

170 }

171

173 if (indexingMaps.size() != 3)

174 return false;

175 AffineMap map0 = cast(indexingMaps[0]).getValue();

176 AffineMap map1 = cast(indexingMaps[1]).getValue();

177 AffineMap map2 = cast(indexingMaps[2]).getValue();

178

182 return false;

183 }

184

185

189 auto *context = indexingMaps.getContext();

193 auto maps = ArrayAttr::get(context, {mapA, mapB, mapC});

194 return indexingMaps == maps;

195 }

196

203 Region *newRegion = state.addRegion();

205 }

206 return b.create(state);

207 }

208

214 for (size_t cnt = 0, e = op->getNumRegions(); cnt < e; ++cnt)

215 state.addRegion();

216 return b.create(state);

217 }

218

222 elidedAttrsSet.insert_range(elidedAttrs);

224 for (auto attr : op->getAttrs()) {

225 if (elidedAttrsSet.count(attr.getName()))

226 continue;

227 attrs.push_back(attr);

228 }

229 return attrs;

230 }

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.

void cloneRegionBefore(Region &region, Region &parent, Region::iterator before, IRMapping &mapping)

Clone the blocks that belong to "region" before the given position in another region "parent".

Operation * create(const OperationState &state)

Creates an operation given the fields represented as an OperationState.

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.

ArrayRef< NamedAttribute > getAttrs()

Return all of the attributes on this operation.

MutableArrayRef< Region > getRegions()

Returns the regions held by this operation.

OperationName getName()

The name of an operation is the key identifier for it.

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)

auto get(MLIRContext *context, Ts &&...params)

Helper method that injects context only if needed, this helps unify some of the attribute constructio...

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.