pub struct Gemma4Engine {
pub weights: Gemma4Weights,
pub hp: Gemma4Hparams,
}Fields§
§weights: Gemma4Weights§hp: Gemma4HparamsImplementations§
Source§impl Gemma4Engine
impl Gemma4Engine
Sourcepub fn probe_kernels(&self)
pub fn probe_kernels(&self)
See crate::decoder::Decoder::probe_kernels. Called at the end
of loading, before the registry is sealed.
This engine implements Engine::forward_token and nothing
else: there is no batched path, so a 512-token prefill is 512
sequential single-token passes and every projection is a
batch = 1 matvec. On Metal that is one command buffer, one
commit and one wait per projection per token, which is why
Gemma-4-E2B measures slower on Metal than on CPU while
producing correct output. The registry records that as a missing
engine capability rather than leaving it to be rediscovered from
a benchmark.
pub fn new_state(&self) -> Gemma4DecodeState
Trait Implementations§
Source§impl Engine for Gemma4Engine
impl Engine for Gemma4Engine
type State = Gemma4DecodeState
Source§fn new_state(&self) -> Gemma4DecodeState
fn new_state(&self) -> Gemma4DecodeState
Builds fresh (empty) per-layer state for a new request.
fn vocab_size(&self) -> usize
fn forward_token( &self, token_id: usize, pos: usize, state: &mut Self::State, ) -> Vec<f32>
Auto Trait Implementations§
impl Freeze for Gemma4Engine
impl RefUnwindSafe for Gemma4Engine
impl Send for Gemma4Engine
impl Sync for Gemma4Engine
impl Unpin for Gemma4Engine
impl UnsafeUnpin for Gemma4Engine
impl UnwindSafe for Gemma4Engine
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