pub enum KernelMemMap<'a, F, Mem: ComputeMemory<F>> {
Chunked {
data: Mem::FSlice<'a>,
log_min_chunk_size: usize,
},
ChunkedMut {
data: Mem::FSliceMut<'a>,
log_min_chunk_size: usize,
},
Local {
log_size: usize,
},
}
Expand description
A memory mapping specification for a kernel execution.
See ComputeLayer::accumulate_kernels
for context on kernel execution.
Variants§
Chunked
This maps a chunk of a buffer in global device memory to a read-only kernel buffer.
ChunkedMut
This maps a chunk of a mutable buffer in global device memory to a read-write kernel buffer. When the kernel exits, the data in the kernel buffer is written back to the original location.
Local
This allocates a kernel-local scratchpad buffer. The size specified in the mapping is the total size of all kernel scratchpads. This is so that the kernel’s local scratchpad size scales up proportionally to the size of chunked buffers.
Implementations§
Source§impl<'a, F, Mem: ComputeMemory<F>> KernelMemMap<'a, F, Mem>
impl<'a, F, Mem: ComputeMemory<F>> KernelMemMap<'a, F, Mem>
Sourcepub fn log_chunks_range(mappings: &[Self]) -> Option<Range<usize>>
pub fn log_chunks_range(mappings: &[Self]) -> Option<Range<usize>>
Computes a range of possible number of chunks that data can be split into, given a sequence of memory mappings.
pub fn chunks( self, log_chunks: usize, ) -> impl Iterator<Item = KernelMemMap<'a, F, Mem>>
Auto Trait Implementations§
impl<'a, F, Mem> Freeze for KernelMemMap<'a, F, Mem>where
<Mem as ComputeMemory<F>>::FSlice<'a>: Freeze,
<Mem as ComputeMemory<F>>::FSliceMut<'a>: Freeze,
impl<'a, F, Mem> RefUnwindSafe for KernelMemMap<'a, F, Mem>where
<Mem as ComputeMemory<F>>::FSlice<'a>: RefUnwindSafe,
<Mem as ComputeMemory<F>>::FSliceMut<'a>: RefUnwindSafe,
impl<'a, F, Mem> Send for KernelMemMap<'a, F, Mem>
impl<'a, F, Mem> Sync for KernelMemMap<'a, F, Mem>
impl<'a, F, Mem> Unpin for KernelMemMap<'a, F, Mem>where
<Mem as ComputeMemory<F>>::FSlice<'a>: Unpin,
<Mem as ComputeMemory<F>>::FSliceMut<'a>: Unpin,
impl<'a, F, Mem> UnwindSafe for KernelMemMap<'a, F, Mem>where
<Mem as ComputeMemory<F>>::FSlice<'a>: UnwindSafe,
<Mem as ComputeMemory<F>>::FSliceMut<'a>: 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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more