DecodeW8a8Plan

Struct DecodeW8a8Plan 

Source
pub struct DecodeW8a8Plan {
    pub rows: usize,
    pub n: u32,
    pub k: u32,
    pub ldc: u32,
    pub out_capacity_bytes: usize,
}
Expand description

Everything the decode W8A8 cuBLASLt arm needs, as a PURE function of shape, format, lever and handles — so the CPU tests pin every clause without a GPU and without touching the process environment.

Clauses, each load-bearing:

  • family_armed — the caller’s slice of super::CublasScope (cublas.ssm / cublas.attn). Arming the dense FFN must not arm these; that separation is the whole point of the scoped lever (#917’s 10.3 GiB).
  • !disabled — the ATLAS_NO_W8A8_DECODE_PROJ kill switch.
  • DECODE_W8A8_ROWS.contains(&rows) — the 5..=16 band, on the PADDED n.
  • Fp8BlockScaled — cuBLASLt is told the weight scales are a BLK128x128 grid; a per-row row_scale has a different shape and reads as garbage.
  • n % 128 == 0, k % 128 == 0 — that grid is [N/128, K/128] and the activation quantizer emits one scale per 128-wide K group.
  • blk128x128_stride_ok(k) (i.e. k % 512 == 0) — cuBLAS requires the weight-scale column stride K/128 to be a multiple of 4.
  • ldc >= n — a leading dimension shorter than the column is rejected by the library; for a contiguous output the caller passes ldc = n.
  • OUTPUT ROOM for the full padded write extent (see strided_out_extent_elems).
  • the quantizer kernel, and the VEC128 scale-layout adapter (kernel AND scratch AND its capacity, and the FP8/scale scratch capacities). cuBLASLt reads the activation scales token-contiguous; handing over the quantizer’s [M, K/128] order is fast and WRONG (H100 2026-09-11: rel_rms 7.7e-2 / ~33 000 BF16 ULP on identical FP8 bytes). Falling back to the batch16 GEMV is the only safe answer when any of it is missing.

Fields§

§rows: usize

Padded decode rows — the ctx n the CUDA-graph cache is keyed by.

§n: u32

Output width of this projection.

§k: u32

Contract width of this projection.

§ldc: u32

Output row pitch in BF16 ELEMENTS (n for a contiguous output).

§out_capacity_bytes: usize

Allocated size of the output buffer, in bytes.

Implementations§

Source§

impl DecodeW8a8Plan

Source

pub fn contiguous( rows: usize, n: u32, k: u32, out_capacity_bytes: usize, ) -> Self

A contiguous [rows, n] output (SSM in_proj_qkvz, SSM out_proj, attention o_proj).

Source

pub fn strided( rows: usize, n: u32, k: u32, ldc: u32, out_capacity_bytes: usize, ) -> Self

A strided output: rows ldc BF16 elements apart (attention Q/K/V into the [n, per_seq_qkv] multi-seq QKV buffer).

Source

pub fn m_pad(&self) -> u32

The padded M cuBLASLt is actually handed.

Source

pub fn write_extent_bytes(&self) -> usize

Bytes of out this projection may touch, phantom rows included.

Trait Implementations§

Source§

impl Clone for DecodeW8a8Plan

Source§

fn clone(&self) -> DecodeW8a8Plan

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DecodeW8a8Plan

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for DecodeW8a8Plan

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more