-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Revert "[NativeAOT] Add null checks into memcpy/memset helpers" #98681
Conversation
This reverts commit 6d4fc1a.
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas Issue DetailsReverts #98547
|
The fix is not correct as discovered in #98623 (comment) . Also, there may be unforeseen perf issues due to #98623 (comment) . I am thinking that we should revert it and wait for the proper fix from @EgorBo (#98623). |
cc @filipnavara |
I’m fine with reverting and waiting for a more comprehensive fix. However, the Roslyn issue is not invalidating the fix completely. The managed code paths still trigger the NRE now where it would not previously trigger it. It’s only broken in the PInvoke path of the Memmove for large sizes. The performance cliff for SpanHelpers.Fill is also not present in the NativeAOT code since the usages of Unsafe.InitBlock are still in place. They are only removed in @EgorBo’s 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.
Up to you, hopefully, I'll land my PR tomorrow/this week 🙂
The problematic call chain is user code -> The change regressed performance of common memory clearing operations like Span.Clear or Memory.Clear by up to 2x+. For example:
Results with PublishAot on Winx64, Intel 9: Bulk memory clearing is part of many operations. I am worried that we will start getting reports of random perf regressions and we will have to spend time chasing them down to this change if we keep it in. |
I see. I thought you were referring to performance regressions for small blocks of constant size (which, presumably, still get optimized by JIT and don’t end up in the helper). I didn’t realise that |
Reverts #98547