Skip to main content

GemmArgs

Struct GemmArgs 

Source
pub struct GemmArgs<'a, T>
where T: Element,
{ pub a: MatrixRef<'a, T>, pub b: MatrixRef<'a, T>, pub c: Option<MatrixRef<'a, T>>, pub d: MatrixMut<'a, T>, pub bias: Option<VectorRef<'a, T>>, pub alpha: <T as Element>::Scalar, pub beta: <T as Element>::Scalar, }
Expand description

Per-launch arguments for a GemmPlan::run call.

c is optional: when None, β is ignored at the safe layer (treated as 0) and the kernel computes D = α · A · B. When Some, the kernel computes D = α · A · B + β · C — including the c.data == d.data case for in-place accumulation.

bias is required iff the descriptor’s epilogue is one of the Bias* variants, in which case the kernel computes D = activation(α · A · B + β · C + bias_broadcast(N)).

Fields§

§a: MatrixRef<'a, T>

Left input. Row-major [M, K].

§b: MatrixRef<'a, T>

Right input. Layout depends on the descriptor’s LayoutSku: column-major [K, N] for LayoutSku::Rcr, row-major [K, N] for LayoutSku::Rrr.

§c: Option<MatrixRef<'a, T>>

Optional accumulation source. Row-major [M, N].

§d: MatrixMut<'a, T>

Output. Row-major [M, N].

§bias: Option<VectorRef<'a, T>>

Optional bias vector. Required (Some) when the descriptor’s epilogue is any Bias* variant; must be None for EpilogueKind::Identity. Length-N, contiguous (stride 1) device memory; broadcast across rows of D.

§alpha: <T as Element>::Scalar

Multiplier on the matrix-multiply accumulator. Scalar type matches T::Scalarf32 for f16/bf16/f32/F32Strict, f64 for f64.

§beta: <T as Element>::Scalar

Multiplier on c. Forced to 0 internally when c is None, so callers don’t need to pre-zero it for the no-accumulate case.

Trait Implementations§

Source§

impl<'a, T> Debug for GemmArgs<'a, T>
where T: Debug + Element, <T as Element>::Scalar: Debug,

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, T> !UnwindSafe for GemmArgs<'a, T>

§

impl<'a, T> Freeze for GemmArgs<'a, T>
where <T as Element>::Scalar: Freeze,

§

impl<'a, T> RefUnwindSafe for GemmArgs<'a, T>

§

impl<'a, T> Send for GemmArgs<'a, T>
where <T as Element>::Scalar: Send, T: Sync + Send,

§

impl<'a, T> Sync for GemmArgs<'a, T>
where <T as Element>::Scalar: Sync, T: Sync,

§

impl<'a, T> Unpin for GemmArgs<'a, T>
where <T as Element>::Scalar: Unpin,

§

impl<'a, T> UnsafeUnpin for GemmArgs<'a, T>
where <T as Element>::Scalar: UnsafeUnpin,

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.