This is useful for breaking down extract_strided_slice and potentially
cancel with other extract / insert ops before or after.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/Dialect/Vector/Transforms/VectorInsertExtractStridedSliceRewritePatterns.cpp | ||
---|---|---|
238 | Shouldn't this be equivalent to Convert1DExtractStridedSliceIntoShuffle? |
mlir/lib/Dialect/Vector/Transforms/VectorInsertExtractStridedSliceRewritePatterns.cpp | ||
---|---|---|
238 | Not really. The purpose of having such patterns is trying to break down and clean up IRs of the following: %v0 = vector.insert %scalar0 into %init[0] : f16 into vector<8xf16> %v1 = vector.insert %scalar1 into %v0[1] : f16 into vector<8xf16> ... %v7 = vector.insert %scalar7 into %v0[7] : f16 into vector<8xf16> %e0 = vector.extract_strided_slice %v7 {offsets = [0], sizes = [4], strides = [1]} : vector<8xf16> to vector<4xf16> %e1 = vector.extract_strided_slice %v7 {offsets = [4], sizes = [4], strides = [1]} : vector<8xf16> to vector<4xf16> With this new pattern and various vector.extract/vector.insert canonicalization patterns we can completely avoid the vector<8xf16>; just buiding up %e0 and %e1 as vector<4xf16> from scalars. This is required for SPPIR-V to work given we cannot accept vector<8xf16> there. The existing pattern that converts vector.extract_strided_slice into vector.shuffle, OTOH, still retains vector<8xf16> and the vector.insert chain building up it. So it won't work there. |
Shouldn't this be equivalent to Convert1DExtractStridedSliceIntoShuffle?