pub struct BatchDecision {
pub lanes: usize,
pub item_threads: usize,
}Expand description
The route batch_decision selected.
§The route contract
A decision is the whole concurrency of one call, and a route must never
discard half of it: lanes outer lanes run a contiguous share of the items,
each lane may run its items on item_threads threads, and batch_decision
keeps lanes * item_threads <= budget. A route that cannot run an item on a
sub-team inside a lane either honours both axes or refuses a decision that
asks for both — only a forced BatchStrategy::Split produces lanes > 1
together with item_threads > 1 — with
crate::ExecError::StrategyUnavailable, before it writes any output. Silently
running the items serially inside the lanes is not a route.
The routes in tcontract, and where each one stands:
- the faer strategy honours both axes: every item runs with
Par::rayon(item_threads)inside its lane’s share of the borrowed pool, which nests there (crates/tcontract/src/strategy/faer.rs); - the packed driver refuses it
(
crates/tcontract/src/driver/route.rs): its inner parallelism is a co-scheduled, barrier-bearing team, and a lane worker cannot join one without blocking on an outer barrier; contract_batchedrefuses it too (crates/tcontract/src/batch.rs): its schedule is one item per lane, or the items one after another on the whole context, as the decision log records.
§Examples
use tcontract_exec::batch::BatchDecision;
let d = BatchDecision { lanes: 2, item_threads: 1 };
assert_eq!(d.lanes * d.item_threads, 2);Fields§
§lanes: usizeOuter lanes; each lane runs a contiguous share of the items.
item_threads: usizeThreads one item may use. 1 for a route that runs items serially inside
each lane; a BatchStrategy::Split asks for both lanes and item threads,
and a route that cannot run item threads inside lanes refuses it (see the
type’s route contract).
Trait Implementations§
Source§impl Clone for BatchDecision
impl Clone for BatchDecision
impl Copy for BatchDecision
Source§impl Debug for BatchDecision
impl Debug for BatchDecision
impl Eq for BatchDecision
Source§impl PartialEq for BatchDecision
impl PartialEq for BatchDecision
impl StructuralPartialEq for BatchDecision
Auto Trait Implementations§
impl Freeze for BatchDecision
impl RefUnwindSafe for BatchDecision
impl Send for BatchDecision
impl Sync for BatchDecision
impl Unpin for BatchDecision
impl UnsafeUnpin for BatchDecision
impl UnwindSafe for BatchDecision
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more