[Mlir-commits] [mlir] [mlir][vector] Add more patterns to Vector Linearize transformation (PR #136193)
James Newling
llvmlistbot at llvm.org
Mon Apr 21 08:41:23 PDT 2025
================
@@ -531,12 +618,239 @@ struct LinearizeVectorBitCast final
unsigned targetVectorBitWidth;
};
+/// This pattern converts the LoadOp to a series of LoadOp & InsertOp
+/// that works on a linearized vector.
+/// Following,
+/// vector.load %base[%indices] : vector<4x4xf32>
+/// is converted to :
+/// %result = arith.constant dense<0.0> : vector<4x4xf32>
----------------
newling wrote:
I wonder if it would be beneficial to flatten/linearize out all contiguous dimensions first. i.e. if the load is actually unstrided, like
```
%result = vector.load %base[%i, %j] : memref<100x100xf32>, vector<8x100xf32>
```
if this flattened to
```
%result = vector.load %flat_base[%i] : memref<10000xf32>, vector<800xf32>
```
the IR generated wouldn't be unrolled.
It seems to me like this is more unrolling than linearizing?
https://github.com/llvm/llvm-project/blob/52a5332a710d4db22327c3777ebf6873ff20732f/mlir/include/mlir/Dialect/Vector/Transforms/VectorRewritePatterns.h#L305
https://github.com/llvm/llvm-project/pull/136193
More information about the Mlir-commits
mailing list