GpuGlobal

Struct GpuGlobal 

Source
pub struct GpuGlobal<'a, T: ?Sized> { /* private fields */ }
Expand description

Used to distinguish different memory spaces in GPU programming. GpuGlobal represents global memory space. See shared::GpuShared for shared memory space. When chunking or atomic operations are needed, GpuGlobal is owned by chunk or atomic struct. This ensures that the user cannot access the data without using chunk or atomic operations.

Implementations§

Source§

impl<'a, T: ?Sized> GpuGlobal<'a, T>

Source

pub fn new<'b: 'a>(slice: TensorViewMut<'a, T>) -> Self

Source§

impl<'a, T> GpuGlobal<'a, [T]>

Source

pub fn chunk_to_scope<CS, Map: ScopeUniqueMap<CS>>( self, _scope: CS, m: Map, ) -> GlobalGroupChunk<'a, T, CS, Map>
where CS: ChunkScope<FromScope = Grid>,

Convert GpuGlobal to GlobalGroupChunk in one step. See ChunkScope for more details about chunk scope.

Source§

impl<'a, T> GpuGlobal<'a, [T]>

Source

pub fn flatten<T2>(self) -> GpuGlobal<'a, [T2]>
where &'a [T]: VecFlatten<T2>,

Useful to optimize code with vector load/store. If length of the slice is not a multiple of N, the remaining elements will be ignored. For now, we only use flatten for global memory. For shared memory, user can use GpuShared<[[T; N]]> directly.

Source

pub fn is_empty(&self) -> bool

Source

pub fn len(&self) -> usize

Trait Implementations§

Source§

impl<'a, 'b: 'a, T: ?Sized> HostToDev<GpuGlobal<'a, T>> for &'a mut TensorViewMut<'b, T>

Available on non-crate feature codegen_tests only.

Allow host-side T to device-side T

Source§

fn convert(self) -> T

Source§

impl<'a, T: Sized> !DerefMut for GpuGlobal<'a, T>

Never implement DerefMut to prevent direct mutable access to the data. This ensures that the user cannot access the data without using chunk or atomic operations.

Auto Trait Implementations§

§

impl<'a, T> Freeze for GpuGlobal<'a, T>
where T: ?Sized,

§

impl<'a, T> RefUnwindSafe for GpuGlobal<'a, T>
where T: RefUnwindSafe + ?Sized,

§

impl<'a, T> Send for GpuGlobal<'a, T>
where T: Send + ?Sized,

§

impl<'a, T> Sync for GpuGlobal<'a, T>
where T: Sync + ?Sized,

§

impl<'a, T> Unpin for GpuGlobal<'a, T>
where T: ?Sized,

§

impl<'a, T> !UnwindSafe for GpuGlobal<'a, T>

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.