use super::quants::QuantFormat;
use thiserror::Error;
#[derive(Debug, Error, PartialEq, Eq)]
pub enum KernelError {
#[error(
"{format:?} row of {in_dim} weights: not a multiple of the {block_weights}-weight block"
)]
IndivisibleRow {
format: QuantFormat,
in_dim: usize,
block_weights: usize,
},
#[error("{format:?} row of {len} bytes: not a multiple of the {block_bytes}-byte block")]
RowBytesNotBlockMultiple {
format: QuantFormat,
len: usize,
block_bytes: usize,
},
#[error(
"dot length mismatch: weight row has {weight_blocks} blocks, activations {activation_blocks}"
)]
BlockCountMismatch {
weight_blocks: usize,
activation_blocks: usize,
},
#[error(
"{format:?} quantize: {floats} input floats do not fill {out_blocks} output blocks exactly"
)]
QuantizeLenMismatch {
format: QuantFormat,
floats: usize,
out_blocks: usize,
},
#[error("{what}: length mismatch ({left} vs {right})")]
LengthMismatch {
what: &'static str,
left: usize,
right: usize,
},
#[error("{what}: input is empty")]
Empty {
what: &'static str,
},
#[error("invalid head_dim {head_dim}: must be nonzero and even")]
InvalidHeadDim {
head_dim: usize,
},
#[error("{what} is not implemented")]
Unimplemented {
what: &'static str,
},
#[error("{what}: unsupported weight format {format:?}")]
UnsupportedFormat {
what: &'static str,
format: QuantFormat,
},
}