13#ifndef MLIR_INTERFACES_VIEWLIKEINTERFACE_H_
14#define MLIR_INTERFACES_VIEWLIKEINTERFACE_H_
25class OffsetSizeAndStrideOpInterface;
32 OffsetSizeAndStrideOpInterface a, OffsetSizeAndStrideOpInterface
b,
33 llvm::function_ref<
bool(OpFoldResult, OpFoldResult)> cmp);
44#include "mlir/Interfaces/ViewLikeInterface.h.inc"
64 bool generateErrorMessage =
false);
68 bool generateErrorMessage =
false);
79template <
typename OpType,
typename ResultTypeFn,
typename CastOpFunc>
99 cast<ShapedType>(op.getSource().getType()).getShape(), mixedOffsets,
100 mixedSizes, mixedStrides);
106 ResultTypeFn()(op, mixedOffsets, mixedSizes, mixedStrides);
112 OpType::create(rewriter, op.getLoc(), resultType, op.getSource(),
113 mixedOffsets, mixedSizes, mixedStrides);
114 CastOpFunc()(rewriter, op, newOp);
165 OpAsmPrinter &printer, Operation *op, OperandRange values,
166 ArrayRef<int64_t> integers, ArrayRef<bool> scalableFlags,
174 {}, valueTypes, delimiter);
212 SmallVectorImpl<OpAsmParser::UnresolvedOperand> &values,
214 SmallVectorImpl<Type> *valueTypes =
nullptr,
223 valueTypes, delimiter);
229 unsigned expectedNumElements,
230 ArrayRef<int64_t> attr,
244template <
typename ConcreteType>
246 :
public TraitBase<ConcreteType, DistinctObjectsTrait> {};
Delimiter
These are the supported delimiters around operand lists and region argument lists,...
@ Square
Square brackets surrounding zero or more operands.
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 trai indicates that pointer-like objects (such as memrefs) returned from this operation will nev...
Helper class for implementing traits.
Pattern to rewrite dynamic offsets/sizes/strides of view/slice-like ops as constant arguments.
LogicalResult matchAndRewrite(OpType op, PatternRewriter &rewriter) const override
This class implements the operand iterators for the Operation class.
Operation is the basic unit of execution within MLIR.
A special type of RewriterBase that coordinates the application of a rewrite pattern on the current I...
This class provides an abstraction over the various different ranges of value types.
bool sameOffsetsSizesAndStrides(OffsetSizeAndStrideOpInterface a, OffsetSizeAndStrideOpInterface b, llvm::function_ref< bool(OpFoldResult, OpFoldResult)> cmp)
unsigned getNumDynamicEntriesUpToIdx(ArrayRef< int64_t > staticVals, unsigned idx)
Helper method to compute the number of dynamic entries of staticVals, up to idx.
LogicalResult verifyOffsetSizeAndStrideOp(OffsetSizeAndStrideOpInterface op)
Include the generated interface declarations.
detail::DenseArrayAttrImpl< int64_t > DenseI64ArrayAttr
ParseResult parseDynamicIndexList(OpAsmParser &parser, SmallVectorImpl< OpAsmParser::UnresolvedOperand > &values, DenseI64ArrayAttr &integers, DenseBoolArrayAttr &scalableFlags, SmallVectorImpl< Type > *valueTypes=nullptr, AsmParser::Delimiter delimiter=AsmParser::Delimiter::Square)
Parser hooks for custom directive in assemblyFormat.
SliceBoundsVerificationResult verifyInBoundsSlice(ArrayRef< int64_t > shape, ArrayRef< int64_t > staticOffsets, ArrayRef< int64_t > staticSizes, ArrayRef< int64_t > staticStrides, bool generateErrorMessage=false)
Verify that the offsets/sizes/strides-style access into the given shape is in-bounds.
detail::DenseArrayAttrImpl< bool > DenseBoolArrayAttr
LogicalResult verifyListOfOperandsOrIntegers(Operation *op, StringRef name, unsigned expectedNumElements, ArrayRef< int64_t > attr, ValueRange values)
Verify that a the values has as many elements as the number of entries in attr for which isDynamic ev...
void printDynamicIndexList(OpAsmPrinter &printer, Operation *op, OperandRange values, ArrayRef< int64_t > integers, ArrayRef< bool > scalableFlags, TypeRange valueTypes=TypeRange(), AsmParser::Delimiter delimiter=AsmParser::Delimiter::Square)
Printer hooks for custom directive in assemblyFormat.
LogicalResult foldDynamicIndexList(SmallVectorImpl< OpFoldResult > &ofrs, bool onlyNonNegative=false, bool onlyNonZero=false)
Returns "success" when any of the elements in ofrs is a constant value.
OpRewritePattern(MLIRContext *context, PatternBenefit benefit=1, ArrayRef< StringRef > generatedNames={})
Result for slice bounds verification;.
bool isValid
If set to "true", the slice bounds verification was successful.
std::string errorMessage
An error message that can be printed during op verification.