pub trait ReplicatedTextExecutionStrategy<A, B, S, R, P>where
B: NeuralBackend,
S: RuntimeState<B>,
A: LayeredArchitecture<B, S>,
R: LayerwisePolicy<B, A::Unit>,
P: LayerwisePolicy<B, A::Unit, Error = R::Error>,
A::Error: Display,
R::Error: Display,{
type Runtime;
const PARTITIONED_SESSION: bool = false;
const DISTRIBUTED_PHASE_AGREEMENT: bool = false;
// Required methods
fn bounded_policy(runtime: &Self::Runtime) -> Option<&P>;
fn execution_residency(
runtime: &Self::Runtime,
selected: &SelectedReplicatedTextRealization,
) -> ExecutionResidency;
fn forward_with_observer<'a, O>(
&mut self,
runtime: &mut Self::Runtime,
input: A::Input<'a>,
state: &mut S,
pass: ExpertPass,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
observer: &mut O,
) -> Result<(B::Tensor, A::ForwardContext), ReplicatedTextSessionError<A::Error, R::Error, Infallible>>
where O: ActivationObserver<B::Tensor, A::Error> + ?Sized;
// Provided methods
fn observe_output<O>(
_runtime: &mut Self::Runtime,
output: &B::Tensor,
observer: &mut O,
_context: &<B::Tensor as Tensor>::Context,
) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, R::Error, Infallible>>
where O: ActivationObserver<B::Tensor, A::Error> + ?Sized { ... }
fn publish_observed_output(
_runtime: &mut Self::Runtime,
output: B::Tensor,
_context: &<B::Tensor as Tensor>::Context,
) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, R::Error, Infallible>> { ... }
fn prediction_target_capture(
_runtime: &mut Self::Runtime,
forward: &A::ForwardContext,
_context: &<B::Tensor as Tensor>::Context,
) -> Result<Option<B::Tensor>, ReplicatedTextSessionError<A::Error, R::Error, Infallible>> { ... }
fn publish_prediction_target_capture(
_runtime: &mut Self::Runtime,
capture: B::Tensor,
_context: &<B::Tensor as Tensor>::Context,
) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, R::Error, Infallible>> { ... }
fn apply_prediction_target_operation<O>(
_runtime: &mut Self::Runtime,
_state: &mut S,
_operation: O,
_context: &<B::Tensor as Tensor>::Context,
) -> Result<Option<O::Output>, ReplicatedTextSessionError<A::Error, R::Error, Infallible>>
where O: PredictionTargetOperation<A, B, S> { ... }
fn commit_after_completion(
_runtime: &mut Self::Runtime,
epoch: DistributedCommitEpoch,
_context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> DistributedCommitOutcome { ... }
fn agree_distributed_phase(
_runtime: &mut Self::Runtime,
_phase: DistributedExecutionPhase,
local_success: bool,
_context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<bool, ReplicatedTextSessionError<A::Error, R::Error, Infallible>> { ... }
}Expand description
Statically dispatched extension point for one replicated text unit strategy.
Ordinary execution and routed execution share the surrounding session, state, prompt-cache, observation, report, rollback, and completion logic.
Provided Associated Constants§
Sourceconst PARTITIONED_SESSION: bool = false
const PARTITIONED_SESSION: bool = false
Whether this strategy executes one rank of a partitioned session.
Sourceconst DISTRIBUTED_PHASE_AGREEMENT: bool = false
const DISTRIBUTED_PHASE_AGREEMENT: bool = false
Whether control phases use a selected bounded all-rank agreement.
Required Associated Types§
Required Methods§
Sourcefn bounded_policy(runtime: &Self::Runtime) -> Option<&P>
fn bounded_policy(runtime: &Self::Runtime) -> Option<&P>
Returns bounded residency state for the shared session report.
Sourcefn execution_residency(
runtime: &Self::Runtime,
selected: &SelectedReplicatedTextRealization,
) -> ExecutionResidency
fn execution_residency( runtime: &Self::Runtime, selected: &SelectedReplicatedTextRealization, ) -> ExecutionResidency
Returns the execution residency actually installed on this rank.
Sourcefn forward_with_observer<'a, O>(
&mut self,
runtime: &mut Self::Runtime,
input: A::Input<'a>,
state: &mut S,
pass: ExpertPass,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
observer: &mut O,
) -> Result<(B::Tensor, A::ForwardContext), ReplicatedTextSessionError<A::Error, R::Error, Infallible>>
fn forward_with_observer<'a, O>( &mut self, runtime: &mut Self::Runtime, input: A::Input<'a>, state: &mut S, pass: ExpertPass, context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, observer: &mut O, ) -> Result<(B::Tensor, A::ForwardContext), ReplicatedTextSessionError<A::Error, R::Error, Infallible>>
Executes one complete layered pass through the selected unit strategy.
Provided Methods§
Sourcefn observe_output<O>(
_runtime: &mut Self::Runtime,
output: &B::Tensor,
observer: &mut O,
_context: &<B::Tensor as Tensor>::Context,
) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, R::Error, Infallible>>
fn observe_output<O>( _runtime: &mut Self::Runtime, output: &B::Tensor, observer: &mut O, _context: &<B::Tensor as Tensor>::Context, ) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, R::Error, Infallible>>
Applies the architecture’s final-logits observation on the rank that owns the authoritative output. Ordinary replicated strategies observe locally; partitioned strategies may suppress the seam on destinations.
Sourcefn publish_observed_output(
_runtime: &mut Self::Runtime,
output: B::Tensor,
_context: &<B::Tensor as Tensor>::Context,
) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, R::Error, Infallible>>
fn publish_observed_output( _runtime: &mut Self::Runtime, output: B::Tensor, _context: &<B::Tensor as Tensor>::Context, ) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, R::Error, Infallible>>
Publishes an already-observed authoritative output after every rank has agreed that final observation succeeded.
Sourcefn prediction_target_capture(
_runtime: &mut Self::Runtime,
forward: &A::ForwardContext,
_context: &<B::Tensor as Tensor>::Context,
) -> Result<Option<B::Tensor>, ReplicatedTextSessionError<A::Error, R::Error, Infallible>>
fn prediction_target_capture( _runtime: &mut Self::Runtime, forward: &A::ForwardContext, _context: &<B::Tensor as Tensor>::Context, ) -> Result<Option<B::Tensor>, ReplicatedTextSessionError<A::Error, R::Error, Infallible>>
Resolves the rank-local tensor used by an additive prediction extension.
Direct execution returns the retained target value. Partitioned strategies may instead produce an exact placeholder on ranks that do not own target projection.
Sourcefn publish_prediction_target_capture(
_runtime: &mut Self::Runtime,
capture: B::Tensor,
_context: &<B::Tensor as Tensor>::Context,
) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, R::Error, Infallible>>
fn publish_prediction_target_capture( _runtime: &mut Self::Runtime, capture: B::Tensor, _context: &<B::Tensor as Tensor>::Context, ) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, R::Error, Infallible>>
Publishes the output-owner capture to every prediction participant.
Sourcefn apply_prediction_target_operation<O>(
_runtime: &mut Self::Runtime,
_state: &mut S,
_operation: O,
_context: &<B::Tensor as Tensor>::Context,
) -> Result<Option<O::Output>, ReplicatedTextSessionError<A::Error, R::Error, Infallible>>where
O: PredictionTargetOperation<A, B, S>,
fn apply_prediction_target_operation<O>(
_runtime: &mut Self::Runtime,
_state: &mut S,
_operation: O,
_context: &<B::Tensor as Tensor>::Context,
) -> Result<Option<O::Output>, ReplicatedTextSessionError<A::Error, R::Error, Infallible>>where
O: PredictionTargetOperation<A, B, S>,
Runs one typed prediction-only operation against session-owned target modules and state.
Sourcefn commit_after_completion(
_runtime: &mut Self::Runtime,
epoch: DistributedCommitEpoch,
_context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> DistributedCommitOutcome
fn commit_after_completion( _runtime: &mut Self::Runtime, epoch: DistributedCommitEpoch, _context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, ) -> DistributedCommitOutcome
Performs strategy-specific distributed commit only after output intervention and exact mechanism completion have succeeded.
Sourcefn agree_distributed_phase(
_runtime: &mut Self::Runtime,
_phase: DistributedExecutionPhase,
local_success: bool,
_context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<bool, ReplicatedTextSessionError<A::Error, R::Error, Infallible>>
fn agree_distributed_phase( _runtime: &mut Self::Runtime, _phase: DistributedExecutionPhase, local_success: bool, _context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, ) -> Result<bool, ReplicatedTextSessionError<A::Error, R::Error, Infallible>>
Propagates one local shared-session phase result before the lifecycle can advance. Direct and unsupported strategies retain the local result.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".