-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Feature - Cooperative Program Loading #34407
Merged
Lichtso
merged 9 commits into
solana-labs:master
from
Lichtso:feature/cooperative_program_loading
Dec 18, 2023
Merged
Feature - Cooperative Program Loading #34407
Lichtso
merged 9 commits into
solana-labs:master
from
Lichtso:feature/cooperative_program_loading
Dec 18, 2023
Conversation
This file contains 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
Lichtso
force-pushed
the
feature/cooperative_program_loading
branch
2 times, most recently
from
December 12, 2023 20:28
85fee8b
to
1556297
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #34407 +/- ##
==========================================
- Coverage 81.8% 81.8% -0.1%
==========================================
Files 767 819 +52
Lines 209271 221004 +11733
==========================================
+ Hits 171331 180934 +9603
- Misses 37940 40070 +2130 |
…d of returning the list of missing entries.
…d of returning a LoadedProgramsForTxBatch.
Lichtso
force-pushed
the
feature/cooperative_program_loading
branch
from
December 14, 2023 12:07
1556297
to
6586075
Compare
pgarg66
reviewed
Dec 16, 2023
pgarg66
approved these changes
Dec 18, 2023
ryoqun
added a commit
to ryoqun/solana
that referenced
this pull request
Dec 21, 2023
This reverts commit 22bfcd9.
ryoqun
added a commit
to ryoqun/solana
that referenced
this pull request
Dec 21, 2023
)"" This reverts commit ea0f6ac.
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.
Problem
Currently transaction batches race in parallel to load, verify and compile missing cache entries.
Instead they should be coordinating and split these tasks to distribute the workload across the threads and to avoid redundant work.
Summary of Changes
LoadedPrograms::extract()
to use a mutable parameters instead of returning them in order to support multiple iterations.SecondLevel
structure toLoadedPrograms
to have a per address cooperative loading lock.Principle
A TX batch in the
Bank
starts out by putting all the programs it requests into the "missing" set and an empty TX batch local cache. It then iteratively callsLoadedPrograms::extract()
which in every iteration transfers some programs from the "missing" set to the TX batch local cache, according to what it found in the global cache. Additionally, during each iteration it tries to select a still missing entry (which no other TX batch has selected yet) and load it itself. In the next iteration it publishes its loading result to the global cache andLoadedPrograms::extract()
will use that to complete the TX batch local cache in turn.