pub struct KernelParameters<'a> { /* private fields */ }Expand description
Dynamically built CUDA kernel argument list.
Use this builder when the argument list depends on runtime conditions:
ⓘ
let mut params = KernelParameters::new();
params.arg(&input_ptr).arg(&output_ptr).push(len);
function.launch(&config, params)?;For fixed argument lists, passing a tuple of references directly to
KernelFunction::launch avoids building a dynamic list:
ⓘ
function.launch(&config, (&input_ptr, &mut output_ptr, &len))?;Borrowed arguments are tied to the lifetime of this list. Owned scalar and
pointer arguments pushed with Self::push or Self::owned_arg are stored
inline when they fit, so ordinary kernel launches do not allocate per
argument.
Implementations§
Source§impl<'a> KernelParameters<'a>
impl<'a> KernelParameters<'a>
pub const fn new() -> Self
pub fn arg<T: 'a>(&mut self, value: &'a T) -> &mut Self
pub fn arg_mut<T: 'a>(&mut self, value: &'a mut T) -> &mut Self
Sourcepub fn owned_arg<T: Copy + 'static>(&mut self, value: T) -> &mut Self
pub fn owned_arg<T: Copy + 'static>(&mut self, value: T) -> &mut Self
Pushes a copied kernel argument whose storage is owned by this list.
Small scalar and pointer values are stored inline. Larger values fall back to heap storage, while keeping the argument pointee stable until CUDA has copied it during launch or graph-node creation.
pub fn push<A: PushKernelArg>(&mut self, arg: A) -> &mut Self
pub fn device_slice<T: DeviceRepr, S: DeviceSlice<T> + ?Sized>( &mut self, slice: &S, ) -> &mut Self
pub fn device_slice_mut<T: DeviceRepr, S: DeviceSliceMut<T> + ?Sized>( &mut self, slice: &mut S, ) -> &mut Self
Trait Implementations§
Source§impl Debug for KernelParameters<'_>
impl Debug for KernelParameters<'_>
Source§impl Default for KernelParameters<'_>
impl Default for KernelParameters<'_>
impl<'a> KernelLaunchArgs<'a> for KernelParameters<'a>
impl<'a> KernelLaunchArgs<'a> for &mut KernelParameters<'a>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for KernelParameters<'a>
impl<'a> !Send for KernelParameters<'a>
impl<'a> !Sync for KernelParameters<'a>
impl<'a> !UnwindSafe for KernelParameters<'a>
impl<'a> Freeze for KernelParameters<'a>
impl<'a> Unpin for KernelParameters<'a>
impl<'a> UnsafeUnpin for KernelParameters<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more