pub struct MapLinearWithDim<const N: usize = 3> { /* private fields */ }Expand description
Linear mapping for 1D array. N is the number of thread dimensions. width is the chunking window. The array is divided into chunks along threads until all elements are covered.
§Examples
Given: bdim = (x=4, y=1, z=1) gdim = (x=1, y=1, z=1) arr: [T; 8] width = 2
With width = 2, the mapping assign two continuous elements to thread 0-3:
[0, 0, 1, 1, 2, 2, 3, 3]
width = 1, the mapping assign two non-continuous elements to thread 0-3: [0, 1, 2, 3, 0, 1, 2, 3]
TODO: deprecate MapLinear and MapLinearWithDim in favor of reshape_map! macro.
Implementations§
Trait Implementations§
Source§impl<const N: usize> Clone for MapLinearWithDim<N>
impl<const N: usize> Clone for MapLinearWithDim<N>
Source§fn clone(&self) -> MapLinearWithDim<N>
fn clone(&self) -> MapLinearWithDim<N>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<CS: ChunkScope> ScopeUniqueMap<CS> for MapLinearWithDim<3>
impl<CS: ChunkScope> ScopeUniqueMap<CS> for MapLinearWithDim<3>
type IndexType = usize
type GlobalIndexType = usize
Source§fn map(
&self,
idx: Self::IndexType,
thread_ids: [u32; 6],
) -> (bool, Self::GlobalIndexType)
fn map( &self, idx: Self::IndexType, thread_ids: [u32; 6], ) -> (bool, Self::GlobalIndexType)
Returns the extra precondition of indexing operation and the global
index. Without providing extra precondition, index will always check the
OOB error with global idx.
fn precondition(&self) -> bool
Source§impl<CS: ChunkScope> ScopeUniqueMap<CS> for MapLinearWithDim<1>
§Safety
It is safe to use this mapping as long as the thread dimensions are properly
configured.
impl<CS: ChunkScope> ScopeUniqueMap<CS> for MapLinearWithDim<1>
§Safety
It is safe to use this mapping as long as the thread dimensions are properly configured.
Source§impl<CS: ChunkScope> ScopeUniqueMap<CS> for MapLinearWithDim<2>
impl<CS: ChunkScope> ScopeUniqueMap<CS> for MapLinearWithDim<2>
impl<const N: usize> Copy for MapLinearWithDim<N>
Auto Trait Implementations§
impl<const N: usize> Freeze for MapLinearWithDim<N>
impl<const N: usize> RefUnwindSafe for MapLinearWithDim<N>
impl<const N: usize> Send for MapLinearWithDim<N>
impl<const N: usize> Sync for MapLinearWithDim<N>
impl<const N: usize> Unpin for MapLinearWithDim<N>
impl<const N: usize> UnwindSafe for MapLinearWithDim<N>
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