pub struct EngramV41 {
pub dim: usize,
pub hc: usize,
pub head_dim: usize,
pub cols: usize,
pub eps: f32,
pub max_tokens: usize,
/* private fields */
}Expand description
The GPU side: kernels, per-layer weights, and workspaces for up to
max_tokens positions per call.
Fields§
§dim: usize§hc: usize§head_dim: usize§cols: usize§eps: f32§max_tokens: usizeImplementations§
Source§impl EngramV41
impl EngramV41
pub fn new( gpu: &dyn GpuBackend, dim: usize, hc: usize, head_dim: usize, cols: usize, eps: f32, max_tokens: usize, ) -> Result<Self>
pub fn in_features(&self) -> usize
pub fn out_features(&self) -> usize
Sourcepub fn add_layer(
&mut self,
gpu: &dyn GpuBackend,
w: EngramLayerWeights,
) -> Result<()>
pub fn add_layer( &mut self, gpu: &dyn GpuBackend, w: EngramLayerWeights, ) -> Result<()>
Register a layer’s weights; its row workspace is allocated here.
pub fn layer(&self, layer: usize) -> Option<&EngramLayerWeights>
Sourcepub fn upload_qk(
gpu: &dyn GpuBackend,
q: &[f32],
k: &[f32],
) -> Result<DevicePtr>
pub fn upload_qk( gpu: &dyn GpuBackend, q: &[f32], k: &[f32], ) -> Result<DevicePtr>
q_weight * k_weight (both [hc, dim], given as f32 values of the
stored bf16) uploaded as the gate’s qk.
Sourcepub fn rows_from_q2k(
&self,
gpu: &dyn GpuBackend,
layer: Option<usize>,
raw_blocks: &[u8],
n_rows: usize,
stream: u64,
) -> Result<()>
pub fn rows_from_q2k( &self, gpu: &dyn GpuBackend, layer: Option<usize>, raw_blocks: &[u8], n_rows: usize, stream: u64, ) -> Result<()>
Fill the row input from raw Q2_K blocks (n_rows * 84 bytes, one block
per row in [token][col] order): upload, dequantise on the device.
Sourcepub fn rows_from_bf16(
&self,
gpu: &dyn GpuBackend,
layer: Option<usize>,
rows_bf16: &[u16],
n_rows: usize,
) -> Result<()>
pub fn rows_from_bf16( &self, gpu: &dyn GpuBackend, layer: Option<usize>, rows_bf16: &[u16], n_rows: usize, ) -> Result<()>
Fill the row input from already-dequantised bf16 rows (bits), for oracles and for tables held resident in bf16.
Sourcepub fn rows_ptr(&self) -> DevicePtr
pub fn rows_ptr(&self) -> DevicePtr
The dequantised rows as the GEMM sees them ([n_rows, head_dim] bf16):
the shared workspace (layer = None).
Sourcepub fn kv_ptr(&self) -> DevicePtr
pub fn kv_ptr(&self) -> DevicePtr
The projected [tokens, dim * (hc + 1)] bf16 buffer after apply.
pub fn free(self, gpu: &dyn GpuBackend) -> Result<()>
Auto Trait Implementations§
impl Freeze for EngramV41
impl RefUnwindSafe for EngramV41
impl Send for EngramV41
impl Sync for EngramV41
impl Unpin for EngramV41
impl UnwindSafe for EngramV41
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