-
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: Set edge likelihoods during patchpoint transformation #97897
JIT: Set edge likelihoods during patchpoint transformation #97897
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsFixes #97892. During patchpoint expansion, make sure to set edge likelihoods for transformed blocks.
|
/azp run runtime-coreclr jitstress, runtime-coreclr libraries-jitstress |
Azure Pipelines successfully started running 2 pipeline(s). |
src/coreclr/jit/patchpoint.cpp
Outdated
trueEdge->setLikelihood(0.5); | ||
falseEdge->setLikelihood(0.5); |
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.
The test actually passing should be very rare (I believe the threshold is 1/10000). Also, isn't trueEdge
always going to be the BBJ_ALWAYS
edge inserted by fgSplitBlockAtBeginning
above, so the check here is a bit meaningless?
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.
Also, isn't trueEdge always going to be the BBJ_ALWAYS edge inserted by fgSplitBlockAtBeginning above, so the check here is a bit meaningless?
Ah you're right, so trueEdge
should always have an edge likelihood here. I'll remove the branch.
The test actually passing should be very rare (I believe the threshold is 1/10000).
Is there any value to being more precise than 0.1/0.9 for trueEdge
/falseEdge
's likelihoods?
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.
In tier0? Doubtful. Also 1/10000 is not entirely accurate since I believe multiple patchpoints share the counter, but @AndyAyersMS can correct me if I'm wrong...
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 see below this snippet that helperBlock
inherits 1% of block
's weight; should we have the edge likelihoods match that? So trueEdge
is 0.99, and falseEdge
is 0.01.
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.
Makes sense to me to be consistent with that. On further look it looks like TC_OnStackReplacement_InitialCounter
is 1000. Not sure if the mismatch is intentional or not; in a way, the most accurate guess we could make is probably 1 / <that value>
, but feel free to stick with the 1% here.
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.
Overall it probably doesn't matter since (at least for now) we only have patchpoints in unoptimized code. I guess I'd go with the precedent already there and use the 0.99/0.01 split.
/azp run runtime-coreclr jitstress, runtime-coreclr libraries-jitstress |
Azure Pipelines successfully started running 2 pipeline(s). |
Co-authored-by: Jakob Botsch Nielsen <[email protected]>
@AndyAyersMS this isn't wholly related to this change, but I wonder if we should initialize all edge likelihoods to What do you think? |
/azp run runtime-coreclr jitstress, runtime-coreclr libraries-jitstress |
Azure Pipelines successfully started running 2 pipeline(s). |
That's more or less what happens in profile synthesis, with the potential of being a bit more clever over time. Right now it is optional and off by default. So you could try turning it on when profile data is absent (just "AssignLikelihoods", not full synthesis, for now). |
/azp run runtime-coreclr jitstress, runtime-coreclr libraries-jitstress |
Azure Pipelines successfully started running 2 pipeline(s). |
Failures are known. |
Fixes #97892. During patchpoint expansion, make sure to set edge likelihoods for transformed blocks.