summaryrefslogtreecommitdiff
path: root/mlir/lib/Dialect/Tensor/Transforms/ReshapePatterns.cpp
AgeCommit message (Collapse)Author
2025-11-19[mlir][tensor] Drop unused AffineExpr variable (NFC) (#168651)Longsheng Mou
2025-09-12[mlir][NFC] Correct pattern names to match the behaviors. (#158177)Han-Chung Wang
It is a follow-up for https://github.com/llvm/llvm-project/pull/131982#discussion_r2286014576 and https://github.com/llvm/llvm-project/pull/126898#discussion_r2286013250. The names do not match the behaviors, and the revision updates the names. Signed-off-by: hanhanW <hanhan0912@gmail.com>
2025-08-19[mlir][tensor][NFC] Refactor common methods for bubbling extract_slice op ↵Ian Wood
(#153675) Exposes the `tensor.extract_slice` reshaping logic in `BubbleUpExpandShapeThroughExtractSlice` and `BubbleUpCollapseShapeThroughExtractSlice` through two corresponding utility functions. These compute the offsets/sizes/strides of an extract slice after either collapsing or expanding. This should also make it easier to implement the two other bubbling cases: (1) the `collapse_shape` is a consumer or (2) the `expand_shape` is a consumer. --------- Signed-off-by: Ian Wood <ianwood@u.northwestern.edu>
2025-07-25[mlir][NFC] update `mlir/Dialect` create APIs (33/n) (#150659)Maksim Levental
See https://github.com/llvm/llvm-project/pull/147168 for more info.
2025-07-23[mlir][NFC] update `mlir/Dialect` create APIs (23/n) (#149930)Maksim Levental
See https://github.com/llvm/llvm-project/pull/147168 for more info.
2025-07-11[mlir] Remove unused includes (NFC) (#148119)Kazu Hirata
These are identified by misc-include-cleaner. I've filtered out those that break builds. Also, I'm staying away from llvm-config.h, config.h, and Compiler.h, which likely cause platform- or compiler-specific build failures.
2025-06-05[mlir] Directly call ShapedType::isDynamic without lambdas (NFC) (#142994)Kazu Hirata
We do not need lambdas in these places.
2025-05-20[mlir][NFC] Simplify constant checks with isOneInteger and renamed ↵Han-Chung Wang
isZeroInteger. (#139340) The revision adds isOneInteger helper, and simplifies the existing code with the two methods. It removes some lambda, which makes code cleaner. For downstream users, you can update the code with the below script. ```bash sed -i "s/isZeroIndex/isZeroInteger/g" **/*.h sed -i "s/isZeroIndex/isZeroInteger/g" **/*.cpp ``` --------- Signed-off-by: hanhanW <hanhan0912@gmail.com>
2025-04-15[mlir][Tensor] Generalize the pattern to swap `tensor.collapse_shape` -> ↵MaheshRavishankar
`tensor.expand_shape`. (#133819) The current patterns compared the reassocation indices for the two ops and failed if neither of them were of size 1. This patch relaxes this restriction by handling a new case where the reassociation indices might be of the same size. Also generalizes to cases where when generating the swapped `tensor.expand_shape` -> `tensor.collapse_shape` if one of them is degenerate, those are not generated. Signed-off-by: MaheshRavishankar <mahesh.ravishankar@gmail.com>
2025-04-02[MLIR] Bubble up tensor.extract_slice through tensor.collapse_shape (#131982)ofri frishman
Add a pattern that bubbles up tensor.extract_slice through tensor.collapse_shape. The pattern is registered in a pattern population function that is used by the transform op transform.apply_patterns.tensor.bubble_up_extract_slice and by the tranform op transform.structured.fuse as a cleanup pattern. This pattern enables tiling and fusing op chains which contain tensor.collapse_shape if added as a cleanup pattern of tile and fuse utility. Without this pattern that would not be possible, as tensor.collapse_shape does not implement the tiling interface. This is an additional pattern to the one added in PR #126898
2025-03-11[mlir] Add special case for 0-D tensor when fusing expand from collapse ↵Evan Liu
(#130838) One fusion pattern for collapse_shape -> expand_shape was added in https://github.com/llvm/llvm-project/commit/a95ad2da36b6a996b05c79df6b385cd98bac286d, however if the intermediate tensor between a collapse and expand is a 0-D tensor, then the `reassociation_map` for these two are special cases and can't be generally fused in this function `BubbleUpExpandThroughParallelCollapse`.
2025-03-03[MLIR] Add pattern to bubble up tensor.extract_slice (#126898)ofri frishman
Add a pattern that bubbles up tensor.extract_slice through tensor.expand_shape, and add a transform op to tensor dialect to directly use this pattern. This pattern enables tiling and fusing op chains which contain tensor.expand_shape if added as a cleanup pattern of tile and fuse utility. Without this pattern that would not be possible, as tensor.expand_shape does not implement the tiling interface. In addition, registering this pattern as a cleanup pattern for transform.structured.fuse. The pattern was first implement in IREE project by Quinn Dawkins and is being upstreamed. --------- Co-authored-by: Quinn Dawkins <quinn.dawkins@gmail.com>
2024-08-14[mlir] Add bubbling patterns for non intersecting reshapes (#103401)Ian Wood
Refactored @Max191's PR https://github.com/llvm/llvm-project/pull/94637 to move it to `Tensor` From the original PR >This PR adds fusion by expansion patterns to push a tensor.expand_shape up through a tensor.collapse_shape with non-intersecting reassociations. Sometimes parallel collapse_shape ops like this can block propagation of expand_shape ops, so this allows them to pass through each other. I'm not sure if I put the code/tests in the right places, so let me know where those go if they aren't. cc @MaheshRavishankar @hanhanW --------- Co-authored-by: Max Dawkins <max.dawkins@gmail.com>
2024-05-31[mlir][tensor] Fold unpadding collapse_shape into extract_slice (#93554)Adam Siemieniuk
2024-05-24[mlir][tensor] Fold padding expand_shape into insert_slice (#93018)Adam Siemieniuk
2022-12-07[mlir][tensor] Support parallel_insert_slice in reassociative reshape folderMatthias Springer
Differential Revision: https://reviews.llvm.org/D139540
2022-12-05[mlir][tensor] Fold rank-reducing insert_slice with inverse collapse_shapeMatthias Springer
Differential Revision: https://reviews.llvm.org/D139221
2022-12-05[mlir][tensor] Fold rank-reducing extract_slice with inverse expand_shapeMatthias Springer
Differential Revision: https://reviews.llvm.org/D139220
2022-12-02Revert "[mlir][tensor] Fold rank-reducing extract_slice with inverse ↵Matthias Springer
expand_shape" This reverts commit a076f57a1a6b6d775aa4f11ac678d1c43ab33fb1.
2022-12-02Revert "[mlir][tensor] Fold rank-reducing insert_slice with inverse ↵Matthias Springer
collapse_shape" This reverts commit 1522a3b7b34b41cf0b17678e4a8687797f44a3f0.
2022-12-02[mlir][tensor] Fold rank-reducing insert_slice with inverse collapse_shapeMatthias Springer
Differential Revision: https://reviews.llvm.org/D139104
2022-12-02[mlir][tensor] Fold rank-reducing extract_slice with inverse expand_shapeMatthias Springer
Differential Revision: https://reviews.llvm.org/D139103