-
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
Use argIsInvariant
instead of argNode->OperIsConst()
for inlining observations.
#44790
Conversation
/azp run runtime-coreclr outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
Is |
As you've observed it is not very precise. What we have now may end up seeing benefits where none exist; that seems tolerable. Fixing the stack model requires a fair amount of work; currently nothing ever gets popped, so the issues go well beyond calls. But calls are the most complex and costly case -- we'd have to resolve the token to find the call sig to understand the pop/push behavior. So far I've been reluctant to do this because of the potential impact on jit throughput. |
It is true for |
Ok, so I would like to merge this change because:
that is optimized away when we increase its multiplier because of The downside is that it is a code size regression on libraries (as could be expected from additional inlining):
@AndyAyersMS what do you think? |
argIsInvariant
instead of argNode->OperIsConst()
for inlining observations.
Looks like R2R failures are related. |
They are most likely caused by #44807 |
Code size increase is a bit more than I'd like, -- would guess many of the new inlines are from the "false positives". But this change makes sense, so let's go ahead and take it. Maybe getting rid of all these false positives will provide enough benefit to justify a stronger stack model. Opened #45115 so there's a tracking issue. |
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.
Thanks for spotting this.
@sandreenko your change has most probably improved the performance in DrewScoggins/performance-2#3539 and DrewScoggins/performance-2#3540 |
Cool, thanks for reporting this! |
This produces many diffs, the reason is that for a test like this:
when we consider to inline
Test1
intoMain
fgFindJumpTargets
marks both arguments asCALLSITE_CONSTANT_ARG_FEEDS_TEST
and it bumps its inlining score. In this case, the const arguments are not feeding the condition directly and inlining of theTest1
does not help to fold the condition.Is such behavior desirable or should we improve stack simulation in
fgFindJumpTargets
so it pops args that are used by calls?After the change, it also happens for methods like
if (callA(this) != callB(this))
because this is an invariant.It causes more inlining to happen and the diff looks like a size regression:
x64 crossgen: Total bytes of delta: 46090 (0.14% of base)
x64 pmi: Total bytes of delta: 170421 (0.34% of base)
also, we can change the test a little:
now the constant arguments are not fed to the condition (even indirectly) but the current master still marks
Inline candidate has const arg that feeds a conditional. Multiplier increased to 3.
PTAL @AndyAyersMS, does it looks like an issue or is
CALLSITE_CONSTANT_ARG_FEEDS_TEST
an approximation that should not be precise?