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

Erick Ochoa Lopez llvmlistbot at llvm.org
Wed Sep 10 11:04:27 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,
----------------
amd-eochoalo wrote:

@banach-space 

> Where is the default encoded?

Maybe we should let @Groverkss comment himself. I am paraphrasing him from a comment he made on discord and possibly another one here on github. This "default" may be to IREE and not MLIR itself. I also believe that @Groverkss wants both of these patterns upstream for backends to choose. See this [comment](https://github.com/llvm/llvm-project/pull/151175#issuecomment-3168195047)

> How we ideally want to structure conversion to backends is:
>
> * Set of patterns to do unrolling from N-D vectors to 1-D vectors
> * Set of patterns to do flattening from N-D vectors to 1-D vectors (in case someone wants to do this, we dont have patterns for this today)
> * [continues]

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


More information about the Mlir-commits mailing list