Skip to main content

CooperativeMatrix

Struct CooperativeMatrix 

Source
pub struct CooperativeMatrix<T, const USE: u32, const ROWS: u32, const COLS: u32> { /* private fields */ }
Expand description

A cooperative matrix distributed across the subgroup.

Each invocation holds a fragment of the full ROWS × COLS matrix. The hardware maps elements to invocations automatically.

§Type parameters

§Capability

Requires CooperativeMatrixKHR + SPV_KHR_cooperative_matrix.

Implementations§

Source§

impl<T, const USE: u32, const ROWS: u32, const COLS: u32> CooperativeMatrix<T, USE, ROWS, COLS>

Source

pub unsafe fn load(slice: &[T], layout: MatrixLayout, stride: u32) -> Self

Load a cooperative matrix through a pointer.

slice must point into an array. layout specifies whether the matrix is stored in row-major (MatrixLayout::RowMajor) or column-major (MatrixLayout::ColumnMajor) order. stride is the number of elements between the start of consecutive rows (row-major) or columns (column-major).

The scope is always Subgroup.

§Safety
  • slice must point into an array and be valid for all element accesses implied by the matrix dimensions, layout, and stride.
  • All operands must be dynamically uniform within every instance of the subgroup scope.
Source

pub unsafe fn store(self, slice: &mut [T], layout: MatrixLayout, stride: u32)

Store a cooperative matrix through a pointer.

slice must point into an array. layout specifies whether the matrix is stored in row-major (MatrixLayout::RowMajor) or column-major (MatrixLayout::ColumnMajor) order. stride is the number of elements between the start of consecutive rows (row-major) or columns (column-major).

The scope is always Subgroup.

§Safety
  • slice must point into an array and be valid for all element accesses implied by the matrix dimensions, layout, and stride.
  • All operands must be dynamically uniform within every instance of the subgroup scope.
Source

pub fn length(&self) -> u32

Returns the number of matrix components this invocation is responsible for.

The sum across all invocations in the subgroup equals ROWS * COLS.

Trait Implementations§

Source§

impl<T: Clone, const USE: u32, const ROWS: u32, const COLS: u32> Clone for CooperativeMatrix<T, USE, ROWS, COLS>

Source§

fn clone(&self) -> CooperativeMatrix<T, USE, ROWS, COLS>

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<T: Copy, const USE: u32, const ROWS: u32, const COLS: u32> Copy for CooperativeMatrix<T, USE, ROWS, COLS>

Auto Trait Implementations§

§

impl<T, const USE: u32, const ROWS: u32, const COLS: u32> Freeze for CooperativeMatrix<T, USE, ROWS, COLS>

§

impl<T, const USE: u32, const ROWS: u32, const COLS: u32> RefUnwindSafe for CooperativeMatrix<T, USE, ROWS, COLS>
where T: RefUnwindSafe,

§

impl<T, const USE: u32, const ROWS: u32, const COLS: u32> Send for CooperativeMatrix<T, USE, ROWS, COLS>
where T: Send,

§

impl<T, const USE: u32, const ROWS: u32, const COLS: u32> Sync for CooperativeMatrix<T, USE, ROWS, COLS>
where T: Sync,

§

impl<T, const USE: u32, const ROWS: u32, const COLS: u32> Unpin for CooperativeMatrix<T, USE, ROWS, COLS>
where T: Unpin,

§

impl<T, const USE: u32, const ROWS: u32, const COLS: u32> UnsafeUnpin for CooperativeMatrix<T, USE, ROWS, COLS>

§

impl<T, const USE: u32, const ROWS: u32, const COLS: u32> UnwindSafe for CooperativeMatrix<T, USE, ROWS, COLS>
where T: 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.