pub struct DataDrivenDispatch { /* private fields */ }Expand description
Computes and stores dispatch parameters that depend on the number of data elements only known at dispatch-preparation time (e.g., after a GPU readback or a CPU-side counter).
In a real GPU pipeline this feeds an indirect dispatch buffer; here we
compute the DispatchGrid on the CPU side for portability and testing.
Implementations§
Source§impl DataDrivenDispatch
impl DataDrivenDispatch
Sourcepub fn new(wg_x: u32, wg_y: u32, strategy: DataDispatchStrategy) -> Self
pub fn new(wg_x: u32, wg_y: u32, strategy: DataDispatchStrategy) -> Self
Create a new data-driven dispatch helper.
wg_x/wg_y— workgroup size dimensions (must be ≥ 1).strategy— how to map element counts to workgroup grids.
Sourcepub fn linear(wg_size: u32) -> Self
pub fn linear(wg_size: u32) -> Self
Convenience constructor for a 1D strip with wg_size threads per
workgroup.
Sourcepub fn square(wg_x: u32, wg_y: u32) -> Self
pub fn square(wg_x: u32, wg_y: u32) -> Self
Convenience constructor for a 2D square grid with wg_x × wg_y
threads per workgroup.
Sourcepub fn prepare(&mut self, element_count: u64) -> DispatchGrid
pub fn prepare(&mut self, element_count: u64) -> DispatchGrid
Prepare the dispatch grid for element_count data elements.
Returns the resulting DispatchGrid; the value is also stored
internally and accessible via Self::grid.
Sourcepub fn grid(&self) -> Option<DispatchGrid>
pub fn grid(&self) -> Option<DispatchGrid>
The grid computed by the last Self::prepare call, or None if
Self::prepare has not yet been called.
Sourcepub fn last_element_count(&self) -> u64
pub fn last_element_count(&self) -> u64
The element count supplied to the last Self::prepare call.
Sourcepub fn covered_elements(&self) -> u64
pub fn covered_elements(&self) -> u64
Minimum elements coverable by the last computed grid.
Returns 0 if Self::prepare has not been called.
Auto Trait Implementations§
impl Freeze for DataDrivenDispatch
impl RefUnwindSafe for DataDrivenDispatch
impl Send for DataDrivenDispatch
impl Sync for DataDrivenDispatch
impl Unpin for DataDrivenDispatch
impl UnsafeUnpin for DataDrivenDispatch
impl UnwindSafe for DataDrivenDispatch
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
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