Skip to main content

LaunchConfig

Struct LaunchConfig 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional 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

Source

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.

Source

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].

Source

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

Source§

fn clone(&self) -> LaunchConfig

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 Default for LaunchConfig

Source§

fn default() -> LaunchConfig

Returns the “default value” for a type. Read more
Source§

impl Eq for LaunchConfig

Source§

impl Hash for LaunchConfig

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 PartialEq for LaunchConfig

Source§

fn eq(&self, other: &LaunchConfig) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for LaunchConfig

Auto Trait Implementations§

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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