pub enum KernelArg<'a> {
Scalar(Vec<u8>),
DevicePtr(*mut c_void, PhantomData<&'a ()>),
}Expand description
A typed argument for a raw CUDA kernel launch.
Either a value scalar (copied into a stable buffer) or a device pointer
obtained from a validated TensorRef/TensorMut or DeviceBytes.
Constructing an argument is safe; the ABI contract is enforced by the
caller at the unsafe launch site.
Variants§
Scalar(Vec<u8>)
A scalar value encoded as an exact-size byte sequence.
DevicePtr(*mut c_void, PhantomData<&'a ()>)
A device memory address argument (in/out pointer).
Implementations§
Source§impl<'a> KernelArg<'a>
impl<'a> KernelArg<'a>
Sourcepub fn tensor<T>(reference: &TensorRef<'a, T>) -> Self
pub fn tensor<T>(reference: &TensorRef<'a, T>) -> Self
Build a device-pointer parameter from a read-only tensor reference.
The kernel may only read the tensor unless the launch safety contract
states otherwise; for a write target use KernelArg::tensor_mut or
KernelArg::output.
Sourcepub fn tensor_mut<T>(reference: &TensorMut<'a, T>) -> Self
pub fn tensor_mut<T>(reference: &TensorMut<'a, T>) -> Self
Build a device-pointer parameter from a mutable tensor reference.
Sourcepub fn output<T>(reference: &TensorMut<'a, T>) -> Self
pub fn output<T>(reference: &TensorMut<'a, T>) -> Self
Build a device-pointer parameter from a freshly allocated output tensor.
Sourcepub fn workspace(bytes: &DeviceBytes<'a>) -> Self
pub fn workspace(bytes: &DeviceBytes<'a>) -> Self
Build a device-pointer parameter from a workspace allocation.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !Send for KernelArg<'a>
impl<'a> !Sync for KernelArg<'a>
impl<'a> Freeze for KernelArg<'a>
impl<'a> RefUnwindSafe for KernelArg<'a>
impl<'a> Unpin for KernelArg<'a>
impl<'a> UnsafeUnpin for KernelArg<'a>
impl<'a> UnwindSafe for KernelArg<'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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<C> CloneExpand for Cwhere
C: Clone,
impl<C> CloneExpand for Cwhere
C: Clone,
fn __expand_clone_method(&self, _scope: &mut Scope) -> C
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T, U> Imply<T> for U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more