summaryrefslogtreecommitdiff
path: root/mlir/lib/Dialect/Tensor/Transforms/SubsetInsertionOpInterfaceImpl.cpp
AgeCommit message (Collapse)Author
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.
2023-11-01[mlir][Interfaces] LISH: Add helpers for hyperrectangular subsets (#70628)Matthias Springer
The majority of subset ops operate on hyperrectangular subsets. This commit adds a new optional interface method (`getAccessedHyperrectangularSlice`) that can be implemented by such subset ops. If implemented, the other `operatesOn...` interface methods of the `SubsetOpInterface` do not have to be implemented anymore. The comparison logic for hyperrectangular subsets (is disjoint/equivalent) is implemented with `ValueBoundsOpInterface`. This makes the subset hoisting more powerful: simple cases where two different SSA values always have the same runtime value can now be supported.
2023-11-01[mlir][Interfaces] Add `SubsetOpInterface` and `SubsetExtractionOpInterface` ↵Matthias Springer
(#70617) There is currently an op interface for subset insertion ops (`SubsetInsertionOpInterface`), but not for subset extraction ops. This commit adds `SubsetExtractionOpInterface` to `mlir/Interfaces`, as well as a common dependent op interface: `SubsetOpInterface`. - `SubsetOpInterface` is for ops that operate on tensor subsets. It provides interface methods to check if two subset ops operate on equivalent or disjoint subsets. Ops that implement this interface must implement either `SubsetExtractionOpInterface` or `SubsetInsertionOpInterface`. - `SubsetExtractionOpInterface` is for ops that extract from a tensor at a subset. E.g., `tensor.extract_slice`, `tensor.gather`, `vector.transfer_read`. Current implemented only on `tensor.extract_slice`. - `SubsetInsertionOpInterface` is for ops that insert into a destination tensor at a subset. E.g., `tensor.insert_slice`, `tensor.parallel_insert_slice`, `tensor.scatter`, `vector.transfer_write`. Currently only implemented on `tensor.insert_slice`, `tensor.parallel_insert_slice`. Other changes: - Rename `SubsetInsertionOpInterface.td` to `SubsetOpInterface.td`. - Add helper functions to `ValueBoundsOpInterface.cpp` for checking whether two slices are disjoint. The new interfaces will be utilized by a new "loop-invariant subset hoisting" transformation. (This new transform is roughly what `Linalg/Transforms/SubsetHoisting.cpp` is doing, but in a generic and interface-driven way.)
2023-10-30[mlir][Interfaces][NFC] Move `SubsetInsertionOpInterface` to ↵Matthias Springer
`mlir/Interfaces` (#70615) `SubsetInsertionOpInterface` is an interface for ops that insert into a destination tensor at a subset. It is currently used by the bufferization framework to support efficient `tensor.extract_slice/insert_slice` bufferization and to drive "empty tensor elimination". This commit moves the interface to `mlir/Interfaces`. This is in preparation of adding a new "loop-invariant subset hoisting" transformation to `mlir/Transforms/Utils/LoopInvariantCodeMotionUtils.cpp`, which will utilize `SubsetInsertionOpInterface`. (This new transform is roughly what `Linalg/Transforms/SubsetHoisting.cpp` is doing, but in a generic and interface-driven way.)
2023-10-25[mlir][tensor][NFC] Simplify `SubsetInsertionOpInterface` implementation ↵Matthias Springer
(#69999) `tensor.insert_slice` and `tensor.parallel_insert_slice` can share the same implementation.
2023-10-04[mlir][ODS] Change `get...Mutable` to return `OpOperand &` for single ↵Matthias Springer
operands (#66519) The TableGen code generator now generates C++ code that returns a single `OpOperand &` for `get...Mutable` of operands that are not variadic and not optional. `OpOperand::set`/`assign` can be used to set a value (same as `MutableOperandRange::assign`). This is safer than `MutableOperandRange` because only single values (and no longer `ValueRange`) can be assigned. E.g.: ``` // Assignment of multiple values to non-variadic operand. // Before: Compiles, but produces invalid op. // After: Compilation error. extractSliceOp.getSourceMutable().assign({v1, v2}); ```
2023-09-14[mlir][bufferization] Empty tensor elimination based on SubsetOpInterface ↵Matthias Springer
(#65766) This commit generalizes empty tensor elimination to operate on subset ops. No new test cases are added because all current subset ops were already supported previously. From this perspective, this change is NFC. A new interface method (and a helper method) are added to `SubsetInsertionOpInterface` to build the subset of the destination tensor.
2023-09-13[mlir][bufferization] Generalize tensor slice rules to subset ops (#65619)Matthias Springer
This commit generalizes the special tensor.extract_slice/tensor.insert_slice bufferization rules to tensor subset ops. Ops that insert a tensor into a tensor at a specified subset (e.g., tensor.insert_slice, tensor.scatter) can implement the `SubsetInsertionOpInterface`. Apart from adding a new op interface (extending the API), this change is NFC. The only ops that currently implement the new interface are tensor.insert_slice and tensor.parallel_insert_slice, and those ops were are supported by One-Shot Bufferize.