Skip to main content

GraphSession

Struct GraphSession 

Source
pub struct GraphSession {
    pub gs: GraphDecodeState,
    pub cache: Cache,
    pub bucket_max: usize,
    /* private fields */
}
Expand description

Long-lived step-wise CUDA-graph decode session (see HybridModel::graph_session_new). One replay per step(); the only steady-state D2H is the 4-byte next-token read.

Fields§

§gs: GraphDecodeState§cache: Cache§bucket_max: usize

session budget: last valid t_kv (pos + max_new + 1 at creation).

Implementations§

Source§

impl GraphSession

Source

pub fn step( &mut self, e: &Engine, m: &HybridModel, ) -> Result<u32, Box<dyn Error>>

One graph-replay decode step. Returns the next token (already fed back into the resident token_d — the following step consumes it). Errors past bucket_max (the caller sized max_new at capture). Transparently recaptures when the eager kernel class changes (fa_vec floor / v4 max / fa512 floor crossings).

Source

pub fn upload_mask( &mut self, e: &Engine, words: &[u32], ) -> Result<(), Box<dyn Error>>

GRAMMAR MASK upload (constrained graph sessions): fresh packed-bitset contents into the STABLE buffer the captured graph reads — call before every step(). The word count is a capture-time kernel arg (constant per model: the tokenizer vocab is fixed), so the length must match the capture exactly.

Source

pub fn prof_apply(&mut self, _e: &Engine) -> Result<(), Box<dyn Error>>

Profiling decomposition of step() (graph-session-gate MEMRA_GS_PROF): the three phases exposed separately. prof_launch is ASYNC (no sync) — prof_read carries the sync+D2H. Advances the session exactly like step().

Source

pub fn prof_launch(&mut self) -> Result<(), Box<dyn Error>>

Source

pub fn prof_read(&mut self, e: &Engine) -> Result<u32, Box<dyn Error>>

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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.