14 #ifndef MLIR_DIALECT_AFFINE_IR_AFFINEOPS_H 15 #define MLIR_DIALECT_AFFINE_IR_AFFINEOPS_H 90 :
public Op<AffineDmaStartOp, OpTrait::MemRefsNormalizable,
91 OpTrait::VariadicOperands, OpTrait::ZeroResults,
92 OpTrait::OpInvariants, AffineMapAccessInterface::Trait> {
101 Value stride =
nullptr,
Value elementsPerStride =
nullptr);
212 "DmaStartOp expected source, destination or tag memref");
250 return getNumOperands() !=
258 return getOperand(getNumOperands() - 1 - 1);
265 return getOperand(getNumOperands() - 1);
283 :
public Op<AffineDmaWaitOp, OpTrait::MemRefsNormalizable,
284 OpTrait::VariadicOperands, OpTrait::ZeroResults,
285 OpTrait::OpInvariants, AffineMapAccessInterface::Trait> {
309 return {operand_begin() + 1,
397 #include "mlir/Dialect/Affine/IR/AffineOpsDialect.h.inc" 399 #define GET_OP_CLASSES 400 #include "mlir/Dialect/Affine/IR/AffineOps.h.inc" 414 SmallVectorImpl<Value> *ivs);
422 ArrayRef<int64_t> lbs, ArrayRef<int64_t> ubs,
423 ArrayRef<int64_t> steps,
425 bodyBuilderFn =
nullptr);
427 ValueRange ubs, ArrayRef<int64_t> steps,
429 bodyBuilderFn =
nullptr);
440 ValueRange newIterOperands,
441 ValueRange newYieldedValues,
442 ValueRange newIterArgs,
443 bool replaceLoopResults =
true);
469 unsigned opStart, opEnd;
474 : op(op), opStart(opStart), opEnd(opEnd), map(map) {}
476 friend class AffineForOp;
TODO: Remove this file when SCCP and integer range analysis have been ported to the new framework...
bool isStrided()
Returns true if this DMA operation is strided, returns false otherwise.
This class contains a list of basic blocks and a link to the parent operation it is attached to...
llvm::function_ref< Fn > function_ref
ParseResult parseDimAndSymbolList(OpAsmParser &parser, SmallVectorImpl< Value > &operands, unsigned &numDims)
Parses dimension and symbol list.
AffineMapAttr getDstMapAttr()
Value getOperand(unsigned idx)
AffineForOp getAffineForOp()
unsigned getFasterMemPos()
Given a DMA start operation, returns the operand position of either the source or destination memref ...
operand_range getDstIndices()
Returns the destination memref indices for this DMA operation.
MLIRContext * getContext()
Return the context this operation belongs to.
NamedAttribute getAffineMapAttrForMemRef(Value memref)
Impelements the AffineMapAccessInterface.
static StringRef getOperationName()
AffineApplyOp makeComposedAffineApply(OpBuilder &b, Location loc, AffineMap map, ValueRange operands)
Returns a composed AffineApplyOp by composing map and operands with other AffineApplyOps supplying th...
operand_range getTagIndices()
Returns the tag memref indices for this DMA operation.
The OpAsmParser has methods for interacting with the asm parser: parsing things from it...
MemRefType getTagMemRefType()
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...
static constexpr const bool value
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
LogicalResult verifyInvariantsImpl()
NamedAttribute represents a combination of a name and an Attribute value.
NamedAttribute getAffineMapAttrForMemRef(Value memref)
Impelements the AffineMapAccessInterface.
unsigned getNumInputs() const
Value getNumElementsPerStride()
Returns the number of elements to transfer per stride for this DMA op.
AffineForOp::operand_iterator operand_iterator
unsigned getDstMemRefRank()
Returns the rank (number of indices) of the destination MemRefType.
Value getTagMemRef()
Returns the Tag MemRef associated with the DMA operation being waited on.
Value getNumElements()
Returns the number of elements transferred by the associated DMA op.
This class represents an efficient way to signal success or failure.
AffineForOp::operand_range operand_range
LogicalResult verifyInvariants()
bool isValidDim(Value value)
Returns true if the given Value can be used as a dimension id in the region of the closest surroundin...
static ArrayRef< StringRef > getAttributeNames()
unsigned getNumOperands()
bool isDestMemorySpaceFaster()
Returns true if this is a DMA from a faster memory space to a slower one.
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...
operand_range getTagIndices()
Returns the tag memref index for this DMA operation.
unsigned getSrcMemRefOperandIndex()
Returns the operand index of the source memref.
Value getNumElements()
Returns the number of elements being transferred by this DMA operation.
void fullyComposeAffineMapAndOperands(AffineMap *map, SmallVectorImpl< Value > *operands)
Given an affine map map and its input operands, this method composes into map, maps of AffineApplyOps...
MemRefType getSrcMemRefType()
Base type for affine expression.
void canonicalizeMapAndOperands(AffineMap *map, SmallVectorImpl< Value > *operands)
Modifies both map and operands in-place so as to:
void print(OpAsmPrinter &p)
LogicalResult verifyInvariants()
void canonicalizeSetAndOperands(IntegerSet *set, SmallVectorImpl< Value > *operands)
Canonicalizes an integer set the same way canonicalizeMapAndOperands does for affine maps...
SmallVector< Value, 4 > applyMapToValues(OpBuilder &b, Location loc, AffineMap map, ValueRange values)
Returns the values obtained by applying map to the list of values.
This is a pure-virtual base class that exposes the asmprinter hooks necessary to implement a custom p...
static StringRef getTagMapAttrStrName()
unsigned getSrcMemorySpace()
Returns the memory space of the source memref.
This represents an operation in an abstracted form, suitable for use with the builder APIs...
AffineMapAttr getTagMapAttr()
A multi-dimensional affine map Affine map's are immutable like Type's, and they are uniqued...
static ArrayRef< StringRef > getAttributeNames()
bool isForInductionVar(Value val)
Returns true if the provided value is the induction variable of a AffineForOp.
AffineDmaWaitOp blocks until the completion of a DMA operation associated with the tag element 'tag[i...
AffineBound represents a lower or upper bound in the for operation.
Value getDstMemRef()
Returns the destination MemRefType for this DMA operation.
Value getSrcMemRef()
Returns the source MemRefType for this DMA operation.
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)
Op()
This is a public constructor. Any op can be initialized to null.
Value getTagMemRef()
Returns the Tag MemRef for this DMA operation.
AffineForOp getForInductionVarOwner(Value val)
Returns the loop parent of an induction variable.
static ParseResult parse(OpAsmParser &parser, OperationState &result)
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
bool isSrcMemorySpaceFaster()
Returns true if this is a DMA from a slower memory space to a faster one.
AffineMap getTagMap()
Returns the affine map used to access the tag memref.
bool isTopLevelValue(Value value)
TODO: These should be renamed if they are on the mlir namespace.
AffineMap getTagMap()
Returns the affine map used to access the tag memref.
Region * getAffineScope(Operation *op)
Returns the closest region enclosing op that is held by an operation with trait AffineScope; nullptr ...
AffineMap getSrcMap()
Returns the affine map used to access the source memref.
MemRefType getDstMemRefType()
Type getType() const
Return the type of this value.
unsigned getSrcMemRefRank()
Returns the rank (number of indices) of the source MemRefType.
unsigned getTagMemRefRank()
Returns the rank (number of indices) of the tag MemRefType.
static StringRef getDstMapAttrStrName()
AffineMap getDstMap()
Returns the affine map used to access the destination memref.
unsigned getTagMemRefOperandIndex()
Returns the operand index of the tag memref.
operand_range getSrcIndices()
Returns the source memref affine map indices for this DMA operation.
AffineForOp replaceForOpWithNewYields(OpBuilder &b, AffineForOp loop, ValueRange newIterOperands, ValueRange newYieldedValues, ValueRange newIterArgs, bool replaceLoopResults=true)
Replace loop with a new loop where newIterOperands are appended with new initialization values and ne...
AffineDmaStartOp starts a non-blocking DMA operation that transfers data from a source memref to a de...
unsigned getDstMemorySpace()
Returns the memory space of the source memref.
AffineMapAttr getTagMapAttr()
unsigned getTagMemRefRank()
Returns the rank (number of indices) of the tag memref.
This provides public APIs that all operations should have.
operand_iterator operandBegin()
static StringRef getSrcMapAttrStrName()
MemRefType getTagMemRefType()
static StringRef getOperationName()
AffineMapAttr getSrcMapAttr()
This class represents success/failure for parsing-like operations that find it important to chain tog...
This class helps build Operations.
This class provides an abstraction over the different types of ranges over Values.
operand_iterator operandEnd()
operand_range getOperands()
unsigned getDstMemRefOperandIndex()
Returns the operand index of the destination memref.
unsigned getMemorySpaceAsInt(Attribute memorySpace)
[deprecated] Returns the memory space in old raw integer representation.
Value getStride()
Returns the stride value for this DMA operation.
LogicalResult fold(ArrayRef< Attribute > cstOperands, SmallVectorImpl< OpFoldResult > &results)
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...
An integer set representing a conjunction of one or more affine equalities and inequalities.
static StringRef getTagMapAttrStrName()