Skip to main content

expand

Function expand 

Source
pub fn expand<F: Numeric, NF: Size>(
    scope: &Scope,
    word: <u32 as CubeType>::ExpandType,
    first: <u32 as CubeType>::ExpandType,
    table: <ComptimeOption<Box<[f32]>> as CubeType>::ExpandType,
    scheme: QuantScheme,
) -> <Vector<F, NF> as CubeType>::ExpandType
Expand description

Unpack NF consecutive fields of one u32 word starting at field first (a runtime index), cast but unscaled — the caller multiplies by whatever scale its lines carry. The sub-word counterpart of [unpack_cast_u32], for reads whose served line is narrower than a word: NF may be any divisor of the packing factor, and first selects which slice of the word this line is. e2m1 is refused — its native pairs cannot be split at a field boundary.

The caller must keep first + NF <= num_quants. first is runtime, so nothing here can check it, and a shift at or past 32 is not an error on most ISAs — the hardware masks the shift amount to 5 bits and the read silently lands on the wrong fields.