Skip to main content

GemmArgs

Struct GemmArgs 

Source
#[repr(C)]
pub struct GemmArgs { pub a: u64, pub b: u64, pub c: u64, pub n_shires: u64, pub m: u32, pub n: u32, pub k: u32, pub lda: u32, pub ldb: u32, pub ldc: u32, pub alpha: f32, pub beta: f32, }
Expand description

Arguments for the single-precision general matrix multiplication (sGEMM) kernel (sgemm-rs), implementing C = alphaAB + beta*C.

§Layout invariants (v0.1 restrictions)

  • alpha must be 1.0 and beta must be 0.0.
  • n may be any positive integer; partial last-column tiles are handled transparently via 64-byte-aligned row padding.
  • a, b, c must be TENSOR_ALIGN-byte aligned device addresses.
  • lda, ldb, ldc must be multiples of TENSOR_ALIGN (64 bytes).

All dimensions are in elements; leading dimensions are in bytes.

§ABI layout

The four 8-byte fields (a, b, c, n_shires) are grouped first to give the struct 8-byte alignment with no internal or trailing padding: 4*8 + 8*4 = 64 bytes total.

Fields§

§a: u64

Device address of A [M x K], row-major, 64-byte aligned.

§b: u64

Device address of B [K x N], row-major, 64-byte aligned.

§c: u64

Device address of C [M x N], row-major, 64-byte aligned.

§n_shires: u64

Number of participating compute shires. Stored as u64 to keep all 8-byte fields contiguous and the total struct size a multiple of the struct’s 8-byte alignment. Effective range: 1..=34.

§m: u32

Number of rows of A and C (M dimension).

§n: u32

Number of columns of B and C (N dimension). May be any positive integer; the last output tile column is partial when N is not a multiple of 16.

§k: u32

Shared inner dimension (K): columns of A and rows of B.

§lda: u32

Row stride of A in bytes (multiple of 64).

§ldb: u32

Row stride of B in bytes (multiple of 64).

§ldc: u32

Row stride of C in bytes (multiple of 64).

§alpha: f32

A*B scaling factor. Must be 1.0 in v0.1.

§beta: f32

C scaling factor. Must be 0.0 in v0.1.

Trait Implementations§

Source§

impl Clone for GemmArgs

Source§

fn clone(&self) -> GemmArgs

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for GemmArgs

Source§

impl Debug for GemmArgs

Source§

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

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

impl DeviceArgs for GemmArgs

Source§

fn as_bytes(&self) -> &[u8]

Borrow the struct as its on-wire bytes (host side: stage these in device memory as the launch arguments).
Source§

unsafe fn from_ptr<'a>(ptr: *const u8) -> &'a Self

Reinterpret a device-memory pointer as these arguments (device side). Read more
Source§

impl PartialEq for GemmArgs

Source§

fn eq(&self, other: &GemmArgs) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for GemmArgs

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.

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 = !

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.