pub struct BlockedCodeStorage { /* private fields */ }Expand description
Owns the encoded-codes storage for a TurboQuant collection.
Deep module: the only surface callers need is append, plus a few
read accessors used by the scoring kernels. The PERM0 interleave,
64-byte alignment, and block-fill bookkeeping all live behind this
struct.
Implementations§
Source§impl BlockedCodeStorage
impl BlockedCodeStorage
pub fn new(n_byte_groups: usize) -> BlockedCodeStorage
pub fn n_byte_groups(&self) -> usize
pub fn n_blocks(&self) -> usize
pub fn n_vectors(&self) -> usize
pub fn block_lanes_filled(&self, block_idx: usize) -> usize
Sourcepub fn block_codes(&self, block_idx: usize) -> &[u8] ⓘ
pub fn block_codes(&self, block_idx: usize) -> &[u8] ⓘ
Returns the raw PERM0-packed codes for block_idx. Guaranteed
to be aligned to SIMD_ALIGN (64 bytes); SIMD kernels can
load aligned register-width slices directly.
pub fn lane_scale(&self, block_idx: usize, lane: usize) -> f32
Sourcepub fn append(&mut self, packed: &[u8], scale: f32) -> BlockHandle
pub fn append(&mut self, packed: &[u8], scale: f32) -> BlockHandle
Append a vector’s per-vector packed bytes (lo | hi << 4 per
byte group, in dim-major order) to the open partial block,
opening a new block if the trailing block is full.
Sourcepub fn decode_lane(&self, block_idx: usize, lane: usize) -> Vec<u8> ⓘ
pub fn decode_lane(&self, block_idx: usize, lane: usize) -> Vec<u8> ⓘ
Decode the per-vector packed bytes that were written at
(block_idx, lane). The returned bytes match the original
packed argument from Self::append exactly — PERM0 is
fully internal to the storage layer.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BlockedCodeStorage
impl RefUnwindSafe for BlockedCodeStorage
impl Send for BlockedCodeStorage
impl Sync for BlockedCodeStorage
impl Unpin for BlockedCodeStorage
impl UnsafeUnpin for BlockedCodeStorage
impl UnwindSafe for BlockedCodeStorage
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request