#[non_exhaustive]pub struct LaunchConfig {
pub workgroups: Option<[u32; 3]>,
pub threads_per_workgroup: Option<[u32; 3]>,
}Expand description
A GPU kernel never comes alone, it is always groups of them that are launched together.
A number of launched threads together are called a workgroup. And a number of workgroups are launched together. This struct specifies how many workgroups are launched and how many threads are contained in each of them.
The total number of threads launched is number of workgroups times threads per workgroup.
§Example
let launch_config = LaunchConfig::new()
.workgroups([1, 0, 0])
.threads_per_workgroup([1, 0, 0]);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.workgroups: Option<[u32; 3]>The number of workgroups launched on the GPU.
A three-dimensional size for x, y, z dimensions.
For a simple list of threads, this can be [n, 1, 1].
threads_per_workgroup: Option<[u32; 3]>The number of threads in each workgroup.
A three-dimensional size for x, y, z dimensions.
For a simple list of threads, this can be [n, 1, 1].
Implementations§
Source§impl LaunchConfig
impl LaunchConfig
Sourcepub fn new() -> Self
pub fn new() -> Self
Create an empty LaunchConfig.
At least Self::workgroups and Self::threads_per_workgroup need to be filled out, otherwise launching panics.
Sourcepub fn workgroups(&mut self, workgroups: [u32; 3]) -> &mut Self
pub fn workgroups(&mut self, workgroups: [u32; 3]) -> &mut Self
The number of workgroups launched on the GPU.
A three-dimensional size for x, y, z dimensions.
For a simple list of threads, this can be [n, 1, 1].
Sourcepub fn threads_per_workgroup(
&mut self,
threads_per_workgroup: [u32; 3],
) -> &mut Self
pub fn threads_per_workgroup( &mut self, threads_per_workgroup: [u32; 3], ) -> &mut Self
The number of threads in each workgroup.
A three-dimensional size for x, y, z dimensions.
For a simple list of threads, this can be [n, 1, 1].
Trait Implementations§
Source§impl Clone for LaunchConfig
impl Clone for LaunchConfig
Source§fn clone(&self) -> LaunchConfig
fn clone(&self) -> LaunchConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more