-
Notifications
You must be signed in to change notification settings - Fork 13.3k
refactor Lock
for parallel compiler
#109467
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
(rustbot has picked a reviewer for you, use r? to override) |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit 51cfd3e with merge 529b96fb784d8a2ac0a170a5e566f13095770326... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
borrow: Cell<bool>, | ||
mutex: RawMutex, |
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.
Couldn't these two fields be merged into a single AtomicBool
? The single-threaded version would become borrow.as_ptr().replace(true)
, while the multi-threaded version would use parking_lot_core::park
to handle waiting.
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.
Thanks! It makes sense, I'm trying it soon
#[derive(Debug)] | ||
pub struct Lock<T>(InnerLock<T>); | ||
pub struct Lock<T> { | ||
single_thread: bool, |
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.
Shouldn't loading PARALLEL
with relaxed ordering (or maybe a non-atomic read) be just as efficient? That avoids having to copy around the bool
in every lock.
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.
Thanks!
Finished benchmarking commit (529b96fb784d8a2ac0a170a5e566f13095770326): comparison URL. Overall result: ❌ regressions - ACTION NEEDEDBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
|
In my local tests, the |
r? @cjgillot assigning them as they are the assigned reviewer on the other pr as well |
@SparrowLii any updates on this? |
Closing this as #111713 is now merged |
part of #101566
This PR refactor
Lock
for parallel compiler, facilitating code review and perf test.ps. refactored
Lock
is notSend
orSync
. It depends on #107586 to get thread safety.