pub trait BackendKvDtype<K: KvDtypeKind>: BackendPagedKv {
type KvBuffer: Send + Sync;
type KvScales: Send + Sync + Default;
}Expand description
Capability-trait for backends that can store + read a KV cache of
type K.
The two associated types carry the K-specific storage shape:
KvBuffer: per-layer K/V element storage. ForK = KvFp16it is the backend’s normalSelf::Buffer(FP16). ForK = KvInt8it is the backend’s INT8 buffer (e.g.CudaSlice<i8>on CUDA).KvScales: per-token-per-kv-head scales. ForK = KvFp16this is the unit type()(no scales). ForK = KvInt8/KvFp8it is a backend-specific FP16 buffer.
Models that want INT8 KV use:
where B: BackendKvDtype<KvInt8>
— the buffers in KvCache<B, KvInt8> are then CudaSlice<i8> and
CudaSlice<f16>, distinct from the FP16 path’s Self::Buffer.
Required Associated Types§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".