pub enum QuantType {
Show 14 variants
Q4_0,
Q4_1,
Q5_0,
Q5_1,
Q8_0,
Q8_1,
Q2K,
Q3K,
Q4_K_M,
Q5K,
Q6K,
Iq4Nl,
Iq4Xs,
Iq3S,
}Expand description
Quantization block format for the QMatMul fused op
(crate::registry::FusedOpParams::QMatMul). Matches the
GGML/GGUF block layouts; each variant implies a fixed bytes-per-block
and elements-per-block. Only variants for which a backend has a
fused dequant-in-kernel matmul are currently exposed.
Variants§
Q4_0
32-element block = 2 bytes f16 scale + 16 bytes packed u4 quants.
Q4_1
32-element block = 2 bytes f16 d + 2 bytes f16 m + 16 bytes packed u4 quants.
Q5_0
32-element block = 2 bytes f16 d + 4 bytes high-bit + 16 bytes packed u4 quants.
Q5_1
32-element block = 2 bytes f16 d + 2 bytes f16 m + 4 bytes high-bit + 16 bytes packed u4.
Q8_0
32-element block = 2 bytes f16 scale + 32 bytes i8 quants.
Q8_1
32-element block = 2 bytes f16 d + 2 bytes f16 s + 32 bytes i8 quants.
Q2K
256-element super-block = scales + 64-byte 2-bit packed quants + 4 bytes f16 d/dmin.
Q3K
256-element super-block = hmask + 64-byte 2-bit packed quants + 12-byte scales + 2 bytes f16 d.
Q4_K_M
256-element super-block = 2 bytes f16 d + 2 bytes f16 dmin + 12 bytes of 6-bit-packed sub-block scales/mins + 128 bytes of 4-bit-packed quants. GGML k-quant “medium” format.
Q5K
256-element super-block = d + dmin + 12-byte scales + 32-byte hmask + 128-byte qs.
Q6K
256-element super-block = 128-byte ql + 64-byte qh + 16-byte i8 scales + 2 bytes f16 d.
Iq4Nl
llama.cpp IQ4_NL: 32-element block = 2 bytes f16 d + 16 bytes packed 4-bit indices into a
non-linear codebook. Storage and dequantization only: QMatMul dequantizes tile by tile and
multiplies in float (board 307: no quantized-by-quantized product).
Iq4Xs
llama.cpp IQ4_XS: 256-element super-block = 2 bytes f16 d + 2 bytes high scale bits + 4 bytes
low scale bits + 128 bytes packed 4-bit codebook indices. Same float-only route as Iq4Nl.
Iq3S
llama.cpp IQ3_S: 256-element super-block = 2 bytes f16 d + 64 bytes grid indices + 8 bytes
high bits + 32 bytes signs + 4 bytes sub-block scales. Same float-only route as Iq4Nl.
Implementations§
Source§impl QuantType
impl QuantType
Sourcepub fn bytes_per_block(self) -> usize
pub fn bytes_per_block(self) -> usize
Bytes per quantization block. Mirrors std::mem::size_of::<BlockQ*>().
Sourcepub fn elements_per_block(self) -> usize
pub fn elements_per_block(self) -> usize
Elements per quantization block.
Trait Implementations§
impl Copy for QuantType
impl Eq for QuantType
impl StructuralPartialEq for QuantType
Auto Trait Implementations§
impl Forget for QuantType
impl Freeze for QuantType
impl Move for QuantType
impl RefUnwindSafe for QuantType
impl Send for QuantType
impl Sync for QuantType
impl Unpin for QuantType
impl UnsafeUnpin for QuantType
impl UnwindSafe for QuantType
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.