Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JIT: Remove most loop-related hoisting quirks #95734

Merged
merged 1 commit into from
Dec 8, 2023

Conversation

jakobbotsch
Copy link
Member

We still keep the quirk that we only hoist in loops also recognized by the old loop finding. Before we can hoist in new loops we need to implement creation of preheaders, but that requires incrementally keeping the old loop table up to date, which I'd like to avoid. So my next goal is to switch everything to only have the "recognized by old loop finding" quirk so that we can remove the old loop validity requirements.

A few minor diffs are expected because the new loop iteration order is not exactly the same as the old one. In particular child loop sibling links are stored in rever postorder (the old loop table has them in postorder), which means we end up hoisting them in postorder (the old one did them in reverse postorder). I initially added an ArrayStack::Reverse method to make it the same as previously, but the diffs were so small and just constituted some reordering, so the complication did not seem worth it.

We still keep the quirk that we only hoist in loops also recognized by
the old loop finding. Before we can hoist in new loops we need to
implement creation of preheaders, but that requires incrementally
keeping the old loop table up to date, which I'd like to avoid. So my
next goal is to switch everything to only have the "recognized by old
loop finding" quirk so that we can remove the old loop validity
requirements.

A few minor diffs are expected because the new loop iteration order is
not exactly the same as the old one. In particular child loop sibling
links are stored in rever postorder (the old loop table has them in
postorder), which means we end up hoisting them in postorder (the old
one did them in reverse postorder). I initially added an
`ArrayStack::Reverse` method to make it the same as previously, but the
diffs were so small and just constituted some reordering, so the
complication did not seem worth it.
@ghost ghost assigned jakobbotsch Dec 7, 2023
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Dec 7, 2023
@ghost
Copy link

ghost commented Dec 7, 2023

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Issue Details

We still keep the quirk that we only hoist in loops also recognized by the old loop finding. Before we can hoist in new loops we need to implement creation of preheaders, but that requires incrementally keeping the old loop table up to date, which I'd like to avoid. So my next goal is to switch everything to only have the "recognized by old loop finding" quirk so that we can remove the old loop validity requirements.

A few minor diffs are expected because the new loop iteration order is not exactly the same as the old one. In particular child loop sibling links are stored in rever postorder (the old loop table has them in postorder), which means we end up hoisting them in postorder (the old one did them in reverse postorder). I initially added an ArrayStack::Reverse method to make it the same as previously, but the diffs were so small and just constituted some reordering, so the complication did not seem worth it.

Author: jakobbotsch
Assignees: jakobbotsch
Labels:

area-CodeGen-coreclr

Milestone: -

@jakobbotsch jakobbotsch marked this pull request as ready for review December 7, 2023 15:49
@jakobbotsch
Copy link
Member Author

cc @dotnet/jit-contrib PTAL @BruceForstall

Diffs

Comment on lines 6585 to 6587
// TODO-Quirk: Switch this to postorder over the loops, instead of this
// loop tree based thing. It is not the exact same order, but it will still
// process child loops before parent loops.
Copy link
Member Author

Choose a reason for hiding this comment

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

Ugh, forgot to remove this. Will remove it as part of a future PR.

assert(childLoop->EntryEdges().size() == 1);
BasicBlock* childPreHead = childLoop->EntryEdge(0)->getSourceBlock();
BasicBlock* childPreHead = childLoop->EntryEdges()[0]->getSourceBlock();
Copy link
Member Author

Choose a reason for hiding this comment

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

...and will also fix this bad merge as part of a future PR.

@jakobbotsch jakobbotsch merged commit 41dbe9c into dotnet:main Dec 8, 2023
129 checks passed
@jakobbotsch jakobbotsch deleted the hoisting-remove-loop-quirks branch December 8, 2023 12:12
@github-actions github-actions bot locked and limited conversation to collaborators Jan 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants