Support DualMapAllocator on aarch64 macOS, and add MapJITAllocator#60117
Closed
xal-0 wants to merge 4 commits intoJuliaLang:masterfrom
Closed
Support DualMapAllocator on aarch64 macOS, and add MapJITAllocator#60117xal-0 wants to merge 4 commits intoJuliaLang:masterfrom
xal-0 wants to merge 4 commits intoJuliaLang:masterfrom
Conversation
This allows each allocator to choose if it supports this optimization.
f051cae to
708ab99
Compare
Member
Author
|
I'll need to tweak the allocator interface more than I originally thought. I'd like to keep using the small code model on aarch64, but it isn't possible without merging the three independent allocators we use at the moment. We need to make sure the |
Member
Author
|
Putting this on hold until I have the time to make a code model-aware allocator. #60031 is no longer blocked by memory manager issues, so we can keep using the |
Member
Author
|
Closing, since this must be reimplemented on top of #60915 in order to work with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In conjunction with #60105, this change brings our optimized memory management over to aarch64 macOS, where JITLink is the only supported linker.
First, this changes the way we test for
DualMapAllocatorsupport so that it will be selected on macOS again. We are not allowed tommapRXMAP_SHAREDpages directly, but it's okay tommapwith no protections andmprotectafterwards, so test for that.However, when it is supported, we always prefer to use the new
MapJITAllocatorfor executable pages.MapJITAllocatorusesMAP_JITpages, which are "seen" by every thread as either RX or RW, according to the value of a special thread-local register. When we use this allocator, only a single mapping is required, no copies are necessary when JITting, and nomprotectsyscalls are necessary to finalize the code. Other threads can continue to execute code in theMAP_JITregion while we write to it, since only the thread that is JITting has thejit_rwflag enabled.Bootstrapping sees about a ~10% reduction in peak RSS and run time, with bigger improvements on very JIT-heavy workloads.