14 #ifndef MLIR_DIALECT_AFFINEOPS_AFFINEOPS_H 15 #define MLIR_DIALECT_AFFINEOPS_AFFINEOPS_H 28 class AffineTerminatorOp;
29 class FlatAffineConstraints;
63 OpTrait::OneResult, OpTrait::HasNoSideEffect> {
73 return getAttrOfType<AffineMapAttr>(
"map").getValue();
138 OpTrait::ZeroResult> {
146 Value stride =
nullptr,
Value elementsPerStride =
nullptr);
154 return getSrcMemRef()->getType().cast<
MemRefType>();
168 return {operand_begin() + getSrcMemRefOperandIndex() + 1,
169 operand_begin() + getSrcMemRefOperandIndex() + 1 +
170 getSrcMap().getNumInputs()};
175 return getSrcMemRef()->getType().cast<
MemRefType>().getMemorySpace();
180 return getSrcMemRefOperandIndex() + 1 + getSrcMap().getNumInputs();
186 return getDstMemRef()->getType().cast<
MemRefType>();
191 return getDstMemRef()->getType().cast<
MemRefType>().getRank();
196 return getDstMemRef()->getType().cast<
MemRefType>().getMemorySpace();
207 return {operand_begin() + getDstMemRefOperandIndex() + 1,
208 operand_begin() + getDstMemRefOperandIndex() + 1 +
209 getDstMap().getNumInputs()};
214 return getDstMemRefOperandIndex() + 1 + getDstMap().getNumInputs();
220 return getTagMemRef()->getType().cast<
MemRefType>();
225 return getTagMemRef()->getType().cast<
MemRefType>().getRank();
236 return {operand_begin() + getTagMemRefOperandIndex() + 1,
237 operand_begin() + getTagMemRefOperandIndex() + 1 +
238 getTagMap().getNumInputs()};
243 return getOperand(getTagMemRefOperandIndex() + 1 +
244 getTagMap().getNumInputs());
249 if (memref == getSrcMemRef())
252 else if (memref == getDstMemRef())
255 assert(memref == getTagMemRef() &&
256 "DmaStartOp expected source, destination or tag memref");
263 return (getSrcMemorySpace() < getDstMemorySpace());
269 return (getDstMemorySpace() < getSrcMemorySpace());
276 assert(isSrcMemorySpaceFaster() || isDestMemorySpaceFaster());
277 return isSrcMemorySpaceFaster() ? 0 : getDstMemRefOperandIndex();
293 return getNumOperands() !=
294 getTagMemRefOperandIndex() + 1 + getTagMap().getNumInputs() + 1;
301 return getOperand(getNumOperands() - 1 - 1);
308 return getOperand(getNumOperands() - 1);
326 OpTrait::ZeroResult> {
338 return getTagMemRef()->getType().cast<
MemRefType>();
349 return {operand_begin() + 1,
350 operand_begin() + 1 + getTagMap().getNumInputs()};
355 return getTagMemRef()->getType().cast<
MemRefType>().getRank();
360 assert(memref == getTagMemRef());
393 OpTrait::AtLeastNOperands<1>::Impl> {
414 return getMemRef()->getType().cast<
MemRefType>();
428 assert(memref == getMemRef());
462 OpTrait::AtLeastNOperands<1>::Impl> {
485 return getMemRef()->getType().cast<
MemRefType>();
499 assert(memref == getMemRef());
552 #define GET_OP_CLASSES 553 #include "mlir/Dialect/AffineOps/AffineOps.h.inc" 565 SmallVectorImpl<Value> *ivs);
594 unsigned opStart, opEnd;
599 : op(op), opStart(opStart), opEnd(opEnd),
map(map) {}
601 friend class AffineForOp;
625 res.append(concatenatedSymbols.begin(), concatenatedSymbols.end());
663 static unsigned &affineApplyDepth() {
664 static thread_local
unsigned depth = 0;
667 static constexpr
unsigned kMaxAffineApplyDepth = 1;
Definition: InferTypeOpInterface.cpp:20
bool isStrided()
Returns true if this DMA operation is strided, returns false otherwise.
Definition: AffineOps.h:292
AffineApplyOp makeComposedAffineApply(OpBuilder &b, Location loc, AffineMap map, ArrayRef< Value > operands)
Definition: AffineOps.cpp:597
Definition: Operation.h:27
AffineMapAttr getDstMapAttr()
Definition: AffineOps.h:201
static StringRef getOperationName()
Definition: AffineOps.h:505
Value getOperand(unsigned idx)
Definition: AffineOps.h:580
AffineMap getAffineMap()
Returns the affine map to be applied by this operation.
Definition: AffineOps.h:72
This class represents a single result from folding an operation.
Definition: OpDefinition.h:251
LogicalResult verify(Operation *op)
Definition: Verifier.cpp:264
AffineForOp getAffineForOp()
Definition: AffineOps.h:573
static Identifier get(StringRef str, MLIRContext *context)
Return an identifier for the specified string.
Definition: MLIRContext.cpp:426
void setMemRef(Value value)
Definition: AffineOps.h:482
AffineMap getAffineMap()
Returns the AffineMap resulting from normalization.
Definition: AffineOps.h:621
unsigned getFasterMemPos()
Definition: AffineOps.h:275
operand_range getDstIndices()
Returns the destination memref indices for this DMA operation.
Definition: AffineOps.h:206
unsigned getNumSymbols()
Definition: AffineOps.h:629
NamedAttribute getAffineMapAttrForMemRef(Value memref)
Returns the AffineMapAttr associated with 'memref'.
Definition: AffineOps.h:248
static StringRef getOperationName()
Definition: AffineOps.h:284
operand_range getTagIndices()
Returns the tag memref indices for this DMA operation.
Definition: AffineOps.h:235
Definition: OpImplementation.h:214
Value getMemRef()
Get memref operand.
Definition: AffineOps.h:411
unsigned getNumDims()
Definition: AffineOps.h:630
operand_iterator operand_end()
Definition: AffineOps.h:586
Definition: AffineOps.h:392
MemRefType getTagMemRefType()
Definition: AffineOps.h:337
void extractForInductionVars(ArrayRef< AffineForOp > forInsts, SmallVectorImpl< Value > *ivs)
Definition: AffineOps.cpp:1582
SmallVector< Value, 8 > getOperands()
Definition: AffineOps.h:623
Definition: Location.h:52
std::pair< Identifier, Attribute > NamedAttribute
Definition: Attributes.h:264
AffineOpsDialect(MLIRContext *context)
Definition: AffineOps.cpp:83
NamedAttribute getAffineMapAttrForMemRef(Value memref)
Returns the AffineMapAttr associated with 'memref'.
Definition: AffineOps.h:359
Value getNumElementsPerStride()
Returns the number of elements to transfer per stride for this DMA op.
Definition: AffineOps.h:305
AffineForOp::operand_iterator operand_iterator
Definition: AffineOps.h:582
unsigned getDstMemRefRank()
Returns the rank (number of indices) of the destination MemRefType.
Definition: AffineOps.h:190
Value getTagMemRef()
Definition: AffineOps.h:336
Value getNumElements()
Returns the number of elements transferred in the associated DMA op.
Definition: AffineOps.h:366
Definition: LogicalResult.h:18
AffineForOp::operand_range operand_range
Definition: AffineOps.h:583
bool isValidDim(Value value)
Returns true if the given Value can be used as a dimension id.
Definition: AffineOps.cpp:118
unsigned getNumOperands()
Definition: AffineOps.h:579
static StringRef getDialectNamespace()
Definition: AffineOps.h:40
bool isStrided(MemRefType t)
Return true if the layout for t is compatible with strided semantics.
Definition: StandardTypes.cpp:734
static StringRef getOperationName()
Definition: AffineOps.h:82
Definition: AffineOps.h:62
Value getValueToStore()
Get value to be stored by store operation.
Definition: AffineOps.h:475
static StringRef getMapAttrName()
Definition: AffineOps.h:504
static StringRef getSrcMapAttrName()
Definition: AffineOps.h:280
bool isDestMemorySpaceFaster()
Returns true if this is a DMA from a faster memory space to a slower one.
Definition: AffineOps.h:262
static StringRef getTagMapAttrName()
Definition: AffineOps.h:282
bool isValidSymbol(Value value)
Returns true if the given Value can be used as a symbol.
Definition: AffineOps.cpp:178
operand_range getTagIndices()
Definition: AffineOps.h:348
unsigned getSrcMemRefOperandIndex()
Returns the operand index of the src memref.
Definition: AffineOps.h:149
Value getNumElements()
Returns the number of elements being transferred by this DMA operation.
Definition: AffineOps.h:242
Definition: Attributes.h:53
static StringRef getTagMapAttrName()
Definition: AffineOps.h:368
auto map(Fn fun, IterType begin, IterType end) -> SmallVector< typename std::result_of< Fn(decltype(*begin))>::type, 8 >
Map with iterators.
Definition: Functional.h:28
void fullyComposeAffineMapAndOperands(AffineMap *map, SmallVectorImpl< Value > *operands)
Definition: AffineOps.cpp:588
unsigned getMemRefOperandIndex()
Returns the operand index of the memref.
Definition: AffineOps.h:478
MemRefType getSrcMemRefType()
Definition: AffineOps.h:153
unsigned getMemRefOperandIndex()
Returns the operand index of the memref.
Definition: AffineOps.h:408
static StringRef getMapAttrName()
Definition: AffineOps.h:433
void canonicalizeMapAndOperands(AffineMap *map, SmallVectorImpl< Value > *operands)
Definition: AffineOps.cpp:730
void canonicalizeSetAndOperands(IntegerSet *set, SmallVectorImpl< Value > *operands)
Definition: AffineOps.cpp:735
Definition: StandardTypes.h:390
Definition: OpImplementation.h:32
unsigned getSrcMemorySpace()
Returns the memory space of the src memref.
Definition: AffineOps.h:174
Definition: OperationSupport.h:261
AffineMapAttr getTagMapAttr()
Definition: AffineOps.h:230
NamedAttribute getAffineMapAttrForMemRef(Value memref)
Returns the AffineMapAttr associated with 'memref'.
Definition: AffineOps.h:427
Definition: AffineMap.h:37
bool isForInductionVar(Value val)
Returns if the provided value is the induction variable of a AffineForOp.
Definition: AffineOps.cpp:1566
Definition: AffineOps.h:325
operand_range getMapOperands()
Definition: AffineOps.h:84
NamedAttribute getAffineMapAttrForMemRef(Value memref)
Returns the AffineMapAttr associated with 'memref'.
Definition: AffineOps.h:498
MLIRContext * getContext() const
Definition: Dialect.h:47
Definition: AffineOps.h:571
Value getDstMemRef()
Returns the destination MemRefType for this DMA operations.
Definition: AffineOps.h:184
Value getSrcMemRef()
Returns the source MemRefType for this DMA operation.
Definition: AffineOps.h:152
Value getMemRef()
Get memref operand.
Definition: AffineOps.h:481
Definition: AffineOps.h:617
Op()
This is a public constructor. Any op can be initialized to null.
Definition: OpDefinition.h:1029
Value getTagMemRef()
Returns the Tag MemRef for this DMA operation.
Definition: AffineOps.h:218
void setMemRef(Value value)
Definition: AffineOps.h:412
~AffineApplyNormalizer()
Definition: AffineOps.h:672
bool isSrcMemorySpaceFaster()
Returns true if this is a DMA from a slower memory space to a faster one.
Definition: AffineOps.h:267
operand_iterator operand_begin()
Definition: AffineOps.h:585
AffineMap getTagMap()
Returns the affine map used to access the tag memref.
Definition: AffineOps.h:342
bool isTopLevelValue(Value value)
Definition: AffineOps.cpp:109
Definition: Attributes.h:175
AffineMap getTagMap()
Returns the affine map used to access the tag memref.
Definition: AffineOps.h:229
AffineMapAttr getAffineMapAttr()
Definition: AffineOps.h:422
AffineMap getSrcMap()
Returns the affine map used to access the src memref.
Definition: AffineOps.h:161
Definition: PatternMatch.h:418
Definition: Builders.h:47
MemRefType getDstMemRefType()
Definition: AffineOps.h:185
AffineMap getMap()
Definition: AffineOps.h:574
unsigned getSrcMemRefRank()
Returns the rank (number of indices) of the source MemRefType.
Definition: AffineOps.h:158
unsigned getTagMemRefRank()
Returns the rank (number of indices) of the tag MemRefType.
Definition: AffineOps.h:224
MemRefType getMemRefType()
Definition: AffineOps.h:484
A dimensional identifier appearing in an affine expression.
Definition: AffineExpr.h:177
Operation * materializeConstant(OpBuilder &builder, Attribute value, Type type, Location loc) override
Definition: AffineOps.cpp:95
static StringRef getDstMapAttrName()
Definition: AffineOps.h:281
operand_range getMapOperands()
Get affine map operands.
Definition: AffineOps.h:489
AffineMap getDstMap()
Returns the affine map used to access the dst memref.
Definition: AffineOps.h:200
unsigned getTagMemRefOperandIndex()
Returns the operand index of the tag memref.
Definition: AffineOps.h:213
Definition: MLIRContext.h:34
void print(OpAsmPrinter &p, AffineIfOp op)
Definition: AffineOps.cpp:1671
operand_range getSrcIndices()
Returns the source memref affine map indices for this DMA operation.
Definition: AffineOps.h:167
Definition: AffineOps.h:137
unsigned getDstMemorySpace()
Returns the memory space of the src memref.
Definition: AffineOps.h:195
static StringRef getOperationName()
Definition: AffineOps.h:434
AffineMapAttr getTagMapAttr()
Definition: AffineOps.h:343
unsigned getTagMemRefRank()
Definition: AffineOps.h:354
This class implements the operand iterators for the Operation class.
Definition: OperationSupport.h:559
Definition: OpDefinition.h:949
Definition: AffineOps.h:37
Definition: AffineStructures.h:112
MemRefType getTagMemRefType()
Definition: AffineOps.h:219
AffineMap getAffineMap()
Returns the affine map used to index the memref for this operation.
Definition: AffineOps.h:421
static StringRef getOperationName()
Definition: AffineOps.h:333
Definition: AffineOps.h:461
AffineMapAttr getSrcMapAttr()
Definition: AffineOps.h:162
Definition: OpDefinition.h:36
AffineMapAttr getAffineMapAttr()
Definition: AffineOps.h:493
Definition: Builders.h:158
MemRefType getMemRefType()
Definition: AffineOps.h:413
Definition: OperationSupport.h:640
operand_range getMapOperands()
Get affine map operands.
Definition: AffineOps.h:418
AffineMap getAffineMap()
Returns the affine map used to index the memref for this operation.
Definition: AffineOps.h:492
operand_range getOperands()
Definition: AffineOps.h:587
unsigned getDstMemRefOperandIndex()
Returns the operand index of the dst memref.
Definition: AffineOps.h:179
Value getStride()
Returns the stride value for this DMA operation.
Definition: AffineOps.h:298
AffineForOp getForInductionVarOwner(Value val)
Definition: AffineOps.cpp:1572
Definition: IntegerSet.h:42