Skip to main content

Q8SectionSink

Struct Q8SectionSink 

Source
pub struct Q8SectionSink<'a, W> { /* private fields */ }
Expand description

A bounded bridge from canonical Q8 matrix rows into one streaming .fttsq section.

.fttsq keeps the Q8 tensor contiguous, followed by the contiguous F32 scale tensor that its directory names. The sink therefore streams every Q8 row immediately, retaining only the scale tail (at most one MiB for the pinned inventory) until the values have completed. It also keeps one byte-per-row scratch buffer for the signed-to-wire byte conversion, so the total working set remains bounded by the row adapter’s 320 KiB plus at most 64 KiB of value bytes and one MiB of scales — never by the full matrix size.

Implementations§

Source§

impl<'a, W: Write + Seek> Q8SectionSink<'a, W>

Source

pub fn new( writer: &'a mut FttsqStreamingWriter<W>, section: impl Into<String>, expected_rows: usize, ) -> Result<Self, Q8SectionSinkError>

Starts writing one Q8 matrix section with a fixed number of output channels.

§Errors

Returns Q8SectionSinkError::OutputChannelCountTooLarge before allocating when the planned F32 scale tail exceeds this adapter’s one-MiB memory ceiling.

Source

pub fn finish(self) -> Result<(), Q8SectionSinkError>

Appends the scale tail after all Q8 values have been streamed.

§Errors

Returns a named refusal when a prior row failed or a stream write cannot complete.

Trait Implementations§

Source§

impl<W: Write + Seek> Q8RowSink for Q8SectionSink<'_, W>

Source§

type Error = Q8SectionSinkError

Failure produced while accepting a quantized row.
Source§

fn write_q8_row( &mut self, row: usize, scale: f32, values: &[i8], ) -> Result<(), Self::Error>

Accepts one output channel of a matrix. Read more

Auto Trait Implementations§

§

impl<'a, W> !UnwindSafe for Q8SectionSink<'a, W>

§

impl<'a, W> Freeze for Q8SectionSink<'a, W>

§

impl<'a, W> RefUnwindSafe for Q8SectionSink<'a, W>
where W: RefUnwindSafe,

§

impl<'a, W> Send for Q8SectionSink<'a, W>
where W: Send,

§

impl<'a, W> Sync for Q8SectionSink<'a, W>
where W: Sync,

§

impl<'a, W> Unpin for Q8SectionSink<'a, W>

§

impl<'a, W> UnsafeUnpin for Q8SectionSink<'a, W>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.