pub struct ElemAlignment(/* private fields */);Expand description
The alignment of a buffer’s layout, counted in elements along its innermost dim: the number every line width that reads the buffer’s elements and no others divides.
Not a byte or address alignment: the tile launcher refuses a width that does not divide the
innermost extent or any coarser stride, and every width past one where the innermost stride is
not one. Those are all “divides”, so the layout is aligned to their greatest common divisor, and
that is the whole of what this holds, read once off the geometry so a derivation can ask it
without the tensor. It is one of three things a bound width answers to: the device’s ceiling,
this, and a kernel’s own requirements (Vectorization).
A view’s start is the one address it reads: a view starting partway into its buffer is aligned
to its offset in elements (at_start), the buffer’s own start being the
runtime’s to align.
Implementations§
Source§impl ElemAlignment
impl ElemAlignment
Sourcepub const ONE: Self
pub const ONE: Self
A layout aligned to one element, read one element at a time: a strided or broadcast view, whose innermost dim strides past one.
Sourcepub fn in_stride_order(shape: &[usize], strides: &[usize]) -> Self
pub fn in_stride_order(shape: &[usize], strides: &[usize]) -> Self
The alignment of a buffer of shape at strides, its dims taken in the order the buffer
steps them, whatever order the view names them in.
Sourcepub fn dense_rows(columns: usize) -> Self
pub fn dense_rows(columns: usize) -> Self
The alignment of rows of columns elements laid one after another: a buffer a launch
allocates or copies dense. Its rows count for nothing, as only the step between them does.
Sourcepub fn new(shape: &[usize], strides: &[usize]) -> Self
pub fn new(shape: &[usize], strides: &[usize]) -> Self
The alignment of a buffer of shape at strides, innermost last.
A dim of one element steps nowhere, so its stride reads no address and aligns nothing:
a view [1, k] swapped out of a column [k, 1] keeps the column’s stride of one on its
single row, and is as aligned as the dense row it is.
Sourcepub fn at_start(start_bytes: u64, element_bytes: usize) -> Self
pub fn at_start(start_bytes: u64, element_bytes: usize) -> Self
The alignment a view starting start_bytes into its buffer gives lines of element_bytes
elements: the start’s offset in elements, which every line’s first element sits a whole
number of lines past, so a width dividing it keeps each line on its own boundary. A start
at no whole element is aligned to one; a view at its buffer’s start, to any width.
Sourcepub const fn stored_piece(read: usize) -> Self
pub const fn stored_piece(read: usize) -> Self
The alignment of a buffer stored in pieces read elements wide, which a reader takes whole:
a storage-tiled one’s.
Sourcepub fn is_stored_piece(self) -> bool
pub fn is_stored_piece(self) -> bool
Whether the buffer is read in the pieces it is stored in, a storage-tiled one’s, rather than along rows.
Trait Implementations§
Source§impl Clone for ElemAlignment
impl Clone for ElemAlignment
impl Copy for ElemAlignment
Source§impl Debug for ElemAlignment
impl Debug for ElemAlignment
impl Eq for ElemAlignment
Source§impl From<&TensorBinding> for ElemAlignment
impl From<&TensorBinding> for ElemAlignment
Source§fn from(binding: &TensorBinding) -> Self
fn from(binding: &TensorBinding) -> Self
The alignment of a bound matrix operand: its geometry’s, or, for a storage-tiled one, the piece its storage partitioning states as the finest along its columns, and a piece one element wide where none does: no partitioning describes it, or its tiles step down a column first, which the matmul kernels refuse before reading this.
Source§impl Hash for ElemAlignment
impl Hash for ElemAlignment
Source§impl PartialEq for ElemAlignment
impl PartialEq for ElemAlignment
impl StructuralPartialEq for ElemAlignment
Auto Trait Implementations§
impl Freeze for ElemAlignment
impl RefUnwindSafe for ElemAlignment
impl Send for ElemAlignment
impl Sync for ElemAlignment
impl Unpin for ElemAlignment
impl UnsafeUnpin for ElemAlignment
impl UnwindSafe for ElemAlignment
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> CloneExpand for Twhere
T: Clone,
impl<T> CloneExpand for Twhere
T: Clone,
fn __expand_clone_method(&self, _: &Scope) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> CompilationArg for T
impl<T> CompilationArg for T
Source§fn dynamic_cast<Arg>(&self) -> Argwhere
Arg: CompilationArg,
fn dynamic_cast<Arg>(&self) -> Argwhere
Arg: CompilationArg,
impl<T> CubeComptime for T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<K, Q> Equivalent<Q> for K
impl<K, Q> Equivalent<Q> for K
Source§fn equivalent(&self, key: &Q) -> bool
fn equivalent(&self, key: &Q) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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> ⓘ
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