20 #define DEBUG_TYPE "vector-bitcast-lowering"
47 UnrollBitCastOp(int64_t targetRank,
MLIRContext *context,
51 LogicalResult matchAndRewrite(vector::BitCastOp op,
53 VectorType resultType = op.getResultVectorType();
58 auto unrollRank = unrollIterator->getRank();
61 resultType.getScalableDims().drop_front(unrollRank);
68 for (
auto position : *unrollIterator) {
70 rewriter.
create<vector::ExtractOp>(loc, op.getSource(), position);
72 rewriter.
create<vector::BitCastOp>(loc, bitcastResType, extract);
74 rewriter.
create<vector::InsertOp>(loc, bitcast, result, position);
82 int64_t targetRank = 1;
89 patterns.
add<UnrollBitCastOp>(targetRank, patterns.
getContext(), benefit);
TypedAttr getZeroAttr(Type type)
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
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.
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...
void populateVectorBitCastLoweringPatterns(RewritePatternSet &patterns, int64_t targetRank=1, PatternBenefit benefit=1)
Populates the pattern set with the following patterns:
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.
Include the generated interface declarations.
auto get(MLIRContext *context, Ts &&...params)
Helper method that injects context only if needed, this helps unify some of the attribute constructio...
OpRewritePattern is a wrapper around RewritePattern that allows for matching and rewriting against an...