Skip to main content

LaunchBuilder

Struct LaunchBuilder 

Source
pub struct LaunchBuilder<'f> { /* private fields */ }
Expand description

Builder produced by Function::launch. Call LaunchBuilder::launch to actually enqueue the kernel.

Implementations§

Source§

impl<'f> LaunchBuilder<'f>

Source

pub fn grid(self, grid: impl Into<Dim3>) -> Self

Set the grid (number of blocks per axis).

Source

pub fn block(self, block: impl Into<Dim3>) -> Self

Set the block (number of threads per block per axis).

Source

pub fn shared_mem_bytes(self, bytes: u32) -> Self

Set the amount of dynamic shared memory (bytes). Defaults to 0.

Source

pub fn stream(self, stream: &'f Stream) -> Self

Launch on the specified Stream. Defaults to the legacy null stream.

Source

pub fn arg<K: KernelArg>(self, arg: K) -> Self

Append one kernel argument. Pass &value for each kernel parameter: the referent must remain alive until launch is called. CUDA copies argument bytes at submission time, so the values don’t need to outlive the device execution — only the submission.

Source

pub unsafe fn launch(self) -> Result<()>

Actually enqueue the kernel.

§Safety

The caller must ensure that:

  1. The number, order, and types of arguments match what the kernel expects. Baracuda cannot see the kernel’s signature, so a mismatch here causes undefined behavior (typically corrupted output, a device fault, or silent memory corruption).
  2. Any pointer-typed argument (e.g. DeviceBuffer::as_raw()) is live for the duration of kernel execution — use streams + events to manage this.
  3. Grid and block dimensions are within the device’s supported limits (see crate::Device::attribute).
Source

pub unsafe fn launch_ex( self, attributes: &mut [CUlaunchAttribute], ) -> Result<()>

Enqueue the kernel via cuLaunchKernelEx (CUDA 12.0+), letting the caller attach launch attributes (cluster dims, programmatic stream serialization, priority, …). Pass an empty slice when you just want the modern launch entry point with no attributes.

§Safety

Same responsibilities as launch. Attribute payloads in attributes must be populated correctly per baracuda_cuda_sys::types::CUlaunchAttributeID — invalid attribute payloads cause undefined behavior on the device.

Trait Implementations§

Source§

impl Debug for LaunchBuilder<'_>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'f> Freeze for LaunchBuilder<'f>

§

impl<'f> RefUnwindSafe for LaunchBuilder<'f>

§

impl<'f> !Send for LaunchBuilder<'f>

§

impl<'f> !Sync for LaunchBuilder<'f>

§

impl<'f> Unpin for LaunchBuilder<'f>

§

impl<'f> UnsafeUnpin for LaunchBuilder<'f>

§

impl<'f> UnwindSafe for LaunchBuilder<'f>

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.