diff --git a/Cargo.lock b/Cargo.lock index 4005d2f41b0..056b0bf2865 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8186,6 +8186,7 @@ dependencies = [ "solana-sdk", "solana-timings", "solana-unified-scheduler-logic", + "static_assertions", "vec_extract_if_polyfill", ] diff --git a/programs/sbf/Cargo.lock b/programs/sbf/Cargo.lock index b7d9cd54e50..d78d07199c5 100644 --- a/programs/sbf/Cargo.lock +++ b/programs/sbf/Cargo.lock @@ -6772,6 +6772,7 @@ dependencies = [ "solana-sdk", "solana-timings", "solana-unified-scheduler-logic", + "static_assertions", "vec_extract_if_polyfill", ] diff --git a/unified-scheduler-pool/Cargo.toml b/unified-scheduler-pool/Cargo.toml index 46a020c6612..e4dd6015ed4 100644 --- a/unified-scheduler-pool/Cargo.toml +++ b/unified-scheduler-pool/Cargo.toml @@ -22,6 +22,7 @@ solana-runtime = { workspace = true } solana-sdk = { workspace = true } solana-timings = { workspace = true } solana-unified-scheduler-logic = { workspace = true } +static_assertions = { workspace = true } vec_extract_if_polyfill = { workspace = true } [dev-dependencies] diff --git a/unified-scheduler-pool/src/lib.rs b/unified-scheduler-pool/src/lib.rs index 1b9c471137c..8c2745e138f 100644 --- a/unified-scheduler-pool/src/lib.rs +++ b/unified-scheduler-pool/src/lib.rs @@ -37,6 +37,7 @@ use { }, solana_timings::ExecuteTimings, solana_unified_scheduler_logic::{SchedulingStateMachine, Task, UsageQueue}, + static_assertions::const_assert_eq, std::{ fmt::Debug, marker::PhantomData, @@ -475,7 +476,8 @@ enum SubchanneledPayload { CloseSubchannel, } -type NewTaskPayload = SubchanneledPayload; +type NewTaskPayload = SubchanneledPayload>; +const_assert_eq!(mem::size_of::(), 16); // A tiny generic message type to synchronize multiple threads everytime some contextual data needs // to be switched (ie. SchedulingContext), just using a single communication channel. @@ -1092,10 +1094,9 @@ impl, TH: TaskHandler> ThreadManager { // Prepare for the new session. match new_task_receiver.recv() { - Ok(NewTaskPayload::OpenSubchannel(( - new_context, - new_result_with_timings, - ))) => { + Ok(NewTaskPayload::OpenSubchannel(context_and_result_with_timings)) => { + let (new_context, new_result_with_timings) = + *context_and_result_with_timings; // We just received subsequent (= not initial) session and about to // enter into the preceding `while(!is_finished) {...}` loop again. // Before that, propagate new SchedulingContext to handler threads @@ -1332,10 +1333,10 @@ impl, TH: TaskHandler> ThreadManager { assert!(!self.are_threads_joined()); assert_matches!(self.session_result_with_timings, None); self.new_task_sender - .send(NewTaskPayload::OpenSubchannel(( + .send(NewTaskPayload::OpenSubchannel(Box::new(( context, result_with_timings, - ))) + )))) .expect("no new session after aborted"); } }