14 #ifndef MLIR_DIALECT_AFFINE_IR_AFFINEOPS_H
15 #define MLIR_DIALECT_AFFINE_IR_AFFINEOPS_H
103 :
public Op<AffineDmaStartOp, OpTrait::MemRefsNormalizable,
104 OpTrait::VariadicOperands, OpTrait::ZeroResults,
105 OpTrait::OpInvariants, AffineMapAccessInterface::Trait,
106 MemoryEffectOpInterface::Trait> {
115 Value stride =
nullptr,
Value elementsPerStride =
nullptr);
122 Value stride =
nullptr,
Value elementsPerStride =
nullptr);
130 Value elementsPerStride =
nullptr);
150 return cast<AffineMapAttr>(
193 return cast<AffineMapAttr>(
226 return cast<AffineMapAttr>(
253 "DmaStartOp expected source, destination or tag memref");
295 return getNumOperands() !=
303 return getOperand(getNumOperands() - 1 - 1);
310 return getOperand(getNumOperands() - 1);
328 :
public Op<AffineDmaWaitOp, OpTrait::MemRefsNormalizable,
329 OpTrait::VariadicOperands, OpTrait::ZeroResults,
330 OpTrait::OpInvariants, AffineMapAccessInterface::Trait> {
356 return cast<AffineMapAttr>(
362 return {operand_begin() + 1,
435 bool composeAffineMin =
false);
438 bool composeAffineMin =
false);
448 bool composeAffineMin =
false);
453 bool composeAffineMin =
false);
459 bool composeAffineMin =
false);
489 bool composeAffineMin =
false);
494 #include "mlir/Dialect/Affine/IR/AffineOpsDialect.h.inc"
496 #define GET_OP_CLASSES
497 #include "mlir/Dialect/Affine/IR/AffineOps.h.inc"
524 SmallVectorImpl<Value> *ivs);
529 SmallVectorImpl<Value> &ivs);
537 ArrayRef<int64_t> lbs, ArrayRef<int64_t> ubs,
538 ArrayRef<int64_t> steps,
540 bodyBuilderFn =
nullptr);
542 ValueRange ubs, ArrayRef<int64_t> steps,
544 bodyBuilderFn =
nullptr);
576 : op(op), operands(operands), map(map) {}
Base type for affine expression.
A multi-dimensional affine map Affine map's are immutable like Type's, and they are uniqued.
unsigned getNumInputs() const
ImplicitLocOpBuilder maintains a 'current location', allowing use of the create<> method without spec...
An integer set representing a conjunction of one or more affine equalities and inequalities.
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
NamedAttribute represents a combination of a name and an Attribute value.
The OpAsmParser has methods for interacting with the asm parser: parsing things from it,...
This is a pure-virtual base class that exposes the asmprinter hooks necessary to implement a custom p...
This class helps build Operations.
This class represents a single result from folding an operation.
This class represents an operand of an operation.
MLIRContext * getContext()
Return the context this operation belongs to.
This provides public APIs that all operations should have.
Operation * getOperation()
Inherit getOperation from OpState.
Op()
This is a public constructor. Any op can be initialized to null.
This class implements the operand iterators for the Operation class.
unsigned getBeginOperandIndex() const
Return the operand index of the first element of this range.
OpOperand & getOpOperand(unsigned idx)
This class contains a list of basic blocks and a link to the parent operation it is attached to.
This class represents a specific instance of an effect.
This class provides an abstraction over the different types of ranges over Values.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
AffineBound represents a lower or upper bound in the for operation.
Value getOperand(unsigned idx)
operand_iterator operandBegin()
AffineForOp::operand_iterator operand_iterator
AffineForOp::operand_range operand_range
AffineForOp getAffineForOp()
operand_range getOperands()
unsigned getNumOperands()
operand_iterator operandEnd()
AffineDmaStartOp starts a non-blocking DMA operation that transfers data from a source memref to a de...
Value getTagMemRef()
Returns the Tag MemRef for this DMA operation.
bool isSrcMemorySpaceFaster()
Returns true if this is a DMA from a slower memory space to a faster one.
void getEffects(SmallVectorImpl< SideEffects::EffectInstance< MemoryEffects::Effect >> &effects)
bool isDestMemorySpaceFaster()
Returns true if this is a DMA from a faster memory space to a slower one.
unsigned getFasterMemPos()
Given a DMA start operation, returns the operand position of either the source or destination memref ...
unsigned getTagMemRefRank()
Returns the rank (number of indices) of the tag MemRefType.
static void build(OpBuilder &builder, OperationState &result, Value srcMemRef, AffineMap srcMap, ValueRange srcIndices, Value destMemRef, AffineMap dstMap, ValueRange destIndices, Value tagMemRef, AffineMap tagMap, ValueRange tagIndices, Value numElements, Value stride=nullptr, Value elementsPerStride=nullptr)
operand_range getDstIndices()
Returns the destination memref indices for this DMA operation.
Value getNumElementsPerStride()
Returns the number of elements to transfer per stride for this DMA op.
unsigned getSrcMemorySpace()
Returns the memory space of the source memref.
AffineMapAttr getTagMapAttr()
unsigned getSrcMemRefRank()
Returns the rank (number of indices) of the source MemRefType.
operand_range getSrcIndices()
Returns the source memref affine map indices for this DMA operation.
AffineMapAttr getSrcMapAttr()
bool isStrided()
Returns true if this DMA operation is strided, returns false otherwise.
AffineMap getDstMap()
Returns the affine map used to access the destination memref.
void print(OpAsmPrinter &p)
Value getDstMemRef()
Returns the destination MemRefType for this DMA operation.
static StringRef getSrcMapAttrStrName()
AffineMapAttr getDstMapAttr()
unsigned getDstMemorySpace()
Returns the memory space of the source memref.
unsigned getSrcMemRefOperandIndex()
Returns the operand index of the source memref.
unsigned getTagMemRefOperandIndex()
Returns the operand index of the tag memref.
static StringRef getTagMapAttrStrName()
LogicalResult verifyInvariantsImpl()
unsigned getDstMemRefRank()
Returns the rank (number of indices) of the destination MemRefType.
LogicalResult verifyInvariants()
MemRefType getSrcMemRefType()
MemRefType getTagMemRefType()
AffineMap getSrcMap()
Returns the affine map used to access the source memref.
Value getNumElements()
Returns the number of elements being transferred by this DMA operation.
OpOperand & getTagMemRefMutable()
OpOperand & getSrcMemRefMutable()
static AffineDmaStartOp create(OpBuilder &builder, Location location, Value srcMemRef, AffineMap srcMap, ValueRange srcIndices, Value destMemRef, AffineMap dstMap, ValueRange destIndices, Value tagMemRef, AffineMap tagMap, ValueRange tagIndices, Value numElements, Value stride=nullptr, Value elementsPerStride=nullptr)
static ArrayRef< StringRef > getAttributeNames()
AffineMap getTagMap()
Returns the affine map used to access the tag memref.
static ParseResult parse(OpAsmParser &parser, OperationState &result)
Value getStride()
Returns the stride value for this DMA operation.
unsigned getDstMemRefOperandIndex()
Returns the operand index of the destination memref.
static StringRef getDstMapAttrStrName()
static StringRef getOperationName()
NamedAttribute getAffineMapAttrForMemRef(Value memref)
Impelements the AffineMapAccessInterface.
Value getSrcMemRef()
Returns the source MemRefType for this DMA operation.
operand_range getTagIndices()
Returns the tag memref indices for this DMA operation.
MemRefType getDstMemRefType()
LogicalResult fold(ArrayRef< Attribute > cstOperands, SmallVectorImpl< OpFoldResult > &results)
OpOperand & getDstMemRefMutable()
AffineDmaWaitOp blocks until the completion of a DMA operation associated with the tag element 'tag[i...
Value getNumElements()
Returns the number of elements transferred by the associated DMA op.
NamedAttribute getAffineMapAttrForMemRef(Value memref)
Impelements the AffineMapAccessInterface.
LogicalResult verifyInvariants()
LogicalResult verifyInvariantsImpl()
static StringRef getOperationName()
static ArrayRef< StringRef > getAttributeNames()
Value getTagMemRef()
Returns the Tag MemRef associated with the DMA operation being waited on.
MemRefType getTagMemRefType()
OpOperand & getTagMemRefMutable()
static ParseResult parse(OpAsmParser &parser, OperationState &result)
static StringRef getTagMapAttrStrName()
LogicalResult fold(ArrayRef< Attribute > cstOperands, SmallVectorImpl< OpFoldResult > &results)
AffineMapAttr getTagMapAttr()
void print(OpAsmPrinter &p)
static AffineDmaWaitOp create(OpBuilder &builder, Location location, Value tagMemRef, AffineMap tagMap, ValueRange tagIndices, Value numElements)
AffineMap getTagMap()
Returns the affine map used to access the tag memref.
unsigned getTagMemRefRank()
Returns the rank (number of indices) of the tag memref.
static void build(OpBuilder &builder, OperationState &result, Value tagMemRef, AffineMap tagMap, ValueRange tagIndices, Value numElements)
operand_range getTagIndices()
Returns the tag memref index for this DMA operation.
void getEffects(SmallVectorImpl< SideEffects::EffectInstance< MemoryEffects::Effect >> &effects)
void buildAffineLoopNest(OpBuilder &builder, Location loc, ArrayRef< int64_t > lbs, ArrayRef< int64_t > ubs, ArrayRef< int64_t > steps, function_ref< void(OpBuilder &, Location, ValueRange)> bodyBuilderFn=nullptr)
Builds a perfect nest of affine.for loops, i.e., each loop except the innermost one contains only ano...
AffineApplyOp makeComposedAffineApply(OpBuilder &b, Location loc, AffineMap map, ArrayRef< OpFoldResult > operands, bool composeAffineMin=false)
Returns a composed AffineApplyOp by composing map and operands with other AffineApplyOps supplying th...
void extractForInductionVars(ArrayRef< AffineForOp > forInsts, SmallVectorImpl< Value > *ivs)
Extracts the induction variables from a list of AffineForOps and places them in the output argument i...
bool isValidDim(Value value)
Returns true if the given Value can be used as a dimension id in the region of the closest surroundin...
bool isAffineInductionVar(Value val)
Returns true if the provided value is the induction variable of an AffineForOp or AffineParallelOp.
SmallVector< OpFoldResult > makeComposedFoldedMultiResultAffineApply(OpBuilder &b, Location loc, AffineMap map, ArrayRef< OpFoldResult > operands, bool composeAffineMin=false)
Variant of makeComposedFoldedAffineApply suitable for multi-result maps.
OpFoldResult computeProduct(Location loc, OpBuilder &builder, ArrayRef< OpFoldResult > terms)
Return the product of terms, creating an affine.apply if any of them are non-constant values.
AffineForOp getForInductionVarOwner(Value val)
Returns the loop parent of an induction variable.
void canonicalizeMapAndOperands(AffineMap *map, SmallVectorImpl< Value > *operands)
Modifies both map and operands in-place so as to:
OpFoldResult makeComposedFoldedAffineMax(OpBuilder &b, Location loc, AffineMap map, ArrayRef< OpFoldResult > operands)
Constructs an AffineMinOp that computes a maximum across the results of applying map to operands,...
bool isAffineForInductionVar(Value val)
Returns true if the provided value is the induction variable of an AffineForOp.
OpFoldResult makeComposedFoldedAffineApply(OpBuilder &b, Location loc, AffineMap map, ArrayRef< OpFoldResult > operands, bool composeAffineMin=false)
Constructs an AffineApplyOp that applies map to operands after composing the map with the maps of any...
OpFoldResult makeComposedFoldedAffineMin(OpBuilder &b, Location loc, AffineMap map, ArrayRef< OpFoldResult > operands)
Constructs an AffineMinOp that computes a minimum across the results of applying map to operands,...
bool isTopLevelValue(Value value)
A utility function to check if a value is defined at the top level of an op with trait AffineScope or...
Region * getAffineAnalysisScope(Operation *op)
Returns the closest region enclosing op that is held by a non-affine operation; nullptr if there is n...
void fullyComposeAffineMapAndOperands(AffineMap *map, SmallVectorImpl< Value > *operands, bool composeAffineMin=false)
Given an affine map map and its input operands, this method composes into map, maps of AffineApplyOps...
void canonicalizeSetAndOperands(IntegerSet *set, SmallVectorImpl< Value > *operands)
Canonicalizes an integer set the same way canonicalizeMapAndOperands does for affine maps.
void extractInductionVars(ArrayRef< Operation * > affineOps, SmallVectorImpl< Value > &ivs)
Extracts the induction variables from a list of either AffineForOp or AffineParallelOp and places the...
bool isValidSymbol(Value value)
Returns true if the given value can be used as a symbol in the region of the closest surrounding op t...
AffineParallelOp getAffineParallelInductionVarOwner(Value val)
Returns true if the provided value is among the induction variables of an AffineParallelOp.
Region * getAffineScope(Operation *op)
Returns the closest region enclosing op that is held by an operation with trait AffineScope; nullptr ...
ParseResult parseDimAndSymbolList(OpAsmParser &parser, SmallVectorImpl< Value > &operands, unsigned &numDims)
Parses dimension and symbol list.
bool isAffineParallelInductionVar(Value val)
Returns true if val is the induction variable of an AffineParallelOp.
AffineMinOp makeComposedAffineMin(OpBuilder &b, Location loc, AffineMap map, ArrayRef< OpFoldResult > operands)
Returns an AffineMinOp obtained by composing map and operands with AffineApplyOps supplying those ope...
Include the generated interface declarations.
llvm::function_ref< Fn > function_ref
Type getType(OpFoldResult ofr)
Returns the int type of the integer in ofr.
auto get(MLIRContext *context, Ts &&...params)
Helper method that injects context only if needed, this helps unify some of the attribute constructio...
This represents an operation in an abstracted form, suitable for use with the builder APIs.