[Mlir-commits] [mlir] [MLIR] Vector: turn the ExtractStridedSlice rewrite pattern from #111541 into a canonicalization (PR #111614)
Benoit Jacob
llvmlistbot at llvm.org
Wed Oct 9 04:05:23 PDT 2024
================
@@ -3772,6 +3772,92 @@ class StridedSliceSplat final : public OpRewritePattern<ExtractStridedSliceOp> {
}
};
+/// Pattern to rewrite simple cases of N-D extract_strided_slice, where the
+/// slice is contiguous, into extract and shape_cast.
+///
+/// Example:
+/// Before:
+/// %1 = vector.extract_strided_slice %arg0 {offsets = [0, 0, 0, 0, 0],
+/// sizes = [1, 1, 1, 1, 8], strides = [1, 1, 1, 1, 1]} :
+/// vector<8x1x1x2x8xi8> to vector<1x1x1x1x8xi8>
+/// After:
+/// %0 = vector.extract %arg0[0, 0, 0, 0] : vector<8xi8> from
+/// vector<8x1x1x2x8xi8> %1 = vector.shape_cast %0 : vector<8xi8> to
+/// vector<1x1x1x1x8xi8>
+///
----------------
bjacob wrote:
That was clang-format eating the newline and making it look like a single op.
https://github.com/llvm/llvm-project/pull/111614
More information about the Mlir-commits
mailing list