[Mlir-commits] [mlir] [MLIR][Vector] Add unroll pattern for vector.shape_cast (PR #164010)

Nishant Patel llvmlistbot at llvm.org
Tue Oct 28 11:39:58 PDT 2025


nbpatel wrote:

> > I also see there are similar patterns
> 
> Could we try to refactor that code into a utility? The only difference should be the resulting shape but the decomposition code should be the same?

Hi Diego, I looked at the LowerVectorShapeCast.cpp and here are my thoughts. 
While both (ShapeCastOpRewritePattern & UnrollShapeCast) patterns handle shape_cast, they use fundamentally different algorithmic approaches that aren't easily unifiable. Also unifying them and extracting them to a utility will involve making the UnrollVectorOption optional for all patterns in populateVectorShapeCastLoweringPatterns (which might make the design confusing) since we need that to pass targetTileShape for unrolling. I think refactoring should be a task for future where we need to refactor (if possible) and unify all the LowerVector*Op*.cpp patterns and Unroll patterns and see if there is a clean interface to reuse them across both. Let me know if this sounds reasonable to you

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


More information about the Mlir-commits mailing list