pub struct MatrixDesc<T: GpuFloat> {
pub ptr: CUdeviceptr,
pub rows: u32,
pub cols: u32,
pub ld: u32,
pub layout: Layout,
/* private fields */
}Expand description
Describes a matrix stored in device memory.
This is an immutable (read-only) view. For an output matrix that will be
written to, use MatrixDescMut.
All fields are Copy-sized, so MatrixDesc itself is Copy.
Fields§
§ptr: CUdeviceptrDevice pointer to the matrix data.
rows: u32Number of rows.
cols: u32Number of columns.
ld: u32Leading dimension (stride between rows/columns depending on layout).
layout: LayoutMemory layout.
Implementations§
Source§impl<T: GpuFloat> MatrixDesc<T>
impl<T: GpuFloat> MatrixDesc<T>
Sourcepub fn from_buffer(
buf: &DeviceBuffer<T>,
rows: u32,
cols: u32,
layout: Layout,
) -> BlasResult<Self>
pub fn from_buffer( buf: &DeviceBuffer<T>, rows: u32, cols: u32, layout: Layout, ) -> BlasResult<Self>
Create a matrix descriptor from a DeviceBuffer.
Returns an error if the buffer is too small for the requested dimensions.
Sourcepub fn from_raw(
ptr: CUdeviceptr,
rows: u32,
cols: u32,
ld: u32,
layout: Layout,
) -> Self
pub fn from_raw( ptr: CUdeviceptr, rows: u32, cols: u32, ld: u32, layout: Layout, ) -> Self
Create with a raw device pointer (no size validation).
Sourcepub fn storage_bytes(&self) -> usize
pub fn storage_bytes(&self) -> usize
Storage bytes (full stride, including padding from leading dimension).
Sourcepub fn effective_dims(&self, trans: Transpose) -> (u32, u32)
pub fn effective_dims(&self, trans: Transpose) -> (u32, u32)
Effective dimensions after transpose.
Trait Implementations§
Source§impl<T: Clone + GpuFloat> Clone for MatrixDesc<T>
impl<T: Clone + GpuFloat> Clone for MatrixDesc<T>
Source§fn clone(&self) -> MatrixDesc<T>
fn clone(&self) -> MatrixDesc<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<T: Copy + GpuFloat> Copy for MatrixDesc<T>
Auto Trait Implementations§
impl<T> Freeze for MatrixDesc<T>
impl<T> RefUnwindSafe for MatrixDesc<T>where
T: RefUnwindSafe,
impl<T> Send for MatrixDesc<T>
impl<T> Sync for MatrixDesc<T>
impl<T> Unpin for MatrixDesc<T>where
T: Unpin,
impl<T> UnsafeUnpin for MatrixDesc<T>
impl<T> UnwindSafe for MatrixDesc<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more