Skip to main content

LaunchConfig

Struct LaunchConfig 

Source
pub struct LaunchConfig { /* private fields */ }
Expand description

Launch geometry and attributes used when submitting or constructing a kernel node.

Implementations§

Source§

impl LaunchConfig

Source

pub fn create( grid_dim: Dim3, block_dim: Dim3, shared_memory_bytes: usize, ) -> Result<Self>

Creates a launch configuration with the supplied grid dimensions, block dimensions, and dynamic shared-memory bytes per block.

No launch attributes are set. Device and kernel limits are checked during preparation or submission.

§Errors

Returns Error::NotPositive if any grid or block axis is zero, or Error::OutOfRange if shared_memory_bytes exceeds u32::MAX.

Source

pub const fn geometry(&self) -> &LaunchGeometry

Returns the geometry used by this launch, without its attributes.

Source

pub const fn grid_dim(&self) -> Dim3

Returns the number of blocks along each grid axis.

Source

pub const fn block_dim(&self) -> Dim3

Returns the number of threads along each block axis.

Source

pub const fn shared_memory_bytes(&self) -> usize

Returns the dynamic shared-memory bytes per block.

Source

pub fn with_shared_memory_bytes(self, bytes: usize) -> Result<Self>

Replaces the dynamic shared-memory byte count per block.

§Errors

Returns Error::OutOfRange if bytes exceeds u32::MAX.

Source

pub fn try_for_1d_grid(element_count: usize, block_size: usize) -> Result<Self>

Creates a one-dimensional launch covering element_count elements with block_size threads per block.

Each grid axis rounds up to a whole block. Dynamic shared memory starts at zero. The configuration starts with no launch attributes. Device and kernel limits are checked during preparation or submission.

§Errors

Returns Error::NotPositive if an element extent or block dimension is zero, or Error::OutOfRange if a computed grid dimension or supplied block dimension exceeds u32::MAX.

Source

pub fn for_1d_grid(element_count: usize, block_size: usize) -> Self

Creates a one-dimensional launch covering element_count elements with block_size threads per block.

Uses the same rounding, shared-memory defaults, and validation as Self::try_for_1d_grid.

§Panics

Panics if an element extent or block dimension is zero, or if a computed grid dimension or supplied block dimension exceeds u32::MAX. Use Self::try_for_1d_grid to handle these errors.

Source

pub fn try_for_num_elems( element_count: usize, block_size: usize, ) -> Result<Self>

Creates a one-dimensional launch covering element_count elements with block_size threads per block. Equivalent to Self::try_for_1d_grid.

Each grid axis rounds up to a whole block. Dynamic shared memory starts at zero. The configuration starts with no launch attributes. Device and kernel limits are checked during preparation or submission.

§Errors

Returns Error::NotPositive if an element extent or block dimension is zero, or Error::OutOfRange if a computed grid dimension or supplied block dimension exceeds u32::MAX.

Source

pub fn for_num_elems(element_count: usize, block_size: usize) -> Self

Creates a one-dimensional launch covering element_count elements with block_size threads per block. Equivalent to Self::try_for_1d_grid.

Uses the same rounding, shared-memory defaults, and validation as Self::try_for_num_elems.

§Panics

Panics if an element extent or block dimension is zero, or if a computed grid dimension or supplied block dimension exceeds u32::MAX. Use Self::try_for_num_elems to handle these errors.

Source

pub fn try_for_2d_grid( width: usize, height: usize, block_width: usize, block_height: usize, ) -> Result<Self>

Creates a two-dimensional launch covering width by height elements with the supplied block width and height.

Each grid axis rounds up to a whole block. Dynamic shared memory starts at zero. The configuration starts with no launch attributes. Device and kernel limits are checked during preparation or submission.

§Errors

Returns Error::NotPositive if an element extent or block dimension is zero, or Error::OutOfRange if a computed grid dimension or supplied block dimension exceeds u32::MAX.

Source

pub fn for_2d_grid( width: usize, height: usize, block_width: usize, block_height: usize, ) -> Self

Creates a two-dimensional launch covering width by height elements with the supplied block width and height.

Uses the same rounding, shared-memory defaults, and validation as Self::try_for_2d_grid.

§Panics

Panics if an element extent or block dimension is zero, or if a computed grid dimension or supplied block dimension exceeds u32::MAX. Use Self::try_for_2d_grid to handle these errors.

Source

pub fn try_for_3d_grid( width: usize, height: usize, depth: usize, block_width: usize, block_height: usize, block_depth: usize, ) -> Result<Self>

Creates a three-dimensional launch covering width by height by depth elements with the supplied block dimensions.

Each grid axis rounds up to a whole block. Dynamic shared memory starts at zero. The configuration starts with no launch attributes. Device and kernel limits are checked during preparation or submission.

§Errors

Returns Error::NotPositive if an element extent or block dimension is zero, or Error::OutOfRange if a computed grid dimension or supplied block dimension exceeds u32::MAX.

Source

pub fn for_3d_grid( width: usize, height: usize, depth: usize, block_width: usize, block_height: usize, block_depth: usize, ) -> Self

Creates a three-dimensional launch covering width by height by depth elements with the supplied block dimensions.

Uses the same rounding, shared-memory defaults, and validation as Self::try_for_3d_grid.

§Panics

Panics if an element extent or block dimension is zero, or if a computed grid dimension or supplied block dimension exceeds u32::MAX. Use Self::try_for_3d_grid to handle these errors.

Source§

impl LaunchConfig

Source

pub fn with_attribute(self, attribute: LaunchAttribute) -> Result<Self>

Configures attributes for an extended kernel launch.

§Errors

Returns Error::NotPositive if a cluster dimension is zero, or Error::OutOfRange if the preferred shared-memory carveout exceeds 100 percent. Device and kernel compatibility are checked later during preparation or submission.

Source

pub fn attributes(&self) -> &[LaunchAttribute]

Returns the configured launch attributes.

Trait Implementations§

Source§

impl Clone for LaunchConfig

Source§

fn clone(&self) -> Self

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<LaunchGeometry> for LaunchConfig

Source§

fn from(geometry: LaunchGeometry) -> Self

Converts to this type from the input type.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.