pub enum QuantType {
Q4_0,
Q4_1,
Q5_0,
Q5_1,
Q8_0,
Q8_1,
Q2K,
Q3K,
Q4_K_M,
Q5K,
Q6K,
}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.
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 Freeze 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.