pub struct LaunchGeometry {
pub cube_dim: CubeDim,
pub cube_count: CubeCount,
}Expand description
Kernel launch geometry for the access patterns used by the DSP kernels.
Cube sizes come from the runtime (CubeDim::new: its plane size along x, a plane count set
by the runtime’s cores or limits along y), never from constants, and cube counts from the
problem size within the runtime’s grid limits. CubeCL maps cubes and units to whatever executes
the kernel (CPU threads, GPU workgroups).
Fields§
§cube_dim: CubeDim§cube_count: CubeCountImplementations§
Source§impl LaunchGeometry
impl LaunchGeometry
Sourcepub fn elementwise(client: &Client, num_elements: usize) -> Self
pub fn elementwise(client: &Client, num_elements: usize) -> Self
One unit per element, indexed with element_position (contiguous runs per thread on
the CPU runtime, ABSOLUTE_POS elsewhere). The cubes are spread over the runtime’s
cube-count dimensions, so kernels must bound-check the position.
Sourcepub fn channels_samples(
client: &Client,
channels: usize,
samples: usize,
) -> Self
pub fn channels_samples( client: &Client, channels: usize, samples: usize, ) -> Self
One unit per (channel, sample) of a [channels, samples] buffer: sample_position
and channel_position. The cube’s x size is the runtime’s plane, so a plane walks
neighbouring samples of one channel.
§Panics
If the channels or samples need more cubes than the runtime’s whole grid holds.
Sourcepub fn per_sample(client: &Client, samples: usize) -> Self
pub fn per_sample(client: &Client, samples: usize) -> Self
One unit per sample for kernels that walk all channels of a sample (sample_position).
Sourcepub fn per_channel(client: &Client, channels: usize) -> Self
pub fn per_channel(client: &Client, channels: usize) -> Self
One unit per channel for kernels that walk each channel sequentially in time:
ABSOLUTE_POS_X = channel, bound-checked by the kernel.
Sourcepub fn per_row(client: &Client, rows: usize, cols: usize) -> Self
pub fn per_row(client: &Client, rows: usize, cols: usize) -> Self
One cube per row of a [rows, cols] buffer, for cube-wide reductions: row_position is the
row (cubes along x, continuing along y past the grid’s x limit) and UNIT_POS_X strides along
it. The cube is the runtime’s cube for cols units flattened onto x and rounded down to a
power of two, so tree reductions can halve it; kernels size shared memory with
cube_dim.x (passed as a comptime value). Kernels bound-check the row.
§Panics
If the rows need more cubes than the runtime’s whole grid holds.
Sourcepub fn tiles(
client: &Client,
points: usize,
shared_bytes_per_unit: usize,
) -> Self
pub fn tiles( client: &Client, points: usize, shared_bytes_per_unit: usize, ) -> Self
One unit per point of points, in 1-D cubes of a power-of-two number of units (the
runtime’s cube flattened onto x, shrunk until shared_bytes_per_unit per unit fits the
device’s shared memory) for kernels that share tiles of points in shared memory: the point
is row_position() * CUBE_DIM_X + UNIT_POS_X, and kernels size shared memory with
cube_dim.x (passed as a comptime value). Every unit of a cube takes part in the tile loads,
so kernels bound-check the point only around their own work.
§Panics
If one unit’s shared memory exceeds the device’s, or the points need more cubes than the runtime’s whole grid holds.
Sourcepub fn plane_lanes(client: &Client) -> u32
pub fn plane_lanes(client: &Client) -> u32
Units that execute in lock-step (the runtime’s plane / warp / subgroup size; 1 where every
unit runs on its own, as on the CPU runtime). It is the x size of
Self::channels_samples cubes, so consecutive sample_positions of a plane share a cube.
Trait Implementations§
Source§impl Clone for LaunchGeometry
impl Clone for LaunchGeometry
Auto Trait Implementations§
impl Forget for LaunchGeometry
impl Freeze for LaunchGeometry
impl Move for LaunchGeometry
impl RefUnwindSafe for LaunchGeometry
impl Send for LaunchGeometry
impl Sync for LaunchGeometry
impl Unpin for LaunchGeometry
impl UnsafeUnpin for LaunchGeometry
impl UnwindSafe for LaunchGeometry
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> 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
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