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
T: element type (f32,f64,i32,u32,i8,u8, etc.)USE: matrix role — one ofMatrixUse::MatrixA,MatrixUse::MatrixB,MatrixUse::MatrixAccumulatorcast tou32ROWS: number of rowsCOLS: number of columns
§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>
impl<T, const USE: u32, const ROWS: u32, const COLS: u32> CooperativeMatrix<T, USE, ROWS, COLS>
Sourcepub unsafe fn load(slice: &[T], layout: MatrixLayout, stride: u32) -> Self
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
slicemust 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.
Sourcepub unsafe fn store(self, slice: &mut [T], layout: MatrixLayout, stride: u32)
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
slicemust 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.
Trait Implementations§
Source§impl<T: Clone, const USE: u32, const ROWS: u32, const COLS: u32> Clone for CooperativeMatrix<T, USE, ROWS, COLS>
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>
fn clone(&self) -> CooperativeMatrix<T, USE, ROWS, COLS>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more