pub struct ReplicatedTextSession<A, B, M, D = DirectReplicatedTextExecution>where
B: SubmissionBackend<Executor = <<B as NeuralBackend>::Tensor as Tensor>::Context>,
M: ReplicatedTextSessionMechanisms<A, B>,
A: LayeredArchitecture<B, M::State>,
D: ReplicatedTextExecutionStrategy<A, B, M::State, M::ResidentPolicy, M::BoundedPolicy>,
A::Error: Display,
M::PolicyError: Display,{ /* private fields */ }Expand description
Complete backend-neutral replicated-text session.
Implementations§
Source§impl<A, B, M, D> ReplicatedTextSession<A, B, M, D>where
B: SubmissionBackend<Executor = <<B as NeuralBackend>::Tensor as Tensor>::Context>,
M: ReplicatedTextSessionMechanisms<A, B>,
A: LayeredArchitecture<B, M::State>,
D: ReplicatedTextExecutionStrategy<A, B, M::State, M::ResidentPolicy, M::BoundedPolicy>,
A::Error: Display,
M::PolicyError: Display,
M::Error: Display,
impl<A, B, M, D> ReplicatedTextSession<A, B, M, D>where
B: SubmissionBackend<Executor = <<B as NeuralBackend>::Tensor as Tensor>::Context>,
M: ReplicatedTextSessionMechanisms<A, B>,
A: LayeredArchitecture<B, M::State>,
D: ReplicatedTextExecutionStrategy<A, B, M::State, M::ResidentPolicy, M::BoundedPolicy>,
A::Error: Display,
M::PolicyError: Display,
M::Error: Display,
Sourcepub const fn materialization_report(
&self,
) -> Option<&WeightMaterializationReport>
pub const fn materialization_report( &self, ) -> Option<&WeightMaterializationReport>
Returns the aggregate report captured by the neutral construction driver after exact materialization preparation completed.
Sourcepub const fn execution_strategy(&self) -> &D
pub const fn execution_strategy(&self) -> &D
Borrows the statically paired unit-execution strategy for generic telemetry.
Sourcepub fn forward(
&mut self,
tokens: &B::Tensor,
mask: Option<&B::Tensor>,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>where
A: ReplicatedTextArchitecture<B, M::State>,
pub fn forward(
&mut self,
tokens: &B::Tensor,
mask: Option<&B::Tensor>,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>where
A: ReplicatedTextArchitecture<B, M::State>,
Runs one direct forward and returns the complete architecture output.
Sourcepub fn forward_with_observer<O>(
&mut self,
tokens: &B::Tensor,
mask: Option<&B::Tensor>,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
observer: &mut O,
) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>where
A: ReplicatedTextArchitecture<B, M::State>,
O: ActivationObserver<B::Tensor, A::Error> + ?Sized,
pub fn forward_with_observer<O>(
&mut self,
tokens: &B::Tensor,
mask: Option<&B::Tensor>,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
observer: &mut O,
) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>where
A: ReplicatedTextArchitecture<B, M::State>,
O: ActivationObserver<B::Tensor, A::Error> + ?Sized,
Runs one direct forward with unit and final-logits observation and intervention.
Sourcepub fn prefill(
&mut self,
tokens: &B::Tensor,
mask: Option<&B::Tensor>,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>where
A: ReplicatedTextArchitecture<B, M::State>,
pub fn prefill(
&mut self,
tokens: &B::Tensor,
mask: Option<&B::Tensor>,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>where
A: ReplicatedTextArchitecture<B, M::State>,
Runs prompt processing and selects the architecture-declared text output.
Sourcepub fn prefill_with_observer<O>(
&mut self,
tokens: &B::Tensor,
mask: Option<&B::Tensor>,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
observer: &mut O,
) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>where
A: ReplicatedTextArchitecture<B, M::State>,
O: ActivationObserver<B::Tensor, A::Error> + ?Sized,
pub fn prefill_with_observer<O>(
&mut self,
tokens: &B::Tensor,
mask: Option<&B::Tensor>,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
observer: &mut O,
) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>where
A: ReplicatedTextArchitecture<B, M::State>,
O: ActivationObserver<B::Tensor, A::Error> + ?Sized,
Runs observed prompt processing and selects the declared text output.
Sourcepub fn prefill_prediction_target(
&mut self,
tokens: &B::Tensor,
mask: Option<&B::Tensor>,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<(B::Tensor, B::Tensor), ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>where
A: ReplicatedTextArchitecture<B, M::State>,
pub fn prefill_prediction_target(
&mut self,
tokens: &B::Tensor,
mask: Option<&B::Tensor>,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<(B::Tensor, B::Tensor), ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>where
A: ReplicatedTextArchitecture<B, M::State>,
Runs ordinary target prefill and returns its architecture-owned prediction capture.
Both tensors come from the same transaction and are returned only after canonical output publication succeeds. Missing capture rolls state back exactly like a failed output projection.
Sourcepub fn prefill_input_prediction_target<'a>(
&mut self,
input: A::Input<'a>,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<(B::Tensor, B::Tensor), ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
pub fn prefill_input_prediction_target<'a>( &mut self, input: A::Input<'a>, context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, ) -> Result<(B::Tensor, B::Tensor), ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
Runs architecture-prepared target prefill and returns its exact additive capture.
Sourcepub fn prefill_input<'a>(
&mut self,
input: A::Input<'a>,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
pub fn prefill_input<'a>( &mut self, input: A::Input<'a>, context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, ) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
Runs prompt processing from an architecture-prepared input.
Additive ingress drivers use this entry after architecture admission has coupled native tensors to their semantic identity. Output selection, rollback, observation, state publication, and completion remain owned by this session.
Sourcepub fn prefill_input_with_capture<'a, O, C, F>(
&mut self,
input: A::Input<'a>,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
observer: &mut O,
capture: F,
) -> Result<(B::Tensor, C), ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>where
O: ActivationObserver<B::Tensor, A::Error> + ?Sized,
F: FnOnce(&A::ForwardContext) -> Result<C, A::Error>,
pub fn prefill_input_with_capture<'a, O, C, F>(
&mut self,
input: A::Input<'a>,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
observer: &mut O,
capture: F,
) -> Result<(B::Tensor, C), ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>where
O: ActivationObserver<B::Tensor, A::Error> + ?Sized,
F: FnOnce(&A::ForwardContext) -> Result<C, A::Error>,
Runs one ordinary non-partitioned target pass and atomically retains an additive capture.
The capture is derived from the same forward context and observed unit outputs as the canonical target logits. Capture failure restores target state before either value is published. Partitioned capture requires an admitted multi-tensor publication contract and therefore remains unavailable through this local-only seam.
Sourcepub fn prefill_input_with_cache_identity<'a>(
&mut self,
input: A::Input<'a>,
identity: PreparedInputCacheIdentity,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
pub fn prefill_input_with_cache_identity<'a>( &mut self, input: A::Input<'a>, identity: PreparedInputCacheIdentity, context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, ) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
Runs composite prompt processing and commits its cache-relevant input identity only after successful state publication and exact completion.
Sourcepub fn prefill_input_with_observer_and_cache_identity<'a, O>(
&mut self,
input: A::Input<'a>,
identity: PreparedInputCacheIdentity,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
observer: &mut O,
) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
pub fn prefill_input_with_observer_and_cache_identity<'a, O>( &mut self, input: A::Input<'a>, identity: PreparedInputCacheIdentity, context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, observer: &mut O, ) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
Runs observed prompt processing and commits its exact prepared-input identity on success.
Sourcepub fn prefill_input_with_observer<'a, O>(
&mut self,
input: A::Input<'a>,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
observer: &mut O,
) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
pub fn prefill_input_with_observer<'a, O>( &mut self, input: A::Input<'a>, context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, observer: &mut O, ) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
Runs observed prompt processing from an architecture-prepared input.
Sourcepub fn decode_input<'a>(
&mut self,
input: A::Input<'a>,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
pub fn decode_input<'a>( &mut self, input: A::Input<'a>, context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, ) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
Runs one decode step from an architecture-prepared input.
Sourcepub fn decode_input_with_capture<'a, O, C, F>(
&mut self,
input: A::Input<'a>,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
observer: &mut O,
capture: F,
) -> Result<(B::Tensor, C), ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>where
O: ActivationObserver<B::Tensor, A::Error> + ?Sized,
F: FnOnce(&A::ForwardContext) -> Result<C, A::Error>,
pub fn decode_input_with_capture<'a, O, C, F>(
&mut self,
input: A::Input<'a>,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
observer: &mut O,
capture: F,
) -> Result<(B::Tensor, C), ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>where
O: ActivationObserver<B::Tensor, A::Error> + ?Sized,
F: FnOnce(&A::ForwardContext) -> Result<C, A::Error>,
Runs one ordinary non-partitioned decode pass and atomically retains an additive capture.
Sourcepub fn decode_input_with_observer<'a, O>(
&mut self,
input: A::Input<'a>,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
observer: &mut O,
) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
pub fn decode_input_with_observer<'a, O>( &mut self, input: A::Input<'a>, context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, observer: &mut O, ) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
Runs one observed decode step from an architecture-prepared input.
Sourcepub fn decode(
&mut self,
tokens: &B::Tensor,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>where
A: ReplicatedTextArchitecture<B, M::State>,
pub fn decode(
&mut self,
tokens: &B::Tensor,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>where
A: ReplicatedTextArchitecture<B, M::State>,
Runs one decode step and selects the architecture-declared text output.
Sourcepub fn decode_prediction_target(
&mut self,
tokens: &B::Tensor,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<(B::Tensor, B::Tensor), ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>where
A: ReplicatedTextArchitecture<B, M::State>,
pub fn decode_prediction_target(
&mut self,
tokens: &B::Tensor,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<(B::Tensor, B::Tensor), ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>where
A: ReplicatedTextArchitecture<B, M::State>,
Runs ordinary target decode and returns its architecture-owned prediction capture.
Sourcepub fn decode_input_prediction_target<'a>(
&mut self,
input: A::Input<'a>,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<(B::Tensor, B::Tensor), ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
pub fn decode_input_prediction_target<'a>( &mut self, input: A::Input<'a>, context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, ) -> Result<(B::Tensor, B::Tensor), ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
Runs architecture-prepared target decode and returns its exact additive capture.
Sourcepub fn decode_with_observer<O>(
&mut self,
tokens: &B::Tensor,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
observer: &mut O,
) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>where
A: ReplicatedTextArchitecture<B, M::State>,
O: ActivationObserver<B::Tensor, A::Error> + ?Sized,
pub fn decode_with_observer<O>(
&mut self,
tokens: &B::Tensor,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
observer: &mut O,
) -> Result<B::Tensor, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>where
A: ReplicatedTextArchitecture<B, M::State>,
O: ActivationObserver<B::Tensor, A::Error> + ?Sized,
Runs one observed decode step and selects the declared text output.
Sourcepub const fn successful_state_restoration_generation(&self) -> Option<u64>
pub const fn successful_state_restoration_generation(&self) -> Option<u64>
Snapshots successful state-restoration evidence for one execution call.
Snapshots of this counter prove only a successful neutral state restore, never completion of backend work. Overflow permanently disables the witness; checkpoint restoration never rewinds it.
Sourcepub fn checkpoint(
&mut self,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<M::StateCheckpoint, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
pub fn checkpoint( &mut self, context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, ) -> Result<M::StateCheckpoint, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
Captures all mutable state for a later transactional rollback.
Sourcepub fn exchange_prediction_target_state(
&mut self,
replacement: &mut M::State,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<(), ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
pub fn exchange_prediction_target_state( &mut self, replacement: &mut M::State, context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, ) -> Result<(), ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
Exchanges the canonical target state with one prediction-lane state after all-rank proof.
The returned state is the previously installed target state. A speculative adapter uses this operation before and after a target pass so lane-local caches never become a second owner of target execution. Validation or agreement failure leaves the canonical state untouched.
Sourcepub fn recover_prediction_target_state_after_failure(
&mut self,
replacement: &mut M::State,
) -> Result<(), ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
pub fn recover_prediction_target_state_after_failure( &mut self, replacement: &mut M::State, ) -> Result<(), ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
Restores local target-state ownership after a failed prediction-lane pass.
This is a one-shot ownership repair, not a second distributed operation: the preceding successful exchange already proved both states, and a failed pass may poison the selected communication authority before the ordinary agreement-backed exchange can run again. The caller must still return the original distributed failure; this swap does not clear a poison, publish state, or make the session reusable.
Sourcepub fn prepare_prediction_target_state(
&mut self,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<M::State, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
pub fn prepare_prediction_target_state( &mut self, context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, ) -> Result<M::State, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
Forks one prediction-lane target state from the exact canonical state.
This preserves any prompt-cache restoration already installed in the ordinary target. Every rank realizes, restores, and validates its local fork before any caller may retain the lane; failure leaves the canonical state untouched.
Sourcepub fn apply_prediction_target_operation<O>(
&mut self,
operation: O,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<O::Output, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>where
O: PredictionTargetOperation<A, B, M::State>,
pub fn apply_prediction_target_operation<O>(
&mut self,
operation: O,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<O::Output, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>where
O: PredictionTargetOperation<A, B, M::State>,
Runs one typed prediction-only operation against the neutral target modules and lane state.
The operation is checkpointed and agreed independently of ordinary output publication. Any local or remote failure restores the installed lane state before returning.
Sourcepub fn checkpoint_complete(
&mut self,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<ReplicatedTextSessionCheckpoint<M::StateCheckpoint>, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
pub fn checkpoint_complete( &mut self, context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, ) -> Result<ReplicatedTextSessionCheckpoint<M::StateCheckpoint>, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
Captures mutable state together with the committed composite prompt identity.
Sourcepub fn checkpoint_distributed(
&mut self,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<DistributedStateCheckpoint<M::StateCheckpoint>, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
pub fn checkpoint_distributed( &mut self, context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, ) -> Result<DistributedStateCheckpoint<M::StateCheckpoint>, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
Captures a state-only checkpoint only when every partition rank succeeds.
Sourcepub fn checkpoint_complete_distributed(
&mut self,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<DistributedSessionCheckpoint<M::StateCheckpoint>, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
pub fn checkpoint_complete_distributed( &mut self, context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, ) -> Result<DistributedSessionCheckpoint<M::StateCheckpoint>, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
Captures state and session commit metadata only on all-rank success.
Sourcepub fn rollback(
&mut self,
checkpoint: M::StateCheckpoint,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<(), ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
pub fn rollback( &mut self, checkpoint: M::StateCheckpoint, context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, ) -> Result<(), ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
Restores every mutable component from a session checkpoint.
Sourcepub fn rollback_complete(
&mut self,
checkpoint: ReplicatedTextSessionCheckpoint<M::StateCheckpoint>,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<(), ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
pub fn rollback_complete( &mut self, checkpoint: ReplicatedTextSessionCheckpoint<M::StateCheckpoint>, context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, ) -> Result<(), ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
Restores every mutable component and its committed composite prompt identity atomically.
Sourcepub fn rollback_distributed(
&mut self,
checkpoint: DistributedStateCheckpoint<M::StateCheckpoint>,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<(), ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
pub fn rollback_distributed( &mut self, checkpoint: DistributedStateCheckpoint<M::StateCheckpoint>, context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, ) -> Result<(), ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
Restores a state-only partition checkpoint after all ranks prepare it provisionally.
Sourcepub fn rollback_complete_distributed(
&mut self,
checkpoint: DistributedSessionCheckpoint<M::StateCheckpoint>,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<(), ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
pub fn rollback_complete_distributed( &mut self, checkpoint: DistributedSessionCheckpoint<M::StateCheckpoint>, context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, ) -> Result<(), ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
Restores partition state and session metadata after all ranks prepare it provisionally.
Sourcepub fn reset_distributed(
&mut self,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<(), ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
pub fn reset_distributed( &mut self, context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, ) -> Result<(), ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
Replaces every rank-local state only after all ranks realize a provisional replacement.
Sourcepub fn reset(
&mut self,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<(), ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
pub fn reset( &mut self, context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, ) -> Result<(), ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
Replaces mutable state with a newly realized selected state.
Sourcepub fn load_prompt_cache(
&mut self,
directory: &Path,
expected: &PromptCacheDescriptor,
prefix_token_ids: &[u32],
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<PromptCacheManifest, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
pub fn load_prompt_cache( &mut self, directory: &Path, expected: &PromptCacheDescriptor, prefix_token_ids: &[u32], context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, ) -> Result<PromptCacheManifest, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
Validates and replaces state from a reusable prompt cache.
Sourcepub fn load_prompt_cache_for_input(
&mut self,
directory: &Path,
expected: &PromptCacheDescriptor,
prefix_token_ids: &[u32],
input_identity: PreparedInputCacheIdentity,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<PromptCacheManifest, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
pub fn load_prompt_cache_for_input( &mut self, directory: &Path, expected: &PromptCacheDescriptor, prefix_token_ids: &[u32], input_identity: PreparedInputCacheIdentity, context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, ) -> Result<PromptCacheManifest, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
Opens a prompt cache only when its content identity matches the admitted prepared input.
Sourcepub fn load_prompt_cache_distributed(
&mut self,
directory: &Path,
expected: &PromptCacheDescriptor,
prefix_token_ids: &[u32],
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<Option<PromptCacheManifest>, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
pub fn load_prompt_cache_distributed( &mut self, directory: &Path, expected: &PromptCacheDescriptor, prefix_token_ids: &[u32], context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, ) -> Result<Option<PromptCacheManifest>, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
Atomically replaces partition state from rank-local cache shards.
Stateful ranks load into provisional state while stateless ranks still participate in both selected-session agreements. No live state or distributed-commit metadata changes unless every rank validates its preflight and provisional shard.
Sourcepub fn load_prompt_cache_for_input_distributed(
&mut self,
directory: &Path,
expected: &PromptCacheDescriptor,
prefix_token_ids: &[u32],
input_identity: PreparedInputCacheIdentity,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<Option<PromptCacheManifest>, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
pub fn load_prompt_cache_for_input_distributed( &mut self, directory: &Path, expected: &PromptCacheDescriptor, prefix_token_ids: &[u32], input_identity: PreparedInputCacheIdentity, context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, ) -> Result<Option<PromptCacheManifest>, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
Atomically loads partition state after all ranks validate one prepared input.
Sourcepub fn save_prompt_cache(
&mut self,
destination: &Path,
descriptor: PromptCacheDescriptor,
prefix_token_ids: &[u32],
options: &PromptCacheOptions,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<PromptCacheManifest, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
pub fn save_prompt_cache( &mut self, destination: &Path, descriptor: PromptCacheDescriptor, prefix_token_ids: &[u32], options: &PromptCacheOptions, context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, ) -> Result<PromptCacheManifest, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
Validates identity and persists the current state through native bytes.
Sourcepub fn save_prompt_cache_for_input(
&mut self,
destination: &Path,
descriptor: PromptCacheDescriptor,
prefix_token_ids: &[u32],
options: &PromptCacheOptions,
input_identity: &PreparedInputCacheIdentity,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<PromptCacheManifest, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
pub fn save_prompt_cache_for_input( &mut self, destination: &Path, descriptor: PromptCacheDescriptor, prefix_token_ids: &[u32], options: &PromptCacheOptions, input_identity: &PreparedInputCacheIdentity, context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, ) -> Result<PromptCacheManifest, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
Persists state only when the descriptor names the successfully committed prepared input.
Sourcepub const fn committed_prompt_input_identity(
&self,
) -> Option<&PreparedInputCacheIdentity>
pub const fn committed_prompt_input_identity( &self, ) -> Option<&PreparedInputCacheIdentity>
Returns the prepared-input identity associated with the currently committed prompt state.
Sourcepub fn report(
&self,
) -> Result<ReplicatedTextSessionReport<M::ExecutionReport, M::StateReport>, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
pub fn report( &self, ) -> Result<ReplicatedTextSessionReport<M::ExecutionReport, M::StateReport>, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
Returns one coherent execution and state residency report.
Source§impl<A, B, M, D> ReplicatedTextSession<A, B, M, D>where
B: SubmissionBackend<Executor = <<B as NeuralBackend>::Tensor as Tensor>::Context>,
M: TransactionalPromptCacheMechanisms<A, B>,
A: LayeredArchitecture<B, M::State>,
D: ReplicatedTextExecutionStrategy<A, B, M::State, M::ResidentPolicy, M::BoundedPolicy>,
A::Error: Display,
M::PolicyError: Display,
M::Error: Display,
impl<A, B, M, D> ReplicatedTextSession<A, B, M, D>where
B: SubmissionBackend<Executor = <<B as NeuralBackend>::Tensor as Tensor>::Context>,
M: TransactionalPromptCacheMechanisms<A, B>,
A: LayeredArchitecture<B, M::State>,
D: ReplicatedTextExecutionStrategy<A, B, M::State, M::ResidentPolicy, M::BoundedPolicy>,
A::Error: Display,
M::PolicyError: Display,
M::Error: Display,
Sourcepub fn save_prompt_cache_distributed(
&mut self,
destination: &Path,
descriptor: PromptCacheDescriptor,
prefix_token_ids: &[u32],
options: &PromptCacheOptions,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<Option<PromptCacheManifest>, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
pub fn save_prompt_cache_distributed( &mut self, destination: &Path, descriptor: PromptCacheDescriptor, prefix_token_ids: &[u32], options: &PromptCacheOptions, context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, ) -> Result<Option<PromptCacheManifest>, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
Atomically publishes rank-local cache shards after all ranks prepare them.
Sourcepub fn save_prompt_cache_for_input_distributed(
&mut self,
destination: &Path,
descriptor: PromptCacheDescriptor,
prefix_token_ids: &[u32],
options: &PromptCacheOptions,
input_identity: &PreparedInputCacheIdentity,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<Option<PromptCacheManifest>, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
pub fn save_prompt_cache_for_input_distributed( &mut self, destination: &Path, descriptor: PromptCacheDescriptor, prefix_token_ids: &[u32], options: &PromptCacheOptions, input_identity: &PreparedInputCacheIdentity, context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, ) -> Result<Option<PromptCacheManifest>, ReplicatedTextSessionError<A::Error, M::PolicyError, M::Error>>
Atomically publishes shards only for the globally committed prepared input.