Skip to main content

Walked

Struct Walked 

Source
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§

Source§

impl<'a> Walked<'a>

Source

pub fn new(mapping: Cow<'a, Mapping>) -> Walked<'a>

mapping, to read a block at a time.

Source

pub fn cycle(&self) -> Option<usize>

The length of the cycle whose items the mapping’s positions read again in order (Period::Cycles), where it has one.

Methods from Deref<Target = Mapping>§

Source

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.

Source

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.

Source

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.

Source

pub fn through(&self, outer: &[Steps], shape: &[usize]) -> Option<Mapping>

Composes positional reads through the logical axes of shape.

Source

pub fn split(&self, shape: &[usize]) -> Mapping

One entry per logical axis where the offsets separate by axis.

Source

pub fn to_walk(&self, shape: &[usize]) -> (usize, Cow<'_, [Steps]>)

Source

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

Source

pub fn tables(&self, shape: &[usize]) -> Vec<Steps>

Positional steps with the base as a leading singleton step.

Source

pub fn footprint(&self) -> usize

The bytes that this mapping’s entries take: each entry, and a table’s listed offsets.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn index(&self, i: usize) -> usize

The offset for position i. Panics where the mapping gives a fill.

Source

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.

Source

pub fn get(&self, i: usize) -> Option<usize>

The offset for position i, or None where it reads a fill.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn fills(&self) -> bool

Whether some position reads a fill, as a padded read’s does.

Source

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§

Source§

impl<'a> Clone for Walked<'a>

Source§

fn clone(&self) -> Walked<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for Walked<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Deref for Walked<'_>

Source§

type Target = Mapping

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Mapping

Dereferences the value.
Source§

impl<'a> From<&'a Mapping> for Walked<'a>

Source§

fn from(mapping: &'a Mapping) -> Walked<'a>

Converts to this type from the input type.
Source§

impl From<Mapping> for Walked<'static>

Source§

fn from(mapping: Mapping) -> Walked<'static>

Converts to this type from the input type.
Source§

impl PartialEq for Walked<'_>

Source§

fn eq(&self, other: &Walked<'_>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

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> 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.