Skip to content

IdModel: Loop promotion analysis step 3#1830

Merged
naoyam merged 26 commits intomainfrom
idmodel_step3
Mar 13, 2024
Merged

IdModel: Loop promotion analysis step 3#1830
naoyam merged 26 commits intomainfrom
idmodel_step3

Conversation

@naoyam
Copy link
Collaborator

@naoyam naoyam commented Feb 24, 2024

Step 3 of the loop promotion analysis.

Stacked on top of #1777.

After this, there'll be PRs for steps 4 and 5. They would be relatively smaller PRs as they are mostly just repeating steps 2 and 3.

@naoyam
Copy link
Collaborator Author

naoyam commented Feb 24, 2024

!build

@naoyam naoyam added the idmodel label Feb 24, 2024
@naoyam
Copy link
Collaborator Author

naoyam commented Feb 26, 2024

The JIT binary tests on H100 failure is due to a system problem:

nvidia-container-cli: detection error: nvml error: unknown error: unknown.

@naoyam naoyam marked this pull request as ready for review February 27, 2024 02:17
@naoyam
Copy link
Collaborator Author

naoyam commented Feb 27, 2024

!build

@naoyam naoyam changed the title WIP: Loop promotion analysis step 3 IdModel: Loop promotion analysis step 3 Feb 27, 2024
@naoyam naoyam requested a review from zasdfgbnm February 27, 2024 02:19
Base automatically changed from idmodel_step2 to main March 8, 2024 00:14
@naoyam
Copy link
Collaborator Author

naoyam commented Mar 8, 2024

!build

Copy link
Collaborator

@zasdfgbnm zasdfgbnm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not done reading yet. Just posting some minor comment so far.

const ValGraph& iel_graph,
const std::unordered_map<ValGroup, IterDomain*>& iel_promotion_map,
const std::unordered_map<ValGroup, ValGroups>& exact_covered_ids,
const VectorOfUniqueEntries<IterDomain*>& terminal_loop_ids) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we only consider terminal ids? Is it because of forwarding and we only want to consider the most forwarded ID?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If an ID is not terminal, that means there's an consumer ID that's also in the same loop group, and that in turn means the non-terminal ID should never be the representative ID of this loop group. So, yes, we should only look for most forwarded IDs.

That said, I believe it is not required to consider only terminal IDs since the check around line 1278 should exclude non-terminal IDs anyway.

Copy link
Collaborator

@zasdfgbnm zasdfgbnm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not done yet, but I believe I should post early, because I have a real worry #1830 (comment) to discuss.

tv2->getRootDomain().at(0),
tv3->getRootDomain().at(0),
tv3->getRootDomain().at(1),
getParentId(tv3->axis(0), 4),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: would it be more readable if we use the following?

Suggested change
getParentId(tv3->axis(0), 4),
getChildId(tv3->getRootDomain().at(0), 1),

They are equivalent, just easier to find in the drawing. In general, I think we should make the second argument of getParentId or getChildId as small as possible.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree it'd be simpler, but since a replay may add a new expr using the same domain, traversing from parents to children may not always work.

Comment on lines +992 to +993
getParentId(tv4->axis(0), 4)},
getParentId(tv4->axis(0), 4)},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: would it be more readable if we use

Suggested change
getParentId(tv4->axis(0), 4)},
getParentId(tv4->axis(0), 4)},
getChildId(tv4->getRootDomain().at(0), 1)},
getChildId(tv4->getRootDomain().at(0), 1)},

Comment on lines +1008 to +1011
getParentId(tv2->axis(0), 3),
getParentId(tv3->axis(0), 3),
getParentId(tv4->axis(0), 3)},
getParentId(tv4->axis(0), 3)},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: would it be more readable if we use:

Suggested change
getParentId(tv2->axis(0), 3),
getParentId(tv3->axis(0), 3),
getParentId(tv4->axis(0), 3)},
getParentId(tv4->axis(0), 3)},
getChildId(tv2->getRootDomain().at(0), 1),
getChildId(tv3->getRootDomain().at(2), 1),
getChildId(tv3->getRootDomain().at(2), 1)},
getChildId(tv3->getRootDomain().at(2), 1)},

Copy link
Collaborator

@zasdfgbnm zasdfgbnm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finished reading. Don't see any blocker.

@naoyam naoyam mentioned this pull request Mar 13, 2024
@naoyam
Copy link
Collaborator Author

naoyam commented Mar 13, 2024

!build

@naoyam
Copy link
Collaborator Author

naoyam commented Mar 13, 2024

Thanks for the review @zasdfgbnm. I'll merge the PR once the tests are done. I'll update the doc as well.

@naoyam naoyam merged commit a4c8ffe into main Mar 13, 2024
@naoyam naoyam deleted the idmodel_step3 branch March 13, 2024 23:03
naoyam added a commit that referenced this pull request May 10, 2024
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants