GlobalGroupChunk

Struct GlobalGroupChunk 

Source
pub struct GlobalGroupChunk<'a, T, CS: ChunkScope, Map: ScopeUniqueMap<CS>> {
    pub map_params: Map,
    /* private fields */
}
Expand description

Represent a chunk of global memory that is uniquely mapped to each thread group. It supports both continuous and non-continuous mapping strategies.

  • T: element type
  • Map: mapping strategy type
  • ’a: lifetime of the underlying slice
  • map_params: parameters for the mapping strategy

Fields§

§map_params: Map

Implementations§

Source§

impl<'a, T, CS, Map: ScopeUniqueMap<CS>> GlobalGroupChunk<'a, T, CS, Map>
where CS: ChunkScope<FromScope = Grid> + ChunkScope,

Creating global chunk from GpuGlobal.

Source

pub fn new(global: GpuGlobal<'a, [T]>, map_params: Map) -> Self

TODO: We will prevent rechunking of global mem in the mir_analysis. For now, we just leave it to the user.

Source

pub fn new_from_host<'b: 'a>( slice: &'a mut TensorViewMut<'b, [T]>, map_params: Map, ) -> Self

In some cases, passing GlobalThreadChunk from host to device is more convenient. Due to unknown optimization-related factors, passing GlobalThreadChunk to kernel function may make the kernel faster (see examples/matmul). In addition, directly passing GlobalThreadChunk from host to device naturally avoids the problem of rechunking the global mem.

Source§

impl<'a, T, CS: ChunkScope, Map: ScopeUniqueMap<CS>> GlobalGroupChunk<'a, T, CS, Map>

Creating global chunk from GpuGlobal.

Source

pub fn chunk_to_scope<CS2: ChunkScope, Map2: ScopeUniqueMap<CS2>>( self, _cs: CS2, map: Map2, ) -> GlobalGroupChunk<'a, T, ChainedScope<CS, CS2>, ChainedMap<CS, CS2, Map, Map2>>
where Map: ScopeUniqueMap<CS>, CS: ChunkScope<ToScope = CS2::FromScope>, Map2::GlobalIndexType: AsPrimitive<Map::IndexType>,

Convert GlobalGroupChunk to another GlobalGroupChunk with different ChunkScope and Map. See ChunkScope for more details about chunk scope.

Source

pub fn local2global( &self, idx: <Map as ScopeUniqueMap<CS>>::IndexType, ) -> Map::GlobalIndexType

Trait Implementations§

Source§

impl<'a, T, CS: ChunkScope, Map: ScopeUniqueMap<CS>> Index<<Map as ScopeUniqueMap<CS>>::IndexType> for GlobalGroupChunk<'a, T, CS, Map>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, idx: Map::IndexType) -> &T

Performs the indexing (container[index]) operation. Read more
Source§

impl<'a, T, CS, Map: ScopeUniqueMap<CS>> IndexMut<<Map as ScopeUniqueMap<CS>>::IndexType> for GlobalGroupChunk<'a, T, CS, Map>
where CS: ChunkScope<ToScope = Thread> + ChunkScope,

Source§

fn index_mut(&mut self, idx: Map::IndexType) -> &mut T

Performs the mutable indexing (container[index]) operation. Read more

Auto Trait Implementations§

§

impl<'a, T, CS, Map> Freeze for GlobalGroupChunk<'a, T, CS, Map>
where Map: Freeze,

§

impl<'a, T, CS, Map> RefUnwindSafe for GlobalGroupChunk<'a, T, CS, Map>

§

impl<'a, T, CS, Map> Send for GlobalGroupChunk<'a, T, CS, Map>
where Map: Send, CS: Send, T: Send,

§

impl<'a, T, CS, Map> Sync for GlobalGroupChunk<'a, T, CS, Map>
where Map: Sync, CS: Sync, T: Sync,

§

impl<'a, T, CS, Map> Unpin for GlobalGroupChunk<'a, T, CS, Map>
where Map: Unpin, CS: Unpin,

§

impl<'a, T, CS, Map> !UnwindSafe for GlobalGroupChunk<'a, T, CS, Map>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> HostToDev<T> for T

Source§

fn convert(self) -> T

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, 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.