use crate::backend::cpu::{CpuBackend, CpuQuantStore};
use crate::Linear;
pub struct CpuGgufLinear {
pub store: CpuQuantStore,
pub in_features: usize,
pub out_features: usize,
}
impl Linear<CpuBackend> for CpuGgufLinear {
fn in_features(&self) -> usize {
self.in_features
}
fn out_features(&self) -> usize {
self.out_features
}
fn forward(
&self,
ctx: &mut <CpuBackend as crate::backend::Backend>::Context,
input: &<CpuBackend as crate::backend::Backend>::Buffer,
out: &mut <CpuBackend as crate::backend::Backend>::Buffer,
m: usize,
) {
match &self.store {
CpuQuantStore::Q4K {
weights,
n_rows,
n_cols,
} => {
<CpuBackend as crate::backend::Backend>::gemm(
ctx, input, weights, out, m, *n_rows, *n_cols,
);
}
}
}
}