pub struct SpeculativeRequestTable<'cache, E, S, C, P>where
E: SpeculativeExecutor,
S: SpeculativeSampling<Logits = E::Logits, Error = E::Error>,
C: SpeculativeConstraint,
P: SpeculativePublisher<C>,{ /* private fields */ }Expand description
Canonical table and action coordinator for speculative requests.
Implementations§
Source§impl<'cache, E, S, C, P> SpeculativeRequestTable<'cache, E, S, C, P>where
E: SpeculativeExecutor,
S: SpeculativeSampling<Logits = E::Logits, Error = E::Error>,
C: SpeculativeConstraint,
P: SpeculativePublisher<C>,
impl<'cache, E, S, C, P> SpeculativeRequestTable<'cache, E, S, C, P>where
E: SpeculativeExecutor,
S: SpeculativeSampling<Logits = E::Logits, Error = E::Error>,
C: SpeculativeConstraint,
P: SpeculativePublisher<C>,
Sourcepub fn new(
options: SpeculativeSchedulerOptions,
topology: SpeculativeExecutionTopology,
) -> Result<Self, GenerationError>
pub fn new( options: SpeculativeSchedulerOptions, topology: SpeculativeExecutionTopology, ) -> Result<Self, GenerationError>
Creates an empty validated request table.
Sourcepub fn request(
&self,
id: SpeculativeRequestId,
) -> Option<&SpeculativeRequest<'cache, E, S, C, P>>
pub fn request( &self, id: SpeculativeRequestId, ) -> Option<&SpeculativeRequest<'cache, E, S, C, P>>
Returns one request by stable identity.
Sourcepub fn status(
&self,
id: SpeculativeRequestId,
) -> Option<SpeculativeRequestStatus>
pub fn status( &self, id: SpeculativeRequestId, ) -> Option<SpeculativeRequestStatus>
Returns one request’s current status.
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Whether every request is terminal.
Sourcepub const fn options(&self) -> SpeculativeSchedulerOptions
pub const fn options(&self) -> SpeculativeSchedulerOptions
Validated scheduler options.
Sourcepub fn submit<'context>(
&mut self,
executor: &mut E,
cache: &'cache mut E::Cache,
input: E::Input,
config: SpeculativeConfig,
runtime: SpeculativeOutputRuntime<S, C, P>,
randomness: SpeculativeRandomness<S::RandomState, S::DraftRandomness>,
component_timings_collected: bool,
context: E::Context<'context>,
) -> Result<SpeculativeRequestId, SpeculativeDriverError<E::Error>>where
E: 'context,
S: SpeculativeSampling<Logits = E::Logits, Error = E::Error, Context<'context> = E::Context<'context>> + 'context,
pub fn submit<'context>(
&mut self,
executor: &mut E,
cache: &'cache mut E::Cache,
input: E::Input,
config: SpeculativeConfig,
runtime: SpeculativeOutputRuntime<S, C, P>,
randomness: SpeculativeRandomness<S::RandomState, S::DraftRandomness>,
component_timings_collected: bool,
context: E::Context<'context>,
) -> Result<SpeculativeRequestId, SpeculativeDriverError<E::Error>>where
E: 'context,
S: SpeculativeSampling<Logits = E::Logits, Error = E::Error, Context<'context> = E::Context<'context>> + 'context,
Prefills and inserts one request, or records its pre-existing terminal state.
Sourcepub fn cancel(
&mut self,
id: SpeculativeRequestId,
) -> Result<(), SpeculativeDriverError<E::Error>>
pub fn cancel( &mut self, id: SpeculativeRequestId, ) -> Result<(), SpeculativeDriverError<E::Error>>
Requests cancellation without releasing an exact in-flight transaction.
Sourcepub fn step<'context>(
&mut self,
executor: &mut E,
optimistic_execution_available: bool,
context: E::Context<'context>,
) -> Result<bool, SpeculativeDriverError<E::Error>>where
E: 'context,
S: SpeculativeSampling<Logits = E::Logits, Error = E::Error, Context<'context> = E::Context<'context>> + 'context,
pub fn step<'context>(
&mut self,
executor: &mut E,
optimistic_execution_available: bool,
context: E::Context<'context>,
) -> Result<bool, SpeculativeDriverError<E::Error>>where
E: 'context,
S: SpeculativeSampling<Logits = E::Logits, Error = E::Error, Context<'context> = E::Context<'context>> + 'context,
Applies one fairly selected request action.
Sourcepub fn run<'context>(
&mut self,
executor: &mut E,
optimistic_execution_available: bool,
context: E::Context<'context>,
) -> Result<(), SpeculativeDriverError<E::Error>>where
E: 'context,
S: SpeculativeSampling<Logits = E::Logits, Error = E::Error, Context<'context> = E::Context<'context>> + 'context,
pub fn run<'context>(
&mut self,
executor: &mut E,
optimistic_execution_available: bool,
context: E::Context<'context>,
) -> Result<(), SpeculativeDriverError<E::Error>>where
E: 'context,
S: SpeculativeSampling<Logits = E::Logits, Error = E::Error, Context<'context> = E::Context<'context>> + 'context,
Drives every request to a terminal state.
Sourcepub fn finish(
self,
) -> Result<CompletedSpeculativeSchedule<S>, SpeculativeDriverError<E::Error>>
pub fn finish( self, ) -> Result<CompletedSpeculativeSchedule<S>, SpeculativeDriverError<E::Error>>
Consumes a terminal table and returns outputs in stable submission order.
Auto Trait Implementations§
impl<'cache, E, S, C, P> !RefUnwindSafe for SpeculativeRequestTable<'cache, E, S, C, P>
impl<'cache, E, S, C, P> !UnwindSafe for SpeculativeRequestTable<'cache, E, S, C, P>
impl<'cache, E, S, C, P> Freeze for SpeculativeRequestTable<'cache, E, S, C, P>
impl<'cache, E, S, C, P> Send for SpeculativeRequestTable<'cache, E, S, C, P>
impl<'cache, E, S, C, P> Sync for SpeculativeRequestTable<'cache, E, S, C, P>
impl<'cache, E, S, C, P> Unpin for SpeculativeRequestTable<'cache, E, S, C, P>
impl<'cache, E, S, C, P> UnsafeUnpin for SpeculativeRequestTable<'cache, E, S, C, P>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more