-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Add documentation for hot/cold splitting #73029
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
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsThis PR adds documentation for the current status of hot/cold splitting support in the JIT, as of my internship's conclusion.
|
@AndyAyersMS PTAL, thank you! |
|
||
This document describes the current state of hot/cold splitting in the JIT. | ||
|
||
Hot/Cold splitting is a PGO optimization where generated code is split into frequently-executed ("hot") and |
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.
Hot/cold splitting is not strictly Profile Guided Optimization. It is quite effective even without profile data.
|
||
## Testing the JIT Without Runtime Support | ||
|
||
Without runtime support for hot/cold splitting in .NET Core yet, testing the JIT's existing hot/cold splitting support |
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.
Without runtime support for hot/cold splitting in .NET Core yet, testing the JIT's existing hot/cold splitting support | |
Without runtime support for hot/cold splitting in .NET as of summer 2022, testing the JIT's existing hot/cold splitting support |
Nit: We have retired .NET Core
as the name a few years ago. We are calling the product just .NET
now.
Thanks for the review @jkotas, I've added your feedback in. |
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.
Nice writeup.
I noted a few instances of passive voice. I don't expect you to go through and try and remove all (or even most) of the rest. Just pointing out that often times it's not too hard to find a more active phrasing.
Hot/Cold splitting in the JIT was previously implemented for AOT-compiled NGEN images in .NET Framework. With hot/cold | ||
splitting support in Crossgen2 [in progress](https://github.com/dotnet/runtimelab/tree/feature/hot-cold-splitting) | ||
(and no existing support for splitting dynamically-generated code), the feature has gone untested in the JIT since | ||
retiring .NET Framework -- as such, regressions have surely been introduced. Furthermore, this existing implementation | ||
has several major limitations; functions with certain features, like exception handling or switch tables, cannot be | ||
split yet. Finally, with ARM64/x64 performance parity being a high priority for CoreCLR, it is key hot/cold splitting | ||
is implemented for ARM64 code generation, too. |
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.
I think somebody could get confused by the mixed use of tense here and not be entirely sure what the "current state" actually is.
Consider sectioning this part off as ## Background
and describing just the before state in past tense.
Hot/Cold splitting is an optimization where generated code is split into frequently-executed ("hot") and | ||
rarely-executed ("cold") parts and placed in separate memory regions. Increased hot code density better leverages |
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.
Nit -- keep an eye out for passive voice and try to avoid it where you can. Here it seems pretty easy:
Hot/Cold splitting is an optimization where generated code is split into frequently-executed ("hot") and | |
rarely-executed ("cold") parts and placed in separate memory regions. Increased hot code density better leverages | |
Hot/Cold splitting is an optimization that splits code into frequently-executed ("hot") and | |
rarely-executed ("cold") parts and places the parts in separate memory regions. Increased hot code density better leverages |
|
||
Hot/Cold splitting is an optimization where generated code is split into frequently-executed ("hot") and | ||
rarely-executed ("cold") parts and placed in separate memory regions. Increased hot code density better leverages | ||
spatial locality, which can improve application performance via fewer instruction cache misses, less OS paging, and |
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.
spatial locality, which can improve application performance via fewer instruction cache misses, less OS paging, and | |
spatial locality, improving application performance via fewer instruction cache misses, less OS paging, and |
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.
(you get the idea)
architecture-specific workarounds. However, if the JIT supports splitting functions multiple times in the future, this | ||
may be worth revisiting. | ||
|
||
In the absence of PGO data, the JIT assumes exceptions occur rarely to justify moving handlers to the cold section. |
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.
In the absence of PGO data, the JIT assumes exceptions occur rarely to justify moving handlers to the cold section. | |
In the absence of PGO data, the JIT assumes exceptions occur rarely; this justifies moving handlers to the cold section. |
@AndyAyersMS thank you for the review -- I've cleaned up some of the phrasing. |
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.
Didn't check everywhere but looks like quite a bit of the passive voice was cleaned up.
Thanks.
This PR adds documentation for the current status of hot/cold splitting support in the JIT, as of my internship's conclusion.