Skip to content
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

Apply cleanups to solana-core for unified scheduler #4123

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

ryoqun
Copy link
Member

@ryoqun ryoqun commented Dec 15, 2024

Problem

There are various small changes to support block production by unified scheduler.

Summary of Changes

Do them at once in a single pr, rather than 6 different prs.

Commits are well logically separated.

No functional change, so no test is added.

extracted from #3946, see the pr for the general overview.

@ryoqun ryoqun force-pushed the unified-scheduler-core-cleanups branch from f6fc326 to f7c63e0 Compare December 15, 2024 07:22
@ryoqun ryoqun changed the title Unified scheduler core cleanups Apply various cleanups to solana-core for unified scheduler Dec 16, 2024
@ryoqun ryoqun changed the title Apply various cleanups to solana-core for unified scheduler Apply cleanups to solana-core for unified scheduler Dec 16, 2024
@@ -803,11 +807,25 @@ impl BankingStage {
}
}

#[cfg_attr(feature = "dev-context-only-utils", qualifiers(pub))]
pub(crate) fn update_bank_forks_and_poh_recorder_for_new_tpu_bank(
Copy link
Member Author

@ryoqun ryoqun Dec 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refer to https://github.com/anza-xyz/agave/pull/3946/files#r1886311350 (or #3946 (comment)) for justification of this change.

@@ -1409,6 +1410,7 @@ impl Validator {
let cluster_slots =
Arc::new(crate::cluster_slots_service::cluster_slots::ClusterSlots::default());

let root_bank_cache = RootBankCache::new(bank_forks.clone());
Copy link
Member Author

@ryoqun ryoqun Dec 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refer to https://github.com/anza-xyz/agave/pull/3946/files#r1886312626 (or #3946 (comment)) for justification of this movement.

Comment on lines +231 to +232
pub type BankingPacketBatch = Arc<Vec<PacketBatch>>;
pub type BankingPacketReceiver = Receiver<BankingPacketBatch>;
Copy link
Member Author

@ryoqun ryoqun Dec 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these types are planned to be used by solana-unified-scheduler-pool crate, so they need to be moved higher in the dep graph from solana-core.

poh_recorder: &RwLock<PohRecorder>,
tpu_bank: Bank,
track_transaction_indexes: bool,
) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not returning BankWithScheduler is intentional because production code (i.e. relevant ReplayingStage) doesn't need it, while making dev call-sites more verbose a bit.

@ryoqun ryoqun force-pushed the unified-scheduler-core-cleanups branch from f7c63e0 to aabd2ac Compare December 16, 2024 13:08
@@ -13,6 +13,7 @@ edition = { workspace = true }
ahash = { workspace = true }
bincode = { workspace = true }
bv = { workspace = true, features = ["serde"] }
crossbeam-channel = { workspace = true }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kind of arbitrary extra dep addition, but i think it's okay for better code organization. alternatively, we can define BankingPacketBatch/BankingPacketReceiver at solana-unified-scheduler-pool without a single dep graph chagne, but it felt me that it's off-place.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a big fan of putting it here. perf seems isolated from any communication, so doesn't seem correct to me to add this just for a type-alias.

Maybe now is a good time to just set up a more (imo) reasonable structure of crates? (doesn't matter THAT much since both banking and sigverify are in core)
A typical pattern that I've seen for crates is something like this:

/
├── stage1/
├── communication/
└── stage2/

The communication crate is separate from both the upstream and downstream consumer(s), and they both just need to follow the interface defined in communication. Think it is a step toward separating sigverify & banking code from core as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pondered on naming for awhile. how about solana-core-types as the name of the communication crate?

I acknowledge the awkwardness of putting these into solana-perf and I understand the appeal of cleaner crate organization you suggested.

that said, I think that crate will be very small and kind of limited, in practice. say, we can't put the sibling type alias BankingPacketSender into that crate, because that would pull some impls into the crate (i.e. TracedSender). so, the crate will contain strictly some common set of type aliases basically.

so, i named the crate as -type with that in mind.

if it's really okay for you, i'll create such a crate in real quick.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These would be specific to agave client, so agave- prefix is more appropriate for naming imo.
If it's just going to be communication between SigVerifyStage (possibly soon to be renamed VerifyStage) and BankingStage (should we rename this to BlockProductionStage?) I wonder if the name core-types is too generic - there's a LOT of other stuff in core

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, how about agave-banking-stage-types, then? i thought we won't rename replaying-stage to block-verification-stage, so picked the banking-stage likewise

@ryoqun
Copy link
Member Author

ryoqun commented Dec 16, 2024

@apfitzge thanks for quick review. Other than #4123 (comment), is there other concerns? If other changes are mergeable, I'll back-off the commit and create another pr for it, while landing other changes in this pr, if possible..

@apfitzge
Copy link

@apfitzge thanks for quick review. Other than #4123 (comment), is there other concerns? If other changes are mergeable, I'll back-off the commit and create another pr for it, while landing other changes in this pr, if possible..

Still looking, have some other stuff need to review this morning, and didn't get a chance to finish the review of this one yet

Copy link

@apfitzge apfitzge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a few comments here and in the linked comments for justification of changes.

@ryoqun ryoqun requested a review from apfitzge December 18, 2024 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants