-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move getConsumerPosAlignedToProducerCA to MaxPosCalculator (#3766)
Moved `getConsumerPosAlignedToProducerCA` to `MaxPosCalculator` to reuse an `IdModel` built for the entire fusion. No output should be affected, but there are two main reasons of the change, one is efficiency and another is functionality. - Previously, each call to `TensorView::updateMaxProducerPosition` created a (small) IdModel, which is inefficient since in common cases `updateMaxProducerPosition` is called from routines that already holds an IdModel through `MaxPosCalculator`. Moving the function to `MaxPosCalculator` can reuse the same IdModel. - A local IdModel that is created by just looking at a single expression may miss exact mappings previously registered through `Fusion::registerExactMapping`. For example: ``` t0: [i0] t1: [i1, i2] t2 = broadcast(t0, {false, true}); // t1: [i3, b4] t3 = t1 + t2 // [i5, i7] t4 = t3 + 1 // [i7, i8] ``` In this case, there are exact groups of `{i0, i1, i3, i5, i7}`, `{i2, i7, i8}`and `{b4}`. We could set the loop domain of `t2` look like `t4` by `scheduleLoopDomainsBy({t2}, t4->getLoopDomain())`, which would clone `i8` and set the loop domain of `t2` as `{i3, i9}`, where `i9` is a clone of `i8` and is registered as exact mapped with `i8`. This should all be fine as long as we looked at the whole fusion, but if an IdModel was built only for `t3 = t1 + t2`, the loop domain of `t2`, `{i3, i9}`, wouldn't be grouped together with the loop domain of `t3`, `{i5, i7}`. It would discover the mapping of `i3` and `i5`, but it wouldn't know anything between `i9` and `i7`. The registered exact mapping wouldn't help because it's registered with a pair of `i8` and `i9`. It is obvious that `i8` is mapped with `i7`, only when the IdModel analysis also looks at the `t4` definition. When an IdModel is created only for `t3 = t1 + t2`, the registered mapping would do nothing. This problem can be avoided by using a whole-fusion IdModel.
- Loading branch information
Showing
4 changed files
with
80 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters