llvm-project
c7120bbf - [mlir][tensor] Enhance pattern to fold extract_slice(insert_slice) (#195045)

Commit
14 days ago
[mlir][tensor] Enhance pattern to fold extract_slice(insert_slice) (#195045) Extend the DropRedundantRankExpansionOnExtractSliceOfInsertSlice pattern to support cases where the expanded dimensions are a subset of the dropped dimensions, rather than requiring them to be exactly equal. For example: ``` %inserted_slice = tensor.insert_slice %src into %dest[0, 0, 0, 0] [1, 1, 128, 480] [1, 1, 1, 1] : tensor<128x480xf32> into tensor<1x1x128x480xf32> %extracted_slice = tensor.extract_slice %inserted_slice[0, 0, 0, 0] [1, 1, 123, 1] [1, 1, 1, 1] : tensor<1x1x128x480xf32> to tensor<123xf32> ``` can be folded into: ``` %extracted_slice = tensor.extract_slice %src[0, 0] [123, 1] [1, 1] : tensor<128x480xf32> to tensor<123xf32> ```
Author
Parents
Loading