Skip to main content

KernelArg

Trait KernelArg 

Source
pub unsafe trait KernelArg {
    // Required method
    fn as_kernel_arg_ptr(&self) -> *mut c_void;
}
Expand description

A value that can be marshalled into the void** kernelParams slot of cuLaunchKernel / cudaLaunchKernel.

§Safety

Implementors must uphold:

  1. Self::as_kernel_arg_ptr returns a pointer whose pointee is a valid DeviceRepr value of the correct type for the target kernel slot.
  2. The returned pointer remains valid until the kernel launch has been submitted to the stream (not necessarily completed — the runtime copies argument bytes during submission).
  3. Concurrent kernel launches using the same argument value must tolerate shared access; in practice this means the referent is either Copy or borrowed immutably for the duration of submission.

Required Methods§

Implementations on Foreign Types§

Source§

impl<T: DeviceRepr> KernelArg for &T

Source§

impl<T: DeviceRepr> KernelArg for &mut T

Implementors§