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>
impl<C: RankEngine> GeneralizedMockerEngine<C>
Sourcepub const fn identity(&self) -> EngineIdentity
pub const fn identity(&self) -> EngineIdentity
Stable identity of this logical worker.
Sourcepub const fn dp_size(&self) -> NonZeroU32
pub const fn dp_size(&self) -> NonZeroU32
Number of scheduler ranks composed behind the group barrier.
Sourcepub fn rank_identities(
&self,
) -> impl ExactSizeIterator<Item = RankIdentity> + '_
pub fn rank_identities( &self, ) -> impl ExactSizeIterator<Item = RankIdentity> + '_
Stable identities of the scheduler ranks in DP-rank order.
Sourcepub fn new(
identity: EngineIdentity,
config: GeneralizedEngineConfig<C::Config>,
) -> Result<Self>
pub fn new( identity: EngineIdentity, config: GeneralizedEngineConfig<C::Config>, ) -> Result<Self>
Construct every rank in a logical engine.
Sourcepub fn new_with_rank_factory(
identity: EngineIdentity,
dp_size: NonZeroU32,
make_rank: impl FnMut(RankIdentity) -> Result<C>,
) -> Result<Self>
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.
Sourcepub fn apply_command_effects(
&mut self,
command: SchedulerCommand<C::Command>,
now_ms: f64,
) -> Result<EngineEffects<C::CommandEffects>>
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.
Sourcepub fn is_ready(&self) -> bool
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.
Sourcepub fn waiting_for_external_command(&self) -> bool
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.
Sourcepub fn execute_pass(
&mut self,
now_ms: f64,
) -> Result<Option<EnginePassStarted<C::PassStartEffects>>>
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.
Sourcepub fn complete_pass(
&mut self,
pass_id: PassId,
end_ms: f64,
) -> Result<EnginePassCompleted<C::PassCompletionEffects>>
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.
Sourcepub fn next_internal_deadline_ms(&self) -> Option<f64>
pub fn next_internal_deadline_ms(&self) -> Option<f64>
Earliest valid internal-work deadline across all ranks.
Sourcepub fn process_internal_work(
&mut self,
now_ms: f64,
) -> Result<EngineEffects<C::InternalEffects>>
pub fn process_internal_work( &mut self, now_ms: f64, ) -> Result<EngineEffects<C::InternalEffects>>
Process internal work whose rank deadline is due.
Sourcepub fn is_drained(&self) -> bool
pub fn is_drained(&self) -> bool
Whether every rank is drained and no grouped pass remains in flight.