14#include "mlir/Interfaces/IndexingMapOpInterface.cpp.inc"
17LogicalResult mlir::IndexingMapOpInterface::verifyImpl() {
19 if (
static_cast<int64_t>(getIndexingMapsArray().size()) !=
20 getOperation()->getNumOperands())
21 return this->
emitOpError(
"expected the number of indexing_map (")
22 << getIndexingMapsArray().size()
23 <<
") to be equal to the number of input/output operands ("
24 << getOperation()->getNumOperands() <<
")";
28 for (
OpOperand &opOperand : getOperation()->getOpOperands()) {
29 AffineMap indexingMap = getMatchingIndexingMap(&opOperand);
35 return this->
emitOpError(
"unexpected symbols in indexing_map #")
36 << opOperand.getOperandNumber();
41 << opOperand.getOperandNumber() <<
" rank (" << rank
42 <<
") to match the result rank of indexing_map ("
45 llvm::append_range(allShapesSizes,
shape);
48 AffineMap invertedMap = getShapesToLoopsMap();
51 llvm::raw_string_ostream os(str);
52 getLoopsToShapesMap().print(os);
53 return this->
emitOpError(
"invalid indexing maps are non-invertible: ")
63 if (llvm::none_of(endLoopRangeValues, ShapedType::isDynamic)) {
65 for (
int64_t &range : endLoopRangeValues)
67 for (
OpOperand &opOperand : getOperation()->getOpOperands()) {
68 AffineMap indexingMap = getMatchingIndexingMap(&opOperand);
70 indexingMap.
compose(startLoopRangeValues);
73 for (
auto dim : llvm::seq<int64_t>(0,
shape.size())) {
75 if (ShapedType::isDynamic(
shape[dim]) ||
shape[dim] == 0)
89 std::max(startIndices[dim], endIndices[dim]) + 1;
90 if (std::min(startIndices[dim], endIndices[dim]) < 0) {
93 llvm::raw_string_ostream os(mapStr);
97 "unexpected result less than 0 at expression #")
98 << dim <<
" in " << mapStr;
100 if (isa<AffineDimExpr>(indexingMap.
getResult(dim))) {
101 if (inferredDimSize !=
shape[dim]) {
102 return this->
emitOpError(
"inferred input/output operand #")
103 << opOperand.getOperandNumber() <<
" has shape's dimension #"
104 << dim <<
" to be " << inferredDimSize <<
", but found "
108 if (inferredDimSize >
shape[dim]) {
109 return this->
emitOpError(
"inferred input/output operand #")
110 << opOperand.getOperandNumber() <<
" has shape's dimension #"
111 << dim <<
" to be greater than or equal to "
112 << inferredDimSize <<
", but found " <<
shape[dim];
p<< " : "<< getMemRefType()<< ", "<< getType();}static LogicalResult verifyVectorMemoryOp(Operation *op, MemRefType memrefType, VectorType vectorType) { if(memrefType.getElementType() !=vectorType.getElementType()) return op-> emitOpError("requires memref and vector types of the same elemental type")
Given a list of lists of parsed operands, populates uniqueOperands with unique operands.
A multi-dimensional affine map Affine map's are immutable like Type's, and they are uniqued.
unsigned getNumSymbols() const
unsigned getNumResults() const
AffineExpr getResult(unsigned idx) const
AffineMap compose(AffineMap map) const
Returns the AffineMap resulting from composing this with map.
This class represents an operand of an operation.
Include the generated interface declarations.