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: usizesession budget: last valid t_kv (pos + max_new + 1 at creation).
Implementations§
Source§impl GraphSession
impl GraphSession
Sourcepub fn step(
&mut self,
e: &Engine,
m: &HybridModel,
) -> Result<u32, Box<dyn Error>>
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).
Sourcepub fn upload_mask(
&mut self,
e: &Engine,
words: &[u32],
) -> Result<(), Box<dyn Error>>
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.
Sourcepub fn prof_apply(&mut self, _e: &Engine) -> Result<(), Box<dyn Error>>
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().