JIT: minopts codegen strategy in impRuntimeLookupToTree#13305
JIT: minopts codegen strategy in impRuntimeLookupToTree#13305AndyAyersMS wants to merge 1 commit into
Conversation
In minopts/debug/rare-block modes, try and minimize code size and jit time by always chosing the helper call for complex runtime lookups.
|
Similar to what was done in #13188, use the helper call for runtime lookups if:
This one is hard to evaluate via jit-diff, since R2R always uses the helper today. So we can only see diffs in corelib where we are still using fragile prejitting. No diffs in corelib with full opt. With minopts forced on, we see: Still evaluating on desktop now since SPMI should give us a better take on the size impact. Throughput improvement for minopts/debug also tough to get a handle on, because handle expansion also varies between jitting and prejitting. It is likely in the 2-3% range. Will see if I can get plausible measurements from jitting and report back. @dotnet-bot test Windows_NT x64 Throughput @JosephTremoulet PTAL |
JosephTremoulet
left a comment
There was a problem hiding this comment.
LGTM, w/ one comment comment
| // Also used if possible when optimizing jit code size or jit time, and | ||
| // the inline sequences below will result in larger code or slower jitting. | ||
| // | ||
| // 2. pLookup->indirections != CORINFO_USEHELPER : |
There was a problem hiding this comment.
The cases in the comments here describe the old logic. Maybe just mention under pLookup->indirections != CORINFO_USEHELPER that using a helper call is a valid option at the jit's discretion.
There was a problem hiding this comment.
I did add something to the "1" entry that was supposed to cover the subsequent cases. Let me call it out better.
|
@dotnet/dnceng any idea why the arm testing is backing up like this? |
|
@AndyAyersMS Yeah, Azure updated a custom script extension and broke some VM images. I'm fixing now. |
|
TP job results are not what I expected. Here are the results plotted as diff/base ratio vs base time (so higher that 1.0 is worse for this change): I would expect most of the larger assemblies (the points further to the right) to be below 1.0 as this change should clearly speed up minopts jit time. Am going to rerun just to see if the second run gives similar results, since this job is new and we don't know how consistent it is just yet. @dotnet-bot test Windows_NT x64 Throughput |
|
Perhaps odder still: the TP job just runs the default crossgen, and so is generating R2R code for all the assemblies (it skips corelib). So there should be no impact from this change on the TP job as the logic for R2R hasn't changed any. |
|
If I pick some jit-intensive scenario (say running the checked build of CscBench, which is 75% jit time) and force-enable minopts, and look at instructions retired, the jit contribution to instructions retired drops about 4%. Overall process instructions retired however says flat, so evidently the reduction in jit time is matched by a similar increase in the time to execute the jitted code. So one might question whether this is the right approach or the right tuning -- it seems reasonable for minopts (less risk) and for the eventual Tier0 (where Tier0 jitted code should not run often) but maybe not as reasonable for debug codegen? |
|
@AndyAyersMS any update on this PR? Last update was from 2 weeks ago ... |
|
I'm still looking for the right way to assess CQ/TP tradeoffs in debug mode. May need to do some testing on desktop, for instance F5 scenarios in VS. |
|
Still looking for the best way to evaluate this. Since nothing's imminent, I'm going to close it for now. |

In minopts/debug/rare-block modes, try and minimize code size and
jit time by always chosing the helper call for complex runtime lookups.