pub struct W8a8Ctx {
pub kernels: W8a8Kernels,
pub scratch: W8a8Scratch,
}Expand description
2026-09-28: The kernels and the quantized-activation scratch one model’s W8A8 projections share.
Fields§
§kernels: W8a8Kernels§scratch: W8a8ScratchImplementations§
Source§impl W8a8Ctx
impl W8a8Ctx
Sourcepub fn new(gpu: &dyn GpuBackend, max_k: u32) -> Result<Self>
pub fn new(gpu: &dyn GpuBackend, max_k: u32) -> Result<Self>
2026-09-28: Look the kernels up and allocate a scratch for a max_k-wide
activation of ops::W8A8_MAX_ROWS rows.
Sourcepub fn available(&self, w: &W8a8Weight, rows: usize) -> bool
pub fn available(&self, w: &W8a8Weight, rows: usize) -> bool
2026-09-28: Whether w can run W8A8 at rows rows.
Sourcepub fn proj(
&self,
gpu: &dyn GpuBackend,
w: &W8a8Weight,
x: DevicePtr,
ldx: u32,
rows: usize,
out: DevicePtr,
ldc: u32,
stream: u64,
) -> Result<bool>
pub fn proj( &self, gpu: &dyn GpuBackend, w: &W8a8Weight, x: DevicePtr, ldx: u32, rows: usize, out: DevicePtr, ldc: u32, stream: u64, ) -> Result<bool>
2026-09-28: out[rows, ldc] = W8A8 of x[rows, ldx] (BF16) and w;
Ok(false), launching nothing, when not Self::available.
Sourcepub fn silu_proj(
&self,
gpu: &dyn GpuBackend,
w: &W8a8Weight,
gate: DevicePtr,
up: DevicePtr,
ld: u32,
rows: usize,
out: DevicePtr,
ldc: u32,
stream: u64,
) -> Result<bool>
pub fn silu_proj( &self, gpu: &dyn GpuBackend, w: &W8a8Weight, gate: DevicePtr, up: DevicePtr, ld: u32, rows: usize, out: DevicePtr, ldc: u32, stream: u64, ) -> Result<bool>
2026-09-28: The down projection of a SiLU FFN: out = W8A8 of
bf16(silu(gate) * up) (gate and up [rows, ld] BF16) and w, with the
SiLU product quantized in the same launch; Ok(false) when not available.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for W8a8Ctx
impl RefUnwindSafe for W8a8Ctx
impl Send for W8a8Ctx
impl Sync for W8a8Ctx
impl Unpin for W8a8Ctx
impl UnwindSafe for W8a8Ctx
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