20 #define DEBUG_TYPE "vector-interleave-lowering"
50 UnrollInterleaveOp(int64_t targetRank,
MLIRContext *context,
56 VectorType resultType = op.getResultVectorType();
64 for (
auto position : *unrollIterator) {
65 Value extractLhs = rewriter.
create<ExtractOp>(loc, op.getLhs(), position);
66 Value extractRhs = rewriter.
create<ExtractOp>(loc, op.getRhs(), position);
68 rewriter.
create<InterleaveOp>(loc, extractLhs, extractRhs);
69 result = rewriter.
create<InsertOp>(loc, interleave, result, position);
77 int64_t targetRank = 1;
84 patterns.
add<UnrollInterleaveOp>(targetRank, patterns.
getContext(), benefit);
TypedAttr getZeroAttr(Type type)
MLIRContext is the top-level object for a collection of MLIR operations.
Operation * create(const OperationState &state)
Creates an operation given the fields represented as an OperationState.
Location getLoc()
The source location the operation was defined or derived from.
This class represents the benefit of a pattern match in a unitless scheme that ranges from 0 (very li...
A special type of RewriterBase that coordinates the application of a rewrite pattern on the current I...
MLIRContext * getContext() const
RewritePatternSet & add(ConstructorArg &&arg, ConstructorArgs &&...args)
Add an instance of each of the pattern types 'Ts' to the pattern list with the given arguments.
virtual void replaceOp(Operation *op, ValueRange newValues)
Replace the results of the given (original) operation with the specified list of values (replacements...
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
std::optional< StaticTileOffsetRange > createUnrollIterator(VectorType vType, int64_t targetRank=1)
Returns an iterator for all positions in the leading dimensions of vType up to the targetRank.
void populateVectorInterleaveLoweringPatterns(RewritePatternSet &patterns, int64_t targetRank=1, PatternBenefit benefit=1)
Populate the pattern set with the following patterns:
Include the generated interface declarations.
LogicalResult failure(bool isFailure=true)
Utility function to generate a LogicalResult.
LogicalResult success(bool isSuccess=true)
Utility function to generate a LogicalResult.
This class represents an efficient way to signal success or failure.
OpRewritePattern is a wrapper around RewritePattern that allows for matching and rewriting against an...