pub struct LaunchConfig { /* private fields */ }Expand description
Launch geometry and attributes used when submitting or constructing a kernel node.
Implementations§
Source§impl LaunchConfig
impl LaunchConfig
Sourcepub fn create(
grid_dim: Dim3,
block_dim: Dim3,
shared_memory_bytes: usize,
) -> Result<Self>
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.
Sourcepub const fn geometry(&self) -> &LaunchGeometry
pub const fn geometry(&self) -> &LaunchGeometry
Returns the geometry used by this launch, without its attributes.
Returns the dynamic shared-memory bytes per block.
Replaces the dynamic shared-memory byte count per block.
§Errors
Returns Error::OutOfRange if bytes exceeds u32::MAX.
Sourcepub fn try_for_1d_grid(element_count: usize, block_size: usize) -> Result<Self>
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.
Sourcepub fn for_1d_grid(element_count: usize, block_size: usize) -> Self
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.
Sourcepub fn try_for_num_elems(
element_count: usize,
block_size: usize,
) -> Result<Self>
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.
Sourcepub fn for_num_elems(element_count: usize, block_size: usize) -> Self
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.
Sourcepub fn try_for_2d_grid(
width: usize,
height: usize,
block_width: usize,
block_height: usize,
) -> Result<Self>
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.
Sourcepub fn for_2d_grid(
width: usize,
height: usize,
block_width: usize,
block_height: usize,
) -> Self
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.
Sourcepub fn try_for_3d_grid(
width: usize,
height: usize,
depth: usize,
block_width: usize,
block_height: usize,
block_depth: usize,
) -> Result<Self>
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.
Sourcepub fn for_3d_grid(
width: usize,
height: usize,
depth: usize,
block_width: usize,
block_height: usize,
block_depth: usize,
) -> Self
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
impl LaunchConfig
Sourcepub fn with_attribute(self, attribute: LaunchAttribute) -> Result<Self>
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.
Sourcepub fn attributes(&self) -> &[LaunchAttribute]
pub fn attributes(&self) -> &[LaunchAttribute]
Returns the configured launch attributes.