[PATCH] D80347: [mlir][Linalg] Add support for fusion between indexed_generic ops and generic ops on tensors.
Han-Chung Wang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 27 15:16:35 PDT 2020
hanchung added inline comments.
================
Comment at: mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp:503-511
+ AffineMap consumerResultIndexMap =
+ consumer.getInputIndexingMap(consumerIdx);
+ AffineMap producerResultIndexMap = producer.getOutputIndexingMap(0);
+ AffineMap invProducerResultIndexMap =
+ inversePermutation(producerResultIndexMap);
+ assert(invProducerResultIndexMap &&
+ "expected producer result indexig map to be invertible");
----------------
mravishankar wrote:
> I think this should be outside of the `else`?
Good catch, in the beginning I thought we can't compose the maps sometimes. After review the comment of compose method, I found that the last two maps should swap.
See comments of AffineMap::compose():
```
/// Example:
/// map1: `(d0, d1)[s0, s1] -> (d0 + 1 + s1, d1 - 1 - s0)`
/// map2: `(d0)[s0] -> (d0 + s0, d0 - s0)`
/// map1.compose(map2):
/// `(d0)[s0, s1, s2] -> (d0 + s1 + s2 + 1, d0 - s0 - s2 - 1)`
```
Add some comment for it.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80347/new/
https://reviews.llvm.org/D80347
More information about the llvm-commits
mailing list