-
Notifications
You must be signed in to change notification settings - Fork 23
Experimental: Proof of concept of parallel overlay root calculation #170
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
base: main
Are you sure you want to change the base?
Conversation
Cherry-picks: Mmap page manager only flushes dirty pages
✅ Heimdall Review Status
|
| // SAFETY: OverlayState is thread-safe because: | ||
| // - Arc<[...]> provides thread-safe reference counting | ||
| // - All fields are immutable after construction | ||
| // - No interior mutability is used | ||
| // - All operations are read-only or create new instances | ||
| unsafe impl Send for OverlayState {} | ||
| unsafe impl Sync for OverlayState {} |
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.
Is there any reason we can't derive Send+Sync instead of manual impl?
| // Ignore send errors - the channel may be closed during shutdown | ||
| sender.send(work_item).unwrap(); |
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.
Is it ok if this panics here (from calling unwrap on a send error, even if we want to ignore the send error)?
| let end_idx = if i == thread_count { | ||
| // Last thread handles any remaining addresses | ||
| addresses.len() |
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.
Should this be i == thread_count - 1? Since i is zero-indexed, wouldn't it always miss this case?
|
General question: what happens if one of the hash builder threads panics? I think |
This updates the overlay root calculation code to compute partial roots for a given trie using an internal thread pool, sharded by first nibble, and then combines these together into a single root.
Uses a fork of alloy-trie with the ability to compute partial roots from a
HashBuilderand compute the merged root from an array ofHashBuilders.