IdModel: Step 4 of the loop promotion analysis#2003
Conversation
The loop promotion map generated at Step 3 is propagated through the IEL graph. This is necessary for partially inlined domains.
|
!build |
| std::unordered_map<ValGroup, IterDomain*> final_iel_promotion_map; | ||
| propagatePromotionsInIELGraph( | ||
| iel_graph, | ||
| final_iel_promotion_map, | ||
| idGraph(IdMappingMode::LOOP), | ||
| loop_promotion_map, | ||
| true); |
There was a problem hiding this comment.
Does it make sense to do the following instead?:
for (auto entry : iel_promotion_map) {
ValGroup iel_group = entry->first;
ValGroup loop_group = idGraph(IdMappingMode::LOOP).toGroup(iel_group->front());
auto it = loop_promotion_map.find(loop_group);
if (it != loop_promotion_map.end()) {
entry->second = it->second;
}
}
propagatePromotionsInIELGraph(iel_graph, iel_promotion_map, require_loop_mapped_promotion=true);I think my biggest problem with IdModel is this is so complicated that I can not fit it into my mind. IIUC, changing it to the above code is equivalent to the current approach, but the mental model will be easier.
There was a problem hiding this comment.
This is actually related to #2003 (comment).
Using the Step 3 results needs to consider the condition checked by hasUniqueInputLoopGraphs, so the suggested code would result in the double propagation. We could avoid that by selectively updating iel_promotion_map, but that would mean we would need to look at inputs and outputs and propagate loop_promotion_map only to outputs in some cases. I'd say that would be almost equally complicated as the current version.
There was a problem hiding this comment.
I see, thanks for the explanation. Could you open an issue for #2003 (comment)?
There was a problem hiding this comment.
Could you open an issue for #2003 (comment)?
What issue are you referring to? The broadcast forwarding?
Co-authored-by: Gao, Xiang <qasdfgtyuiop@gmail.com>
|
!build |
Step 4 of the loop promotion analysis. This is for fully propagating promotion mappings including partially inlined domains. --------- Co-authored-by: Gao, Xiang <qasdfgtyuiop@gmail.com>
This is the final step of the loop promotion analysis. The promotion map is almost completed at Step 3, but some partially inlined domains need one more propagation, which is done by Step 4 and Step 5. Step 5 is mostly just a repeat of Step 3. This basically concludes the loop promotion analysis, although there are a couple of issues that were found while working on indexing (#2218). Those issues will be addressed as further follow-up PRs. - Step 1: #1650 - Step 2: #1777 - Step 3: #1830 - Step 4: #2003
Step 4 of the loop promotion analysis. This is for fully propagating promotion mappings including partially inlined domains.