diff options
author | Mahesh Ravishankar <ravishankarm@google.com> | 2023-07-19 04:58:26 +0000 |
---|---|---|
committer | Mahesh Ravishankar <ravishankarm@google.com> | 2023-07-19 17:47:18 +0000 |
commit | 67399932c767f0a64c83a500dc6f7806c09d9401 (patch) | |
tree | 2e2174c6562414ba7e0b1f5dff5222d10f72b848 /llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | |
parent | 645f6dcd69a5315dbe2a6b49fdd8d356512544e8 (diff) | |
download | llvm-67399932c767f0a64c83a500dc6f7806c09d9401.zip llvm-67399932c767f0a64c83a500dc6f7806c09d9401.tar.gz llvm-67399932c767f0a64c83a500dc6f7806c09d9401.tar.bz2 |
[mlir][Linalg] Cleanup the drop unit dims pass in Linalg.
TL;DR the following API functions have been merged
```
void populateFoldUnitExtentDimsViaReshapesPatterns(RewritePatternSet &patterns);
void populateFoldUnitExtentDimsViaSlicesPatterns(RewritePatternSet &patterns);
```
into
```
void populateFoldUnitExtentDimsPatterns(RewritePatternSet &patterns,
ControlDropUnitDims &options);
```
To use the previous functionality use
```
ControlDropUnitDims options;
// By default options.rankReductionStrategy is
// ControlDropUnitDims::RankReductionStrategy::ReassociativeReshape.
populateFoldUnitExtentDimsPatterns(patterns, options);
```
and
```
ControlDropUnitDims options;
options.rankReductionStrategy = ControlDropUnitDims::RankReductionStrategy::ExtractInsertSlice
populateFoldUnitExtentDimsPatterns(patterns, options);
```
This pass is quite old and needed to be updated based on the current
approach to transformations in Linalg
- Instead of two patterns, one to just remove loop dimensions that are
unit extent (and using 0 in the indexing maps), and another to drop
the unit-extents in the operand shapes, combine into a single
transformation. This avoid creating an intermediate step with
indexing maps having 0's in the domains exp ressions.
- Expose the core transformation as a utility function and add a
pattern that calls this transformation.
This is a mostly NFC change, apart from the API change and dropping
the patterns/test that only dropped the loops that are unit extents.
Differential Revision: https://reviews.llvm.org/D155518
Diffstat (limited to 'llvm/lib/Transforms/Utils/BasicBlockUtils.cpp')
0 files changed, 0 insertions, 0 deletions