[Mlir-commits] [mlir] [mlir][vector] Add unroll patterns for vector.load and vector.store (PR #143420)
James Newling
llvmlistbot at llvm.org
Fri Jun 20 13:12:04 PDT 2025
================
@@ -631,6 +653,100 @@ struct UnrollGatherPattern : public OpRewritePattern<vector::GatherOp> {
vector::UnrollVectorOptions options;
};
+struct UnrollLoadPattern : public OpRewritePattern<vector::LoadOp> {
+ UnrollLoadPattern(MLIRContext *context,
+ const vector::UnrollVectorOptions &options,
+ PatternBenefit benefit = 1)
+ : OpRewritePattern<vector::LoadOp>(context, benefit), options(options) {}
+
+ LogicalResult matchAndRewrite(vector::LoadOp loadOp,
+ PatternRewriter &rewriter) const override {
+ VectorType vecType = loadOp.getVectorType();
+ if (vecType.getRank() <= 1)
----------------
newling wrote:
Unrolling rank-1 should work fine as far as I can tell, please remove this clause (same comment for store logic). Unfortunately it looks like testing anything other than rank-2 vector will require changes to the test pass, so won't ask for additional tests. Ideally we would have a test of rank-0 but let's get back to that in later...
https://github.com/llvm/llvm-project/pull/143420
More information about the Mlir-commits
mailing list