-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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: maintain pred lists during loop unrolling #80625
Conversation
We now update pred lists during loop unrolling, rather than recomputing them from scratch. There are several parts to the fix: first, `optRedirectBlock' now has a new ability to add pred references for the flow from a newly cloned block, be it either to a remapped successor or a non-remapped successor. Along with this we no longer copy over the block ref count in `CloneBlockState`. These changes allow us to create the right pred links and ref counts in the interior of a cloned subgraph. Second, we now scrub block references from the original loop body blocks instead of just setting their ref counts to zero. Finally, we fix up references for exterior flow into and out of the unroll complex. Addresses one of the cases mentioned in dotnet#49030.
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch, @kunalspathak Issue DetailsWe now update pred lists during loop unrolling, rather than recomputing them from scratch. There are several parts to the fix: first, Second, we now scrub block references from the original loop body blocks instead of just setting their ref counts to zero. Finally, we fix up references for exterior flow into and out of the unroll complex. Addresses one of the cases mentioned in #49030.
|
@BruceForstall PTAL Also contains an unrelated jit dump fix for SSA. This was annoyingly hard to get right; the main culprits being
Also will note some ideas for future cleanup to the unroller. These may deserve a new issue or notes on existing issues:
|
Also I will work on fixing the other places we trash pred lists, so have reassigned #49030. |
Hmm, I am seeing some SPMI diffs locally, which is a bit surprising -- let me verify I have a good baseline jit before I start digging in deeper. |
Looks like I didn't rebuild my diff branch after rebasing onto main. No diffs (as expected) once it was rebuilt. |
Diffs—as expected, no code diffs. Looks like TP is a wash, extra cost maintaining preds evidently balances savings from not rebuilding preds. I thought it might be a bit cheaper to maintain. |
@BruceForstall FYI I have the other phases that drop preds list fixed (building on top of these changes), but will keep them as a follow-up PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
} | ||
|
||
// We fall into to this unroll iteration from the bottom block (first iteration) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit
// We fall into to this unroll iteration from the bottom block (first iteration) | |
// We fall into this unroll iteration from the bottom block (first iteration) |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix this in the next PR...
We now update pred lists during loop unrolling, rather than recomputing them from scratch.
There are several parts to the fix: first,
optRedirectBlock
now has a new ability to add pred references for the flow from a newly cloned block, be it either to a remapped successor or a non-remapped successor. Along with this we no longer copy over the block ref count inCloneBlockState
. These changes allow us to create the right pred links and ref counts in the interior of a cloned subgraph.Second, we now scrub block references from the original loop body blocks instead of just setting their ref counts to zero.
Finally, we fix up references for exterior flow into and out of the unroll complex.
Addresses one of the cases mentioned in #49030.