Struct Matrix

Source
pub struct Matrix<C: CubeType> { /* private fields */ }
Expand description

A matrix represent a 2D grid of numbers.

They can either be in a row major or a column major format.

Implementations§

Source§

impl<C: CubePrimitive> Matrix<C>

Source

pub unsafe fn uninitialized( ident: MatrixIdent, m: u32, n: u32, k: u32, layout: MatrixLayout, ) -> Self

Create a new uninitialized matrix that is going to be used in the matrix-multiply and accumulate function.

§Safety

Must be initialized with load or fill before use. Using it without initialization is undefined behaviour on CUDA, and completely invalid on Vulkan.

You have to declare the shape used for the execution. The shape of the current matrix is determined using the MatrixIdent.

Not all shapes are supported, and the permitted shapes depend on the element type.

Refer to nvidia documentation.

Source

pub fn from_value( ident: MatrixIdent, m: u32, n: u32, k: u32, layout: MatrixLayout, value: C, ) -> Self

Create a new matrix that is going to be used in the matrix-multiply and accumulate function and is filled with value.

You have to declare the shape used for the execution. The shape of the current matrix is determined using the MatrixIdent.

Not all shapes are supported, and the permitted shapes depend on the element type.

Refer to nvidia documentation.

Source

pub fn from_slice( ident: MatrixIdent, m: u32, n: u32, k: u32, layout: MatrixLayout, value: &Slice<C>, stride: u32, ) -> Self

Create a new matrix that is going to be used in the matrix-multiply and accumulate function and is loaded from value with stride.

You have to declare the shape used for the execution. The shape of the current matrix is determined using the MatrixIdent.

Not all shapes are supported, and the permitted shapes depend on the element type.

Refer to nvidia documentation.

Source

pub fn __expand_uninitialized( scope: &mut Scope, ident: MatrixIdent, m: ExpandElementTyped<u32>, n: ExpandElementTyped<u32>, k: ExpandElementTyped<u32>, layout: MatrixLayout, ) -> MatrixExpand<C>

Source

pub fn __expand_from_value( scope: &mut Scope, ident: MatrixIdent, m: ExpandElementTyped<u32>, n: ExpandElementTyped<u32>, k: ExpandElementTyped<u32>, layout: MatrixLayout, value: ExpandElementTyped<C>, ) -> MatrixExpand<C>

Source

pub fn __expand_from_slice( scope: &mut Scope, ident: MatrixIdent, m: ExpandElementTyped<u32>, n: ExpandElementTyped<u32>, k: ExpandElementTyped<u32>, layout: MatrixLayout, value: ExpandElementTyped<Slice<C>>, stride: ExpandElementTyped<u32>, ) -> MatrixExpand<C>

Trait Implementations§

Source§

impl<C: Clone + CubeType> Clone for Matrix<C>

Source§

fn clone(&self) -> Matrix<C>

Returns a copy 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<C: CubeType> CubeType for Matrix<C>

Source§

type ExpandType = MatrixExpand<C>

Source§

fn init(scope: &mut Scope, expand: Self::ExpandType) -> Self::ExpandType

Wrapper around the init method, necessary to type inference.
Source§

impl<C: Copy + CubeType> Copy for Matrix<C>

Auto Trait Implementations§

§

impl<C> Freeze for Matrix<C>

§

impl<C> RefUnwindSafe for Matrix<C>
where C: RefUnwindSafe,

§

impl<C> Send for Matrix<C>
where C: Send,

§

impl<C> Sync for Matrix<C>
where C: Sync,

§

impl<C> Unpin for Matrix<C>
where C: Unpin,

§

impl<C> UnwindSafe for Matrix<C>
where C: UnwindSafe,

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> 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.
Source§

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

Source§

fn vzip(self) -> V