Skip to main content

PrefillInput

Struct PrefillInput 

Source
pub struct PrefillInput {
    pub request_id: Option<RequestId>,
    pub maximum_sequence_tokens: Option<usize>,
    pub chunk: Option<PrefillChunk>,
    pub input_ids: TensorRef,
    pub attention_mask: Option<TensorRef>,
    pub position_ids: Option<TensorRef>,
    pub kv_cache: Option<Arc<dyn KvCacheHandle>>,
    pub recurrent_state: Option<Arc<dyn RecurrentStateHandle>>,
    pub metadata: HashMap<String, Value>,
}
Expand description

Input for prefill phase (processing the initial prompt)

Fields§

§request_id: Option<RequestId>

Stable product request identity for plan-runtime resources.

§maximum_sequence_tokens: Option<usize>

Maximum sequence extent this request may reach, including the prompt. Executors use this for fit validation without allocating future pages.

§chunk: Option<PrefillChunk>

Exact scheduler-owned prompt chunk for this invocation.

The input tensor still contains the full prompt so token identity and global offsets remain stable. Plan runtimes execute only this range.

§input_ids: TensorRef

Input token IDs [batch_size, sequence_length]

§attention_mask: Option<TensorRef>

Attention mask [batch_size, sequence_length] (optional)

§position_ids: Option<TensorRef>

Position IDs [batch_size, sequence_length] (optional, for RoPE)

§kv_cache: Option<Arc<dyn KvCacheHandle>>

Pre-allocated KV cache handle (optional, for paged attention)

§recurrent_state: Option<Arc<dyn RecurrentStateHandle>>

Pre-allocated recurrent-state handle (optional, for state-space layers)

§metadata: HashMap<String, Value>

Request metadata that can affect model execution.

Implementations§

Source§

impl PrefillInput

Source

pub fn new(input_ids: TensorRef) -> Self

Create new prefill input

Source

pub fn with_request_context( self, request_id: RequestId, maximum_sequence_tokens: usize, ) -> Self

Attach the typed request boundary consumed by plan runtimes.

Source

pub fn with_chunk(self, chunk: PrefillChunk) -> Self

Attach the exact scheduler-published prompt chunk.

Source

pub fn with_kv_cache(self, kv_cache: Arc<dyn KvCacheHandle>) -> Self

Create prefill input with a pre-allocated KV cache handle.

Source

pub fn with_recurrent_state( self, recurrent_state: Arc<dyn RecurrentStateHandle>, ) -> Self

Create prefill input with a pre-allocated recurrent-state handle.

Source

pub fn with_metadata(self, metadata: HashMap<String, Value>) -> Self

Attach request metadata.

Source

pub fn with_attention_mask(self, mask: TensorRef) -> Self

Add attention mask

Source

pub fn with_position_ids(self, positions: TensorRef) -> Self

Add position IDs

Source

pub fn batch_size(&self) -> usize

Get batch size

Source

pub fn sequence_length(&self) -> usize

Get sequence length

Trait Implementations§

Source§

impl Clone for PrefillInput

Source§

fn clone(&self) -> PrefillInput

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PrefillInput

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V