[Mlir-commits] [mlir] [mlir][vector] Add pattern to rewrite contiguous ExtractStridedSlice into Extract (PR #111541)

Mehdi Amini llvmlistbot at llvm.org
Tue Oct 8 15:44:14 PDT 2024


================
@@ -235,6 +235,11 @@ void populateVectorExtractStridedSliceToExtractInsertChainPatterns(
     std::function<bool(ExtractStridedSliceOp)> controlFn = nullptr,
     PatternBenefit benefit = 1);
 
+/// Pattern to rewrite simple cases of N-D extract_strided_slice, where the
+/// slice is contiguous, into extract and shape_cast.
+void populateVectorContiguousExtractStridedSliceToExtractPatterns(
+    RewritePatternSet &patterns, PatternBenefit benefit = 1);
----------------
joker-eph wrote:

> At the risk of duplication in all downstream projects?

I don't have much concerns about this: if it is really valuable, then it may get upstreamed properly eventually. We don't need to take on any random pattern without organization or rationale, just because it fitted some particular downstream flow.

> but IMO many times, the "pattern" across patterns only appears when they are all put in the same place

This does not really match the way I approach the design. Do you have prior example of success story that would support this? 

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


More information about the Mlir-commits mailing list