pub struct Walked<'a> { /* private fields */ }Expand description
A mapping prepared for reading a block at a time. It finds the walk that a copy follows (Steps::simplify) and the cycle that the positions read again (Period::Cycles) on the first read that needs each, and keeps both. A reader makes one before its loop over blocks and shares it with every thread of the loop. It derefs to its mapping.
Implementations§
Methods from Deref<Target = Mapping>§
Sourcepub fn tabled(&self) -> bool
pub fn tabled(&self) -> bool
Whether an axis of this mapping reads through a table of positions, as a selection by data does, rather than by strides.
Sourcepub fn as_writes(&self) -> Option<Writes<'_>>
pub fn as_writes(&self) -> Option<Writes<'_>>
The writes at the places that a Mapping::Steps reads, in order, as From<Writes> makes one. None for any other mapping.
Sourcepub fn entries(&self, shape: &[usize]) -> Option<(usize, Vec<Steps>)>
pub fn entries(&self, shape: &[usize]) -> Option<(usize, Vec<Steps>)>
This mapping as one entry per axis of shape, or None where offsets aren’t axis-separable.
Sourcepub fn through(&self, outer: &[Steps], shape: &[usize]) -> Option<Mapping>
pub fn through(&self, outer: &[Steps], shape: &[usize]) -> Option<Mapping>
Composes positional reads through the logical axes of shape.
Sourcepub fn split(&self, shape: &[usize]) -> Mapping
pub fn split(&self, shape: &[usize]) -> Mapping
One entry per logical axis where the offsets separate by axis.
pub fn to_walk(&self, shape: &[usize]) -> (usize, Cow<'_, [Steps]>)
Sourcepub fn in_order(&self, len: usize, shape: &[usize]) -> bool
pub fn in_order(&self, len: usize, shape: &[usize]) -> bool
Whether a read through this mapping over a result of shape takes each of a source’s len items once, in order, from the first: a copy through it is the source unchanged, so a view of the source serves. Linear(1) answers at once, and any other mapping by its walk (Mapping::to_walk, Mapping::walk_in_order).
Sourcepub fn tables(&self, shape: &[usize]) -> Vec<Steps>
pub fn tables(&self, shape: &[usize]) -> Vec<Steps>
Positional steps with the base as a leading singleton step.
Sourcepub fn footprint(&self) -> usize
pub fn footprint(&self) -> usize
The bytes that this mapping’s entries take: each entry, and a table’s listed offsets.
Sourcepub fn compose(
&self,
outer: &Mapping,
shape: &[usize],
frame: &[usize],
) -> Option<Mapping>
pub fn compose( &self, outer: &Mapping, shape: &[usize], frame: &[usize], ) -> Option<Mapping>
Composes a map from frame to shape with this map from shape to storage.
Sourcepub fn composed(
&self,
outer: &Mapping,
shape: &[usize],
frame: &[usize],
table: bool,
) -> Option<Mapping>
pub fn composed( &self, outer: &Mapping, shape: &[usize], frame: &[usize], table: bool, ) -> Option<Mapping>
Composes maps, listing offsets when structural composition fails and table is true. The listing walks each map once and looks every position of outer’s walk up in self‘s, where shape holds no more items than the result: a get divides on every axis for each item, about 400 instructions an item in negative windows’ composition with their padding.
Sourcepub fn affine(&self, shape: &[usize]) -> Option<(usize, Vec<isize>)>
pub fn affine(&self, shape: &[usize]) -> Option<(usize, Vec<isize>)>
First item offset and signed item strides, where the mapping is affine over shape: each axis reads one regular run with no fill, as Steps::affine decides.
Sourcepub fn block(&self, shape: &[usize]) -> Option<Block>
pub fn block(&self, shape: &[usize]) -> Option<Block>
The contiguous block of storage that the mapping reads over shape, each item once, where the block’s axes come in another order or run backwards: as a transpose, a reversal or windows that don’t overlap read their source. None where the mapping skips, repeats or fills an item.
Sourcepub fn index(&self, i: usize) -> usize
pub fn index(&self, i: usize) -> usize
The offset for position i. Panics where the mapping gives a fill.
Sourcepub fn run(&self, start: usize, n: usize) -> Option<(usize, isize)>
pub fn run(&self, start: usize, n: usize) -> Option<(usize, isize)>
The first offset and stride of items start..start + n, where a Steps mapping reads one regular run.
Sourcepub fn get(&self, i: usize) -> Option<usize>
pub fn get(&self, i: usize) -> Option<usize>
The offset for position i, or None where it reads a fill.
Sourcepub fn line_block(&self, size: usize) -> usize
pub fn line_block(&self, size: usize) -> usize
The fewest items in a block of a read through this mapping, where its innermost axis skips items, as a transpose’s does: as many whole rows as a cache line holds items of size bytes, up to LINE_BLOCK items. The rows of such a block then share each fetch of a line. 0 where the innermost axis reads adjacent items or one item.
Sourcepub fn period(&self) -> Option<Period<'_>>
pub fn period(&self) -> Option<Period<'_>>
What this mapping’s positions read again, and over how many positions (Period): each item repeated (repeats), Tiled’s cycle, the cycle of a Steps mapping whose outer axes step by 0, as a broadcast along outer axes reads, or the cycle of one entry that wraps its whole source from the first item, as a reshape reads. None for one item, adjacent items, a mapping that fills, and other steps.
Sourcepub fn copies(&self, block: usize) -> bool
pub fn copies(&self, block: usize) -> bool
Whether expanded copies most blocks of block items read through this mapping, rather than reading them where they lie: steps whose runs of adjacent offsets (Steps::contiguous) are shorter than a block, as a transpose’s, a reversal’s, windows’ and a column slice’s are. Repeats and cycles don’t count: a run that stays inside one repeat or cycle reads in place, and the caller decides where runs end.
Sourcepub fn tiles_whole(&self, block: usize) -> bool
pub fn tiles_whole(&self, block: usize) -> bool
Whether a walk of blocks of block items through this mapping reads each item from its own cache line, where a walk of the whole copy reads them through the tiled transpose (Steps::transposing): after simplify, the last two axes form a transpose whose inner axis holds a block or more, so that each block walks one strided run. A copy made whole then costs much less than reads through it a block at a time.
Sourcepub fn regular(&self) -> Option<(usize, isize)>
pub fn regular(&self) -> Option<(usize, isize)>
The innermost stretch of positions that read at one regular stride, as its length and that stride: (r, 0) for Linear(r), each of whose stretches reads one item, and Steps::regular for steps.
Sourcepub fn repeats(&self) -> Option<usize>
pub fn repeats(&self) -> Option<usize>
The number of positions over which this mapping repeats each item: the length of its innermost regular stretch (regular) where that steps by 0, as Linear(r) does and a broadcast along inner axes does. None for one item, adjacent items, cycles and other steps.
Sourcepub fn runs(&self, positions: usize) -> Option<(usize, isize, Vec<usize>)>
pub fn runs(&self, positions: usize) -> Option<(usize, isize, Vec<usize>)>
The runs of this mapping’s innermost regular stretch (regular) over positions positions, where every run reads its items in place: the stretch’s length and stride, and the offset of each run’s first item, in the order of the runs. A Linear(r) mapping’s runs read its items in order. None where the mapping isn’t linear or steps, gives a fill, or reads its stretch through a padded or rotated axis.
Sourcepub fn spans(
&self,
range: Range<usize>,
items: usize,
f: &mut dyn FnMut(usize, usize, Option<(usize, isize)>) -> bool,
)
pub fn spans( &self, range: Range<usize>, items: usize, f: &mut dyn FnMut(usize, usize, Option<(usize, isize)>) -> bool, )
Calls f(at, len, run) for consecutive spans of result positions range, in order, until it gives false: run holds the first position and stride of a span whose positions all lie below items, and is None for a span whose positions all miss. A Steps mapping gives the spans of each row of its innermost axis (row_spans), a repeat a span for each item, and a cycle a span for each pass.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !Freeze for Walked<'a>
impl<'a> !RefUnwindSafe for Walked<'a>
impl<'a> !UnwindSafe for Walked<'a>
impl<'a> Forget for Walked<'a>
impl<'a> Send for Walked<'a>
impl<'a> Sync for Walked<'a>
impl<'a> Unpin for Walked<'a>
impl<'a> UnsafeUnpin for Walked<'a>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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> ⓘ
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