-
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
Allow some intrinsics in Tier0 #77357
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsAs it turns out, even extremely hot methods may stuck in Tier0 for several seconds (see #70941 (comment)) pending call-counting stub installation. So we'd better optimize Enum.HasFlag in tier0 too because it allocates and produces a large tree, e.g.: bool Test(MyEnum e) => e.HasFlag(MyEnum.B); Current Tier0 codegen: ; Assembly listing for method Program:Test(int):bool:this
; Emitting BLENDED_CODE for X64 CPU with AVX - Windows
; Tier-0 compilation
; MinOpts code
; rbp based frame
; partially interruptible
G_M000_IG01: ;; offset=0000H
55 push rbp
4883EC30 sub rsp, 48
488D6C2430 lea rbp, [rsp+30H]
33C0 xor eax, eax
488945F8 mov qword ptr [rbp-08H], rax
488945F0 mov qword ptr [rbp-10H], rax
48894D10 mov gword ptr [rbp+10H], rcx
895518 mov dword ptr [rbp+18H], ed
G_M000_IG02: ;; offset=001BH
48B928667DEAFD7F0000 mov rcx, 0x7FFDEA7D6628
E8E6C0AB5F call CORINFO_HELP_NEWSFAST
488945F8 mov gword ptr [rbp-08H], rax
488B4DF8 mov rcx, gword ptr [rbp-08H]
8B4518 mov eax, dword ptr [rbp+18H]
894108 mov dword ptr [rcx+08H], eax
48B928667DEAFD7F0000 mov rcx, 0x7FFDEA7D6628
E8C9C0AB5F call CORINFO_HELP_NEWSFAST
488945F0 mov gword ptr [rbp-10H], rax
488B4DF0 mov rcx, gword ptr [rbp-10H]
C7410801000000 mov dword ptr [rcx+08H], 1
488B4DF8 mov rcx, gword ptr [rbp-08H]
488B55F0 mov rdx, gword ptr [rbp-10H]
FF15DCF0F4FF call [System.Enum:HasFlag(System.Enum):bool:this]
90 nop
G_M000_IG03: ;; offset=0065H
4883C430 add rsp, 48
5D pop rbp
C3 ret
; Total bytes of code 107 New tier0 codegen: ; Assembly listing for method Program:Test(int):bool:this
; Emitting BLENDED_CODE for X64 CPU with AVX - Windows
; Tier-0 compilation
; MinOpts code
; rbp based frame
; partially interruptible
G_M57656_IG01: ;; offset=0000H
55 push rbp
4883EC20 sub rsp, 32
488D6C2420 lea rbp, [rsp+20H]
33C0 xor eax, eax
488945F8 mov qword ptr [rbp-08H], rax
488945F0 mov qword ptr [rbp-10H], rax
48894D10 mov gword ptr [rbp+10H], rcx
895518 mov dword ptr [rbp+18H], edx
G_M57656_IG02: ;; offset=001BH
8B4518 mov eax, dword ptr [rbp+18H]
8945EC mov dword ptr [rbp-14H], eax
8B45EC mov eax, dword ptr [rbp-14H]
83E001 and eax, 1
83F801 cmp eax, 1
0F94C0 sete al
0FB6C0 movzx rax, al
G_M57656_IG03: ;; offset=0030H
4883C420 add rsp, 32
5D pop rbp
C3 ret
; Total bytes of code 54 Also, allow expansion for some other lightweight intrinsics for two reasons:
|
Avalonia's version of |
Linking to #9120. |
@EgorBo No activity on this for a while. Do you want to convert it to Draft until it is ready? Or are you waiting on more reviews? |
Yes, it's blocked on the other PR to introduce opt levels. |
Draft Pull Request was automatically closed for 30 days of inactivity. Please let us know if you'd like to reopen it. |
Diffs are negative (MinOpts only): https://dev.azure.com/dnceng-public/public/_build/results?buildId=167821&view=ms.vss-build-web.run-extensions-tab |
Plaintext-plaintext, Tier0 instrumented:
Mainly due to |
Even better numbers for YARP, start time is also decreased!
|
PTAL @AndyAyersMS @dotnet/jit-contrib |
Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
ping @AndyAyersMS @jakobbotsch - I need this to land for my next pr 🙂 |
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.
Looks like a reasonable set to expand to me.
@EgorBo sorry I missed seeing this. Going forward can you assign me as reviewer? Otherwise I may not look in the right places. Also if you have copies of your evaluation scripts laying around, point me at them. |
This reverts commit e1edb16.
This caused outerloop regressions: #82078 |
Expand some intrinsics in Tier0, e.g. these:
Plaintext-plaintext, Tier0 instrumented:
Mainly due to
Span.get_Item
andtypeof() == typeof()
E.g. here is Main's codegen for
typeof()
:This PR fixes it to just
return false