[Mlir-commits] [mlir] [MLIR][Tensor] Canonicalize fully covering slice insertions into tensors with unit prefixes (PR #92912)
Matthias Springer
llvmlistbot at llvm.org
Thu May 23 01:26:30 PDT 2024
matthias-springer wrote:
One more data point: We've had similar discussions for other `tensor.extract/insert_slice`-related rewrite patterns. E.g.:
* `tensor.extract_slice(tensor.empty)` folding: `populateFoldTensorEmptyPatterns`
* `tensor.insert_slice(tensor.insert_slice)` folding: `populateFoldTensorSubsetOpPatterns` / `populateMergeConsecutiveInsertExtractSlicePatterns`
* `tensor.insert_slice(vector.transfer_write)` folding: `populateFoldTensorSubsetIntoVectorTransferPatterns`
* `tensor.insert_slice(tensor.collapse_shape)` folding: `populateReassociativeReshapeFoldingPatterns`
* etc.
Some of these could have been canonicalization patterns. The problem is that some transformations are hard-coded to specific IR patterns. E.g.:
* Bufferization looks for matching `extract_slice/insert_slice` pairs.
* Various tiling/fusion transformations look for `extract_slice` ops.
This is not ideal and ideally those transformations should be generalized. But that's non-trivial and a lot of work. Esp. generalizing the bufferization could easily take a few months.
I basically stopped adding new canonicalization patterns. Apart from very simple canonicalizations like turning dynamic sizes into static sizes. There is no good way for users to opt out of certain canonicalizations. But they can always opt into applying additional patterns if they want to.
https://github.com/llvm/llvm-project/pull/92912
More information about the Mlir-commits
mailing list