pub struct DecodeTable { /* private fields */ }Expand description
Precomputed 256-entry lookup table mapping every possible packed
byte to the sequence of bucket_weights values it decodes to.
PLAID §4.5 notes that naive decompression pays a chain of
shift-mask-weight-lookup operations per residual dimension; a
one-off table that already composes the shift/mask with the weight
lookup reduces decoding to a single load per code position. For
nbits=2 the whole table is 256 × 4 f32 = 4 KiB and easily stays
in L1.
Implementations§
Source§impl DecodeTable
impl DecodeTable
Sourcepub fn new(codec: &ResidualCodec) -> Self
pub fn new(codec: &ResidualCodec) -> Self
Build the table for codec. Call once per search/decode batch
and reuse across every encoded vector.
Sourcepub fn weights_for(&self, byte: u8) -> &[f32]
pub fn weights_for(&self, byte: u8) -> &[f32]
Weights for the codes_per_byte positions inside packed byte
byte. Length always equals codes_per_byte.
Sourcepub fn weights_flat(&self) -> &[f32]
pub fn weights_flat(&self) -> &[f32]
Raw row-major [256, codes_per_byte] weights buffer.
Exposed so the search path can upload the table once per query
and decode residuals via batched index_select on the device,
matching the GPU decompression kernel described in PLAID §4.5
(one thread per packed byte).
Sourcepub fn codes_per_byte(&self) -> usize
pub fn codes_per_byte(&self) -> usize
Number of codes packed into one byte at this table’s nbits.
Auto Trait Implementations§
impl Freeze for DecodeTable
impl RefUnwindSafe for DecodeTable
impl Send for DecodeTable
impl Sync for DecodeTable
impl Unpin for DecodeTable
impl UnsafeUnpin for DecodeTable
impl UnwindSafe for DecodeTable
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<T> ErasedDestructor for Twhere
T: 'static,
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 more