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
2026-09-25: 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<()>
2026-09-25: Register a layer’s weights; its row workspace is allocated
here, replacing w.raw and w.rows.
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>
2026-09-25: 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<()>
2026-09-25: Fill the row input from raw Q2_K blocks
(n_rows * ENGRAM_ROW_BYTES bytes, one block per row in [token][col]
order): upload, then dequantise on the device. Requires head_dim == 256.
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<()>
2026-09-25: Fill the row input from bf16 rows (as bits); the GPU oracle test uses it.
Sourcepub fn rows_ptr(&self) -> DevicePtr
pub fn rows_ptr(&self) -> DevicePtr
2026-09-25: The shared workspace’s dequantised rows ([n_rows, head_dim]
bf16), the target of layer = None.
Sourcepub fn kv_ptr(&self) -> DevicePtr
pub fn kv_ptr(&self) -> DevicePtr
2026-09-25: The projected [tokens, dim * (hc + 1)] bf16 buffer after
apply.