-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Switch Windows Checked build to -O2
from -O1
#59235
Switch Windows Checked build to -O2
from -O1
#59235
Conversation
Tagging subscribers to this area: @hoyosjs Issue DetailsThat is, optimize for speed, not for size.
|
Does it make superpmi faster? |
017370e
to
134704d
Compare
For win-x64 Checked build, I measure a code size increase of: clrjit.dll: 3,620,864 => 4,058,112 For runtime, superpmi replay (which is almost 100% JIT time) is 11% faster with -O2 across our current collections. |
134704d
to
64dd823
Compare
/azp run runtime-coreclr outerloop, runtime-coreclr jitstress |
Azure Pipelines successfully started running 2 pipeline(s). |
The win-x64 ABI requires allocating 32 bytes of outgoing argument stack space for every call, which can be used by callees. In the case where there are no calls in a function, there is no need to allocate that space. The JIT computes the required argument space during `fgSimpleLowering` by processing the IR and looking for call instructions, but also accounting for a few special cases where calls are not visible in the IR. One case was missing, leading to a zero-sized outgoing argument space even though a call was still generated. This can cause corruption in the caller stack frame. The case is where there are no explicit calls but the JIT is going to generate a PInvoke frame initialization helper call. This shouldn't happen, however, it occurs because the JIT eliminates a PInvoke that is statically dead code, but still generates the prolog setup code. A general solution would be to eliminate the PInvoke setup code if there are no remaining PInvokes in the function. The simple change made here is to ensure there is sufficient outgoing argument space for the PInvoke helper call if that will be generated. This was found by seeing test crashes due to stack corruption when building the CLR with the VC++ compiler `-O2` optimization switch, which stored data in the incoming argument stack space of the PInvoke helper function (with PR dotnet#59235). There are 5 SPMI diffs: 2 in coreclr tests (the ones that failed at runtime), 2 in libraries tests, and 1 in System.Net.Http.WinHttpChannelBinding:.ctor(SafeWinHttpHandle):this
64dd823
to
983194e
Compare
/azp run runtime-coreclr outerloop, runtime-coreclr jitstress |
Azure Pipelines successfully started running 2 pipeline(s). |
…per (#60050) The win-x64 ABI requires allocating 32 bytes of outgoing argument stack space for every call, which can be used by callees. In the case where there are no calls in a function, there is no need to allocate that space. The JIT computes the required argument space during `fgSimpleLowering` by processing the IR and looking for call instructions, but also accounting for a few special cases where calls are not visible in the IR. One case was missing, leading to a zero-sized outgoing argument space even though a call was still generated. This can cause corruption in the caller stack frame. The case is where there are no explicit calls but the JIT is going to generate a PInvoke frame initialization helper call. This shouldn't happen, however, it occurs because the JIT eliminates a PInvoke that is statically dead code, but still generates the prolog setup code. A general solution would be to eliminate the PInvoke setup code if there are no remaining PInvokes in the function. The simple change made here is to ensure there is sufficient outgoing argument space for the PInvoke helper call if that will be generated. This was found by seeing test crashes due to stack corruption when building the CLR with the VC++ compiler `-O2` optimization switch, which stored data in the incoming argument stack space of the PInvoke helper function (with PR #59235). There are 5 SPMI diffs: 2 in coreclr tests (the ones that failed at runtime), 2 in libraries tests, and 1 in System.Net.Http.WinHttpChannelBinding:.ctor(SafeWinHttpHandle):this
The OSX test failure is due to infra (out of disk space). |
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.
LGTM
That is, optimize for speed, not for size. Don't do this for Windows x86, due to dotnet#59845
983194e
to
a380ba7
Compare
libraries failure is #60097 |
That is, optimize for speed, not for size.