-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Move IsKnownConstant handling to ExtendedDefaultPolicy #64809
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
Conversation
|
Tagging subscribers to this area: @JulieLeeMSFT Issue DetailsIn #63734 I added a special support for The idea of the heuristic is
|
Is this policy used by AOT as well? |
Only when |
|
@dotnet/jit-contrib PTAL, simple change, I need it for my other PR |
|
@EgorBo, are these pmi diffs expected: in this method: runtime/src/libraries/Common/src/Interop/Unix/System.Native/Interop.MountPoints.FormatInfo.cs Line 78 in 59e643b
which has a large switch case for variety of filesystems? (probably it is not critical for hot paths, just curious) |
|
I've lowered the multiplier. The problem with if (IsKnownConstant(arg) && arg == 42)so we should inline only if arg not only a constant at the callsite, but also a specific constant. It's not currently possible to correctly handle it unfortunately - inliner doesn't model basic blocks atm (but eventually will!), only if we introduce The regression in runtime/src/coreclr/jit/inlinepolicy.cpp Lines 1716 to 1723 in fe24ab3
|
|
@dotnet/jit-contrib @AndyAyersMS PTAL |
|
It seems like if there are many such calls in a method, we might want to be less aggressive overall. Can you see if this is the case in some of the larger regressions? Right now we evaluate inlinees more or less independently of one another, so recognizing this pattern might not be easy, but it would be interesting to see if there's a way to do this, say at least for the initial root level set of inlinees. |
|
@AndyAyersMS I decided to remove benefit multiplier for it, because it already gets additional from "foldable branch" since JIT is able to recognize it. I don't want to add it additional boost because of: where basically any constant arg will trigger that, but we only care about one specific value. No diffs. |
AndyAyersMS
left a comment
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.
In #63734 I added a special support for
IsKnownConstantin the inliner, but I added it to the conservativeDefaultPolicy(that doesn't scan call opcodes and is not able to recognize intrinsics). Moving toExtendedDefaultPolicy(used by default in jit).The idea of the heuristic is
if callee has IsKnownConstant(X) where X is a constant at the callsite in its caller => try harder inlining that callee into caller".