-
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
Tiered JIT: redundant compilations #76402
Comments
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsTo record @AndyAyersMS's thoughts I came up with a quick repro: public class Program
{
public static void Main()
{
for (int i = 0; i < 100; i++)
{
Test();
Thread.Sleep(16);
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static int Test()
{
return Property;
}
private static int Property => 42;
} Run this code with
As a quick solution we should consider inlining for very small calls in Tier0, potentially, this might even improve JIT's TP because
|
AvaloniaILSpy app, R2R=0, TC=1: More than 3000 methods made it to Tier1 with IL<= 8 bytes |
Potential easy fix: Increase call-counting threshold for methods below 16 bytes (e.g. 30 -> 100) on the VM side. |
Did a quick prototype:
The number of compilation reduced by 3000 but the start up time slightly regressed any way 😢 |
so we emit thousands of redundant call-counting stubs/precodes/methods 19% of all methods made it to Tier1 |
For BingSNR my fairly simple prototype lowers overall number of "jitted functions" from 240k to 200k (and my prototype ignores calls inside simple calls, e.g. a chain of properties) |
Moving to Future as my attempt to enable limitted inlining in tier0 even slightly regressed startup |
@EgorBo Hi, I checked other redundant compilation case. I tested on ARM64 and RISC-V. (Release Build)
What I checked are
I think 9530 and 9532 are redundant compilation. |
To record @AndyAyersMS's thoughts I came up with a quick repro:
Run this code with
DOTNET_JitDisasmSummary=1
on .NET 7.0 RC1 and it's going to print:get_Property
was compiled twice (Tier0 and Tier1) despite the fact it's super trivial (like e.g. any auto-property) - only 6 bytes of IL and we wasted some time on it.We should consider allowing inlining for very small methods in Tier0, potentially, this might even improve JIT's TP because
call
IR nodes are slow to process. Only if they're small and don't contain control-flowcategory:cq
theme:tiering
skill-level:expert
cost:large
impact:medium
The text was updated successfully, but these errors were encountered: