pub enum MetalKvDtype {
Bf16,
Turbo8,
Turbo4,
Turbo3,
Turbo2,
Bf16KTurbo4V,
Bf16KTurbo3V,
Bf16KTurbo2V,
}Expand description
KV cache storage format for the Metal contiguous cache.
Variants§
Bf16
Raw bfloat, 2 bytes/elem.
Turbo8
FP8 E4M3 data + bf16 group-of-16 scales, WHT-rotated basis. 2.13× smaller than bf16.
Turbo4
4-bit Lloyd-Max codebook indices + FP8 group-of-16 scales (matched-norm L2), WHT-rotated basis. 3.56× smaller than bf16.
Turbo3
3-bit Lloyd-Max (8 values → 3 bytes) + FP8 group scales. 4.57× smaller than bf16.
Turbo2
2-bit Lloyd-Max (4 elems/byte) + FP8 group scales. 6.4× smaller than bf16.
Bf16KTurbo4V
Safer-asym: K raw bf16 (un-rotated), V Turbo4. Production- recommended frontier — K precision dominates retrieval quality.
Bf16KTurbo3V
Safer-asym: K raw bf16, V Turbo3.
Bf16KTurbo2V
Safer-asym: K raw bf16, V Turbo2.
Implementations§
Source§impl MetalKvDtype
impl MetalKvDtype
Sourcepub fn k_is_rotated(self) -> bool
pub fn k_is_rotated(self) -> bool
K side stored in the WHT-rotated basis (gates K rotation at append and the WHT(Q) decode bookend).
Sourcepub fn v_is_rotated(self) -> bool
pub fn v_is_rotated(self) -> bool
V side stored in the WHT-rotated basis (gates V rotation at append and the iWHT(out) decode bookend).
Trait Implementations§
Source§impl Clone for MetalKvDtype
impl Clone for MetalKvDtype
Source§fn clone(&self) -> MetalKvDtype
fn clone(&self) -> MetalKvDtype
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MetalKvDtype
impl Debug for MetalKvDtype
Source§impl FromStr for MetalKvDtype
impl FromStr for MetalKvDtype
Source§impl PartialEq for MetalKvDtype
impl PartialEq for MetalKvDtype
impl Copy for MetalKvDtype
impl Eq for MetalKvDtype
impl StructuralPartialEq for MetalKvDtype
Auto Trait Implementations§
impl Freeze for MetalKvDtype
impl RefUnwindSafe for MetalKvDtype
impl Send for MetalKvDtype
impl Sync for MetalKvDtype
impl Unpin for MetalKvDtype
impl UnwindSafe for MetalKvDtype
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.