Skip to main content

GeneralizedMockerEngine

Struct GeneralizedMockerEngine 

Source
pub struct GeneralizedMockerEngine<C: RankEngine> { /* private fields */ }
Expand description

Single-rank or attention-DP grouped generalized mock engine.

dp_size == 1 is the single-rank layer. Larger values compose independent rank cores behind one logical-worker barrier.

Multi-rank mutations are not transactional across a group. If a grouped operation fails after an earlier rank may have changed state, the logical engine becomes poisoned and rejects later mutations. A targeted command is delegated to exactly one rank; its implementation owns command atomicity, and ordinary command rejections remain recoverable.

Implementations§

Source§

impl<C: RankEngine> GeneralizedMockerEngine<C>

Source

pub const fn identity(&self) -> EngineIdentity

Stable identity of this logical worker.

Source

pub const fn dp_size(&self) -> NonZeroU32

Number of scheduler ranks composed behind the group barrier.

Source

pub fn rank_identities( &self, ) -> impl ExactSizeIterator<Item = RankIdentity> + '_

Stable identities of the scheduler ranks in DP-rank order.

Source

pub fn new( identity: EngineIdentity, config: GeneralizedEngineConfig<C::Config>, ) -> Result<Self>

Construct every rank in a logical engine.

Source

pub fn new_with_rank_factory( identity: EngineIdentity, dp_size: NonZeroU32, make_rank: impl FnMut(RankIdentity) -> Result<C>, ) -> Result<Self>

Construct every rank with a caller-supplied factory.

This is the runtime-provider seam for rank implementations whose serialized configuration names a provider but cannot itself contain a process-local callback, such as an AIC latency model.

Source

pub fn apply_command_effects( &mut self, command: SchedulerCommand<C::Command>, now_ms: f64, ) -> Result<EngineEffects<C::CommandEffects>>

Apply a command to one rank.

When the engine is idle and internal work is due at or before now_ms, this returns a retryable error without mutation. The caller must call Self::process_internal_work and then retry the command.

Source

pub fn is_ready(&self) -> bool

Whether the logical engine can commit a grouped pass.

No sibling may start a new pass while an earlier grouped pass is awaiting completion. Otherwise, one ready rank that is not blocked on externally commanded ownership makes the group ready. A held source or reserved destination remains owned by the engine, but must not create effect-free passes while it waits for release/activation.

Source

pub fn waiting_for_external_command(&self) -> bool

Whether every currently ready rank is blocked on an external command.

Attention-DP uses all, not any: an unrelated ready sibling must still be allowed to expose a scheduler livelock or make progress.

Source

pub fn execute_pass( &mut self, now_ms: f64, ) -> Result<Option<EnginePassStarted<C::PassStartEffects>>>

Eagerly commit one pass on every currently ready rank.

Returns None when no rank has work. Starting a second pass before completing the first is a caller error.

Source

pub fn complete_pass( &mut self, pass_id: PassId, end_ms: f64, ) -> Result<EnginePassCompleted<C::PassCompletionEffects>>

Complete the committed pass and release pass-end effects.

end_ms may be later than the modeled boundary (for example when a wall-clock driver wakes late), but never earlier.

Source

pub fn next_internal_deadline_ms(&self) -> Option<f64>

Earliest valid internal-work deadline across all ranks.

Source

pub fn process_internal_work( &mut self, now_ms: f64, ) -> Result<EngineEffects<C::InternalEffects>>

Process internal work whose rank deadline is due.

Source

pub fn is_drained(&self) -> bool

Whether every rank is drained and no grouped pass remains in flight.

Auto Trait Implementations§

§

impl<C> Freeze for GeneralizedMockerEngine<C>
where Vec<C>: Freeze, Option<PendingGroupPass<<C as RankEngine>::PendingPass>>: Freeze,

§

impl<C> RefUnwindSafe for GeneralizedMockerEngine<C>
where Vec<C>: RefUnwindSafe, Option<PendingGroupPass<<C as RankEngine>::PendingPass>>: RefUnwindSafe,

§

impl<C> Send for GeneralizedMockerEngine<C>
where Vec<C>: Send, Option<PendingGroupPass<<C as RankEngine>::PendingPass>>: Send,

§

impl<C> Sync for GeneralizedMockerEngine<C>
where Vec<C>: Sync, Option<PendingGroupPass<<C as RankEngine>::PendingPass>>: Sync,

§

impl<C> Unpin for GeneralizedMockerEngine<C>
where Vec<C>: Unpin, Option<PendingGroupPass<<C as RankEngine>::PendingPass>>: Unpin,

§

impl<C> UnsafeUnpin for GeneralizedMockerEngine<C>
where Vec<C>: UnsafeUnpin, Option<PendingGroupPass<<C as RankEngine>::PendingPass>>: UnsafeUnpin,

§

impl<C> UnwindSafe for GeneralizedMockerEngine<C>
where Vec<C>: UnwindSafe, Option<PendingGroupPass<<C as RankEngine>::PendingPass>>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more