pub struct WorkgroupTuner {
pub raster_2d: (u32, u32),
pub reduction: u32,
pub fft: u32,
}Expand description
Optimal workgroup sizes derived from GPU adapter limits.
Workgroup sizes are clamped to the adapter’s reported maximums, so kernels compile and dispatch correctly on every device.
§Derivation
Call WorkgroupTuner::derive_from_limits after obtaining the adapter
to get device-specific sizes. Use WorkgroupTuner::unlimited (or
Default) when no real device is available (e.g. in unit tests).
Fields§
§raster_2d: (u32, u32)2D workgroup size for raster/image kernels (e.g. 16×16 or 8×8).
reduction: u321D workgroup size for reduction kernels (e.g. 256 or 64).
fft: u321D workgroup size for FFT kernels (e.g. 64 or 32).
Implementations§
Source§impl WorkgroupTuner
impl WorkgroupTuner
Sourcepub fn derive_from_limits(limits: &Limits) -> Self
pub fn derive_from_limits(limits: &Limits) -> Self
Derive optimal workgroup sizes from the adapter’s Limits.
The function tries preferred sizes in descending order of quality and falls back to smaller values when the adapter cannot accommodate the larger ones.
| Class | Preferred | Fallback 1 | Fallback 2 |
|---|---|---|---|
raster_2d | 16 × 16 | 8 × 8 | 4 × 4 |
reduction | 256 | — | — |
fft | 64 | — | — |
reduction and fft are clamped to min(preferred, max_x, max_total).
Sourcepub fn unlimited() -> Self
pub fn unlimited() -> Self
Default tuner assuming unbounded adapter limits (production default).
Equivalent to calling derive_from_limits with Limits::default(),
which reports max_compute_workgroup_size_x = 256,
max_compute_workgroup_size_y = 256, and
max_compute_invocations_per_workgroup = 256.
Trait Implementations§
Source§impl Clone for WorkgroupTuner
impl Clone for WorkgroupTuner
Source§fn clone(&self) -> WorkgroupTuner
fn clone(&self) -> WorkgroupTuner
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for WorkgroupTuner
Source§impl Debug for WorkgroupTuner
impl Debug for WorkgroupTuner
Source§impl Default for WorkgroupTuner
impl Default for WorkgroupTuner
impl Eq for WorkgroupTuner
Source§impl PartialEq for WorkgroupTuner
impl PartialEq for WorkgroupTuner
Source§fn eq(&self, other: &WorkgroupTuner) -> bool
fn eq(&self, other: &WorkgroupTuner) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for WorkgroupTuner
Auto Trait Implementations§
impl Freeze for WorkgroupTuner
impl RefUnwindSafe for WorkgroupTuner
impl Send for WorkgroupTuner
impl Sync for WorkgroupTuner
impl Unpin for WorkgroupTuner
impl UnsafeUnpin for WorkgroupTuner
impl UnwindSafe for WorkgroupTuner
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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.