pub struct BatchConstructor {
pub max_tokens_per_batch: usize,
pub max_entries: usize,
}Expand description
Constructs a continuous batch: pulls pending decode requests first (cheap, one-token forwards), then fills remaining token budget with prefill chunks. The token budget — not the sequence count — is the gating constraint because prefills can be arbitrarily long.
Fields§
§max_tokens_per_batch: usizeMaximum tokens per forward across all entries.
max_entries: usizeMaximum entries per forward (also bounds memory/scheduler overhead).
Implementations§
Source§impl BatchConstructor
impl BatchConstructor
pub fn new(max_tokens_per_batch: usize, max_entries: usize) -> Self
Sourcepub fn build(
&self,
decode_queue: &mut VecDeque<BatchEntry>,
prefill_queue: &mut VecDeque<BatchEntry>,
) -> Vec<BatchEntry>
pub fn build( &self, decode_queue: &mut VecDeque<BatchEntry>, prefill_queue: &mut VecDeque<BatchEntry>, ) -> Vec<BatchEntry>
Build the next batch. Walks decode_queue first (one
token each, cheap), then fills remaining token budget by
chunking from prefill_queue. Sequences that didn’t fit
stay in their queues for the next call.
Auto Trait Implementations§
impl Freeze for BatchConstructor
impl RefUnwindSafe for BatchConstructor
impl Send for BatchConstructor
impl Sync for BatchConstructor
impl Unpin for BatchConstructor
impl UnsafeUnpin for BatchConstructor
impl UnwindSafe for BatchConstructor
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
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