runtime: X64 - Too many methods JITted on startup for blank console application
Using this example:
namespace HelloWorldStartup
{
internal class Program
{
static void Main(string[] args)
{
}
}
}
The CPU I used was an AMD 7950X.
X64 - With DOTNET_JitDisasmSummary=1 it shows this number of methods (this is with R2R):
1: JIT compiled System.Runtime.CompilerServices.CastHelpers:StelemRef(System.Array,long,System.Object) [Tier1, IL size=88, code size=93]
2: JIT compiled System.Runtime.CompilerServices.CastHelpers:LdelemaRef(System.Array,long,ulong) [Tier1, IL size=44, code size=44]
3: JIT compiled System.SpanHelpers:IndexOfNullCharacter(ulong) [Tier1, IL size=805, code size=391]
4: JIT compiled System.Guid:TryFormatCore[ushort](System.Span`1[ushort],byref,int) [Tier0, IL size=894, code size=892]
5: JIT compiled System.Number:UInt32ToDecChars[ushort](ulong,uint) [Tier0, IL size=114, code size=253]
6: JIT compiled System.ArgumentOutOfRangeException:ThrowIfNegative[int](int,System.String) [Tier0, IL size=22, code size=50]
7: JIT compiled System.Text.Unicode.Utf16Utility:GetPointerToFirstInvalidChar(ulong,int,byref,byref) [Tier0, IL size=994, code size=1101]
8: JIT compiled System.Text.Ascii:NarrowUtf16ToAscii(ulong,ulong,ulong) [Tier0, IL size=491, code size=594]
9: JIT compiled System.SpanHelpers:IndexOfNullByte(ulong) [Tier1, IL size=844, code size=459]
10: JIT compiled System.PackedSpanHelpers:IndexOf[System.SpanHelpers+DontNegate`1[short]](byref,short,int) [Tier0, IL size=698, code size=1631]
11: JIT compiled System.PackedSpanHelpers:PackSources(System.Runtime.Intrinsics.Vector256`1[short],System.Runtime.Intrinsics.Vector256`1[short]) [Tier0, IL size=13, code size=52]
12: JIT compiled System.PackedSpanHelpers:ComputeFirstIndexOverlapped(byref,byref,byref,System.Runtime.Intrinsics.Vector256`1[ubyte]) [Tier0, IL size=52, code size=124]
13: JIT compiled System.PackedSpanHelpers:FixUpPackedVector256Result(System.Runtime.Intrinsics.Vector256`1[ubyte]) [Tier0, IL size=22, code size=42]
14: JIT compiled System.SpanHelpers:LastIndexOfValueType[short,System.SpanHelpers+DontNegate`1[short]](byref,short,int) [Tier1, IL size=963, code size=419]
15: JIT compiled System.Text.Ascii:WidenAsciiToUtf16(ulong,ulong,ulong) [Tier0, IL size=604, code size=1425]
16: JIT compiled (dynamicClass):InvokeStub_EventAttribute.set_Level(System.Object,System.Object,ulong) [FullOpts, IL size=25, code size=27]
17: JIT compiled (dynamicClass):InvokeStub_EventAttribute.set_Message(System.Object,System.Object,ulong) [FullOpts, IL size=25, code size=28]
18: JIT compiled (dynamicClass):InvokeStub_EventAttribute.set_Task(System.Object,System.Object,ulong) [FullOpts, IL size=25, code size=27]
19: JIT compiled (dynamicClass):InvokeStub_EventAttribute.set_Opcode(System.Object,System.Object,ulong) [FullOpts, IL size=25, code size=27]
20: JIT compiled (dynamicClass):InvokeStub_EventAttribute.set_Version(System.Object,System.Object,ulong) [FullOpts, IL size=25, code size=28]
21: JIT compiled (dynamicClass):InvokeStub_EventAttribute.set_Keywords(System.Object,System.Object,ulong) [FullOpts, IL size=25, code size=28]
22: JIT compiled System.Number:Int64ToHexChars[ushort](ulong,ulong,int,int) [Tier0, IL size=67, code size=252]
23: JIT compiled System.SpanHelpers:IndexOfAnyInRangeUnsignedNumber[ushort,System.SpanHelpers+DontNegate`1[ushort]](byref,ushort,ushort,int) [Tier0, IL size=142, code size=190]
24: JIT compiled System.PackedSpanHelpers:IndexOfAnyInRange[System.SpanHelpers+DontNegate`1[short]](byref,short,short,int) [Tier0, IL size=659, code size=1600]
25: JIT compiled System.SpanHelpers:SequenceCompareTo(byref,int,byref,int) [Tier1, IL size=568, code size=329]
26: JIT compiled HelloWorldStartup.Program:Main(System.String[]) [Tier0, IL size=1, code size=10]
ARM64:
1: JIT compiled System.Runtime.CompilerServices.CastHelpers:StelemRef(System.Array,long,System.Object) [Tier1, IL size=88, code size=144]
2: JIT compiled System.Runtime.CompilerServices.CastHelpers:LdelemaRef(System.Array,long,ulong) [Tier1, IL size=44, code size=88]
3: JIT compiled System.SpanHelpers:IndexOfNullCharacter(ulong) [Tier1, IL size=492, code size=392]
4: JIT compiled HelloWorldStartup.Program:Main(System.String[]) [Tier0, IL size=1, code size=20]
Problems identified:
- Bogus SIMD prereqs (https://github.com/dotnet/runtime/pull/85370)
- AggressiveOptimization disables R2R on SpanHelpers (https://github.com/dotnet/runtime/pull/85819)
- Virtual static methods are not R2R compiled (https://github.com/dotnet/runtime/issues/84421)
- Trimmed SelfContained R2RPublish does not use MIBC data (https://github.com/dotnet/runtime/issues/85791#issuecomment-1536517132)
- EventSource use of reflection (https://github.com/dotnet/runtime/issues/85791#issuecomment-1535629341)
- Tracing overhead in general (https://github.com/dotnet/runtime/issues/85791#issuecomment-1535638214)
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 2
- Comments: 29 (29 by maintainers)
That’s concerning, both in terms of startup and in terms of what overheads we might be paying throughout executiion.
Yes, confirmed that MIBC caused that. Ideally, dotnet/sdk should always use our default MIBC for all prejit operations.