Skip to main content

ReplicatedTextExecutionStrategy

Trait ReplicatedTextExecutionStrategy 

Source
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§

Source

const PARTITIONED_SESSION: bool = false

Whether this strategy executes one rank of a partitioned session.

Source

const DISTRIBUTED_PHASE_AGREEMENT: bool = false

Whether control phases use a selected bounded all-rank agreement.

Required Associated Types§

Source

type Runtime

Concrete execution runtime paired before the shared session lifecycle begins.

Required Methods§

Source

fn bounded_policy(runtime: &Self::Runtime) -> Option<&P>

Returns bounded residency state for the shared session report.

Source

fn execution_residency( runtime: &Self::Runtime, selected: &SelectedReplicatedTextRealization, ) -> ExecutionResidency

Returns the execution residency actually installed on this rank.

Source

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,

Executes one complete layered pass through the selected unit strategy.

Provided Methods§

Source

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,

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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".

Implementors§

Source§

impl<A, B, S, R, P, Provider> ReplicatedTextExecutionStrategy<A, B, S, R, P> for RoutedReplicatedTextExecution<Provider>
where B: SubmissionBackend<Executor = <<B as NeuralBackend>::Tensor as Tensor>::Context> + GroupedNeuralBackend, S: RuntimeState<B>, A: LayeredArchitecture<B, S> + RoutedLayeredArchitecture<B, S>, R: LayerwisePolicy<B, A::Unit>, P: LayerwisePolicy<B, A::Unit, Error = R::Error>, Provider: RoutedExpertProvider<B>, Provider::Error: Display, A::Error: Display, P::Error: Display,

Source§

impl<A, B, S, R, P> ReplicatedTextExecutionStrategy<A, B, S, R, P> for DirectReplicatedTextExecution
where B: SubmissionBackend<Executor = <<B as NeuralBackend>::Tensor as Tensor>::Context>, S: RuntimeState<B>, A: LayeredArchitecture<B, S>, R: LayerwisePolicy<B, A::Unit>, P: LayerwisePolicy<B, A::Unit, Error = R::Error>, A::Error: Display, P::Error: Display,

Source§

impl<A, B, S, Resident, Bounded, E, G, R, I, T, U, V> ReplicatedTextExecutionStrategy<A, B, S, Resident, Bounded> for PartitionedTextExecution<E, G, R, I, T, U, V>
where B: CommunicationBackend, S: RuntimeState<B>, A: LayeredArchitecture<B, S>, Resident: LayerwisePolicy<B, A::Unit>, Bounded: LayerwisePolicy<B, A::Unit, Error = Resident::Error>, E: PartitionedGroupExecutor<A, B, S, G, R, I>, G: Borrow<B::CommunicationGroup>, R: Borrow<B::CommunicationRoute>, I: CommunicationTensorMetadata<B>, T: PartitionBoundaryTransport<B, G, R, I>, U: PartitionOutputPublisher<B, G, R, I>, V: PartitionCommitAgreement<B, G, R, I>, A::Error: Display, Resident::Error: Display,

Source§

const PARTITIONED_SESSION: bool = true

Source§

const DISTRIBUTED_PHASE_AGREEMENT: bool = V::PHASE_FAILURE_AGREEMENT

Source§

type Runtime = PartitionedTextRuntime<A, B, S, Bounded, E, G, R, I, T, U, V>