-
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
[ilasm] Lazily allocate memory in Indx256 #76590
Conversation
Tagging subscribers to this area: @JulieLeeMSFT Issue DetailsIndx256 is a trie (or prefix tree) used to map labels to instructions. It is very space-intensive because it allocates 256-element arrays for child nodes. This is a localized fix to lazily allocate the child arrays and to split them into two 128-element arrays to handle common cases such as ildasm's output (IL_). A more aggressive change to a different data structure would save much more memory but should probably include an analysis of why a trie was originally used. Fixes #38515, #38529, #43818, and #73139. I don't think hugeExpr1 (#38515) is going to get picked up by our current testing since the ilasmroundtrip run doesn't turn off tiered compilation, but I did check its behavior on x86 locally.
|
/azp run runtime-coreclr ilasmroundtrip |
No pipelines are associated with this pull request. |
@@ -133,65 +133,142 @@ class FIFO | |||
}; | |||
|
|||
|
|||
// Indx256 implements a trie (or prefix tree) on null-terminated sequences of BYTEs. | |||
// | |||
// It is very memory intensive because it allocates dense arrays for every node |
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.
Good explanation of this.
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.
Changes make sense to me. Only thing left to do is run ilasmroundtrip pipeline, which, we will need to run it manually in azure devops.
ilasmroundtrip had one failure that matches #76280 https://dev.azure.com/dnceng-public/public/_build/results?buildId=40034&view=results
|
Other failures were two builds and a non-ilasm instance of #76280. Retrying. |
Indx256 is a trie (or prefix tree) used to map labels to instructions. It is very space-intensive because it allocates 256-element arrays for child nodes. This is a localized fix to lazily allocate the child arrays and to split them into two 128-element arrays to handle common cases such as ildasm's output (IL_). A more aggressive change to a different data structure would save much more memory but should probably include an analysis of why a trie was originally used.
Fixes #38515, #38529, #43818, and #73139. I don't think hugeExpr1 (#38515) is going to get picked up by our current testing since the ilasmroundtrip run doesn't turn off tiered compilation, but I did check its behavior on x86 locally.