Uh oh!
There was an error while loading. Please reload this page.
Propagate static readonly loads by value during inlining - #108579
Propagate static readonly loads by value during inlining#108579MichalPetryka wants to merge 19 commits into
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
MichalPetryka
commented
Oct 6, 2024
Alternative to spilling changes in dotnet#108579
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Alternative to spilling changes in #108579 Co-authored-by: Egor Bogatov <egorbo@gmail.com>
MichalPetryka
commented
Oct 22, 2024
MichalPetryka
commented
Oct 22, 2024
MichalPetryka
commented
Oct 23, 2024
MichalPetryka
commented
Oct 23, 2024
Okay, I looked into what's going on with inliner inlining more stuff here, apparently the reduced spilling on static readonly args which causes less locals to be used makes it reduce the profitability multiplier less which causes more inlining. |
MichalPetryka
commented
Nov 12, 2024
@MihuBot -dependsOn 109716 |
JulieLeeMSFT
commented
Nov 18, 2024
@AndyAyersMS will review this PR. |
AndyAyersMS
commented
Nov 20, 2024
Can you add a comment up top to explain the motivation for this change? Also, please help me understand why we should do this during inlining. The main goal of inlining's forward sub is to recognize further inlining opportunities and/or get a better handle on the cost of the inlinee. |
MichalPetryka
commented
Nov 21, 2024
The goal here was to let #109679 work across methods, but this leads to bad diffs from duplicated loads that CSE can't handle. I opened #109715 as an alternative to limit it to delegates only cause I'm not sure if there's any way to block the bad cases here... |
AndyAyersMS
commented
Nov 21, 2024
I think we should approach #109679 differently. Instead of trying to pull all this off during importation and inlining, I would like to see us focus on refactoring the inliner so it can be invoked as a utility in later phases and then rely on normal forward propagation of facts to enable new inlining in cases like these. I realize that:
So this would likely mean shelving all this work until sometime later next year. If you want to keep working in this area a good starter project might be to move the delegate invoke expansion earlier in the jit; that might be enough to unblock escape analysis of the delegate in some cases. I might be willing to reconsider if you strongly feel that we should consider following through on your current plans and can show some compelling data on the improvements this could bring. |
Could we move all discussion regarding #109679 to its comments? I'd prefer to reply on the PR in question. |
Alternative to spilling changes in dotnet#108579 Co-authored-by: Egor Bogatov <egorbo@gmail.com>
AndyAyersMS
commented
Dec 16, 2024
I'm still not seeing why we should take this PR. Aside from helping with the delegate issue, is there any other consideration? |
AndyAyersMS
commented
Jan 14, 2025
@MichalPetryka I am planning on closing this soon, but wanted to give you one last opportunity to argue in favor. |
This pull request has been automatically marked |
This pull request will now be closed since it had been marked |
Makes the JIT propagate invariant loads without side effects when inlining, preventing the JIT from spilling them.
Contains a hack to avoid static readonly args boosting inliner profitability.