-
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
Investigate impact of method entry alignment #9912
Comments
FYI: There might be subtle reasons for some of these choices such as "we 16 byte align small methods" on x86. Because of IP to MethodDesc look ups using a Nibble Map we may not allow more than 1 method per 16-byte region on x86. |
Align Tier1, small and IBC hot methods to 16 byte boundaries for x64 and x86. Consensus from various folks I polled was that this isn't as helpful for arm architectures, so for now this is xarch only. This ensures that instruction prefetch pulls in as much code as possible. It should also improve performance stability in some benchmarks, as well as opening the door for possible loop-top aligment padding. Resolves #16873.
We are already 16 byte aligning on x64, see notes in dotnet/coreclr#21518. |
We're now 32 byte aligning Tier1 code, see #2249. |
@billwert @DrewScoggins this change might affect microbenchmarks. I hope that it's going to improve both the stability and perf |
With #42909, we align method entries containing loops with 32-bytes. |
This is a query that contains tests that we have seen marked as either regressions or improvements that had bimodal behavior, but after #42909, seemed to have stabilized. We should continue to track these and see if that is true. |
@AndyAyersMS - have you seen example of non-loop methods whose performance was affected because of misalignment? If not, I propose to close the issue. |
Current code alignment strategy seems a bit random. Best I can tell it is:
8 byte align when jitting and 16 byte align when prejitting16 byte align.Haven't looked at arm32 / arm64.
Over-aligning leads to wasted code space; under-aligning leads to possible perf issues ,either poor per or just randomly variable perf, as in #9815.
Generally speaking we'd prefer frequently-called methods to be maximally aligned and rarely called methods be minimally aligned. From a jit standpoint it seems like minopts/debug/tier0 code should always have minimum alignment; tier1 code should have maximum alignment, and the alignment of regularly optimized code is open for discussion.
Also note method entry alignment constrains loop top alignment (#11607).
category:cq
theme:basic-cq
skill-level:expert
cost:large
impact:small
The text was updated successfully, but these errors were encountered: