[Mlir-commits] [mlir] [MLIR][Vector] Add unrolling support for bitcast, interleave, and deinterleave ops (PR #194513)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Tue Apr 28 04:56:05 PDT 2026
================
@@ -1389,6 +1389,222 @@ struct UnrollShapeCastPattern : public OpRewritePattern<vector::ShapeCastOp> {
vector::UnrollVectorOptions options;
};
+// Unroll vector::BitCastOp into smaller tile-based bitcast operations.
+// Tiles the result vector into target shape chunks and bitcasts corresponding
+// source slices, accounting for element bitwidth ratios.
+// Example: bitcast v8f32 to v16f16 with target shape [4] unrolls into
+// multiple bitcast operations on 4-element tiles.
+struct UnrollBitCastPattern : public OpRewritePattern<vector::BitCastOp> {
+ UnrollBitCastPattern(MLIRContext *context,
+ const vector::UnrollVectorOptions &options,
+ PatternBenefit benefit = 1)
+ : OpRewritePattern<vector::BitCastOp>(context, benefit),
+ options(options) {}
+
+ LogicalResult matchAndRewrite(vector::BitCastOp bitCastOp,
+ PatternRewriter &rewriter) const override {
+ auto targetShape = getTargetShape(options, bitCastOp);
+ if (!targetShape)
+ return failure();
----------------
banach-space wrote:
Could you replace this with notifyMatchFailure? Btw, when could this fail?
https://github.com/llvm/llvm-project/pull/194513
More information about the Mlir-commits
mailing list