[Mlir-commits] [mlir] [mlir][vector] Add vector.to_elements unrolling (PR #157142)

James Newling llvmlistbot at llvm.org
Wed Sep 10 10:51:20 PDT 2025


================
@@ -255,6 +255,16 @@ using UnrollVectorOpFn =
 LogicalResult unrollVectorOp(Operation *op, PatternRewriter &rewriter,
                              UnrollVectorOpFn unrollFn);
 
+/// Generic utility for mapping values of type vector<nxaxbx...>
+/// to n values of type vector<axbx...>
+/// Follows the following pattern:
+/// 1. Check if already 1-D. If so, return failure.
+/// 2. Check for scalable dimensions. If so, return failure.
+/// 3. Returns the values of n vector.extract operations corresponding
+///    to the outermost dimension.
+LogicalResult unrollVectorValue(Value vector, PatternRewriter &rewriter,
----------------
newling wrote:

> These guards are helpful when the insertion point is modified (to make sure that it gets restored auto-magically). But in this PR, we don't modify it, do we?

I guess not, no. Rereading Erick's comment again I see now that the current design is good. 



https://github.com/llvm/llvm-project/pull/157142


More information about the Mlir-commits mailing list