Skip to main content

Space

Struct Space 

Source
pub struct Space { /* private fields */ }
Expand description

Every axis with its extent, in canonical order, plus the runtime sizes of dynamic axes.

Implementations§

Source§

impl Space

Source

pub fn shape(&self) -> &Shape

Source

pub fn rank(&self) -> usize

Source

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

Source

pub fn position(&self, axis: Axis) -> usize

Source

pub fn contains(&self, axis: Axis) -> bool

Source

pub fn axes(&self) -> impl Iterator<Item = Axis> + '_

Source

pub fn extent(&self, axis: Axis) -> usize

The axis’s comptime size; panics on a Dynamic axis.

Source

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

Source

pub fn is_dynamic(&self, axis: Axis) -> bool

Source

pub fn subspace(&self, axes: &[Axis]) -> Space

The listed axes with their extents, in the order listed.

Source§

impl Space

Source

pub fn count(&self, p: usize, edge: usize) -> usize

Axis p’s tile count for a sub-tile edge; comptime for a Static axis.

Source

pub fn __expand_count( scope: &Scope, this: &<Self as CubeType>::ExpandType, p: usize, edge: usize, ) -> <usize as CubeType>::ExpandType

Axis p’s tile count for a sub-tile edge; comptime for a Static axis.

Source§

impl Space

Source

pub const MAX_RANK: usize = 6

The most axes a space holds inline.

Source

pub fn new(extents: &[(Axis, usize)]) -> Self

Source

pub fn dynamic(axes: &[Axis]) -> Self

Every axis dynamic, extents resolved in-kernel from the tensors.

Source

pub fn with_dynamic(self, axes: &[Axis]) -> Self

Flip the listed axes to Dynamic.

Source

pub fn all_dynamic(self) -> Self

Every axis dynamic (see with_dynamic).

Source

pub fn extents(&self) -> Vec<(Axis, usize)>

The static extents, in axis order.

Source

pub fn merge(parts: &[&Space]) -> Space

The smallest space containing every part, axes in first-appearance order, shared axes broadcast-merged. E.g. {M,K} ∪ {K,N} ∪ {M,N} = {M,N,K}.

Source

pub fn covering(parts: &[&Space]) -> Space

The smallest space every one of parts tiles evenly: on each axis the least common multiple of the parts’ extents, axes in first-appearance order. The box a step covers so that each operand’s load fills it whole: NVFP4 values loaded {k 16, n 2}, their scales {k 16, n 16} and an f16 activation {k 8} cover {k 16, n 16}.

§Panics

On a dynamic extent, which has no multiple.

Source

pub fn tiles(&self, tile: &Space) -> usize

How many tiles this space holds, laid side by side along every axis tile names; an axis it does not name it spans whole, one tile serving every position along it. An f16 activation loaded {k 8} fills a step {k 16, n 16} in two loads.

§Panics

Where tile names an axis this space lacks, or does not divide its extent there.

Source

pub fn difference(&self, output: &Space) -> SmallVec<[Axis; 6]>

The axes in this space but not in output: those contracted.

Source

pub fn contracted(operands: &[&Space], output: &Space) -> SmallVec<[Axis; 6]>

The axes operands jointly contract against output.

Source

pub fn cells(&self) -> usize

How many cells the space holds.

Source

pub fn slices_along(&self, axis: Axis) -> usize

How many slices along axis the space holds: one for every index of its other axes. The extent of axis itself may be one a walk has yet to cut, which only the launch knows.

Trait Implementations§

Source§

impl Clone for Space

Source§

fn clone(&self) -> Self

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 CubeType for Space

Source§

type ExpandType = SpaceExpand

Source§

impl Debug for Space

Source§

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

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

impl Eq for Space

Source§

impl Hash for Space

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl LaunchArg for Space

Source§

type RuntimeArg = SpaceLaunch

The runtime argument for the kernel.
Source§

type CompilationArg = SpaceCompilationArg

Compilation argument.
Source§

fn register( arg: Self::RuntimeArg, launcher: &mut KernelLauncher, ) -> Self::CompilationArg

Source§

fn expand( arg: &Self::CompilationArg, builder: &mut KernelBuilder, ) -> <Self as CubeType>::ExpandType

Register a variable during compilation that fill the KernelBuilder.
Source§

impl PartialEq for Space

Source§

fn eq(&self, other: &Self) -> 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 Freeze for Space

§

impl RefUnwindSafe for Space

§

impl Send for Space

§

impl Sync for Space

§

impl Unpin for Space

§

impl UnsafeUnpin for Space

§

impl UnwindSafe for Space

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> CloneExpand for T
where T: Clone,

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> CompilationArg for T
where T: Clone + PartialEq + Eq + Hash + Debug + Send + Sync + 'static,

Source§

fn dynamic_cast<Arg>(&self) -> Arg
where Arg: CompilationArg,

Compilation args should be the same even with different element types. However, it isn’t possible to enforce it with the type system. So, we make the compilation args serializable and dynamically cast them. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts 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>

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

Converts &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)

Converts &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
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<K, Q> Equivalent<Q> for K
where K: Borrow<Q> + ?Sized, Q: Eq + ?Sized,

Source§

fn equivalent(&self, key: &Q) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoComptime for T

Source§

fn comptime(self) -> Self

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

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> TuneInputs for T
where T: Clone + Send + Sync + 'static,

Source§

type At<'a> = T

The concrete input type at lifetime 'a.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ViewLayoutLaunchArg for T
where T: LaunchArg + Send + Sync,

Source§

type RuntimeArg = <T as LaunchArg>::RuntimeArg

The runtime argument for the kernel.
Source§

type CompilationArg = <T as LaunchArg>::CompilationArg

Compilation argument.
Source§

fn register<B>( arg: <T as ViewLayoutLaunchArg>::RuntimeArg, _buffer: &B, _ty: Type, launcher: &mut KernelLauncher, ) -> <T as ViewLayoutLaunchArg>::CompilationArg
where B: MemoryArg,

Source§

fn expand( arg: &<T as ViewLayoutLaunchArg>::CompilationArg, _ty: Type, builder: &mut KernelBuilder, ) -> <T as CubeType>::ExpandType

Register an input variable during compilation that fill the KernelBuilder.
Source§

fn expand_output( arg: &Self::CompilationArg, ty: Type, builder: &mut KernelBuilder, ) -> Self::ExpandType

Register an output variable during compilation that fill the KernelBuilder.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more