pub struct PipelineExecutor { /* private fields */ }Expand description
Pipeline executor for efficient prefill/decode separation
Implementations§
Source§impl PipelineExecutor
impl PipelineExecutor
Sourcepub fn new(
model_executor: Arc<dyn ModelExecutor + Send + Sync>,
sampler: Arc<dyn Sampler + Send + Sync>,
config: PipelineConfig,
) -> Self
pub fn new( model_executor: Arc<dyn ModelExecutor + Send + Sync>, sampler: Arc<dyn Sampler + Send + Sync>, config: PipelineConfig, ) -> Self
Create new pipeline executor
Sourcepub fn submit(
&self,
input_tokens: Vec<TokenId>,
sampling_params: SamplingParams,
priority: Priority,
) -> u64
pub fn submit( &self, input_tokens: Vec<TokenId>, sampling_params: SamplingParams, priority: Priority, ) -> u64
Submit a new sequence for processing
Sourcepub async fn run_prefill(&self, sequence_id: u64) -> Result<()>
pub async fn run_prefill(&self, sequence_id: u64) -> Result<()>
Execute prefill for a sequence
Sourcepub async fn run_decode_step(&self, sequence_id: u64) -> Result<Option<TokenId>>
pub async fn run_decode_step(&self, sequence_id: u64) -> Result<Option<TokenId>>
Execute a single decode step for a sequence
Sourcepub async fn generate(&self, sequence_id: u64) -> Result<Vec<TokenId>>
pub async fn generate(&self, sequence_id: u64) -> Result<Vec<TokenId>>
Run a full generation for a sequence
Sourcepub fn get_sequence(&self, sequence_id: u64) -> Option<PipelineSequence>
pub fn get_sequence(&self, sequence_id: u64) -> Option<PipelineSequence>
Get sequence by ID
Sourcepub fn remove_sequence(&self, sequence_id: u64) -> Option<PipelineSequence>
pub fn remove_sequence(&self, sequence_id: u64) -> Option<PipelineSequence>
Remove completed sequence
Sourcepub fn active_count(&self) -> usize
pub fn active_count(&self) -> usize
Get number of active sequences
Sourcepub fn prefill_count(&self) -> usize
pub fn prefill_count(&self) -> usize
Get sequences in prefill phase
Sourcepub fn decode_count(&self) -> usize
pub fn decode_count(&self) -> usize
Get sequences in decode phase
Sourcepub fn get_stats(&self) -> PipelineStatsSnapshot
pub fn get_stats(&self) -> PipelineStatsSnapshot
Get statistics
Sourcepub fn config(&self) -> &PipelineConfig
pub fn config(&self) -> &PipelineConfig
Get configuration
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for PipelineExecutor
impl !RefUnwindSafe for PipelineExecutor
impl !UnwindSafe for PipelineExecutor
impl Send for PipelineExecutor
impl Sync for PipelineExecutor
impl Unpin for PipelineExecutor
impl UnsafeUnpin for PipelineExecutor
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
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more