pub enum KernelArg {
}Expand description
A single argument to an NVRTC kernel launch.
The two boxed variants (KernelArg::DevSlice and
KernelArg::Scalar) are the canonical Phase-0.3+ form; every
dtype the runtime understands routes through them via the
DevSliceArg / ScalarArg blanket impls. The remaining
typed-variant aliases are #[deprecated] and exist so pre-Phase-0.3
callers still compile.
Variants§
DevSlice(Box<dyn DevSliceArg>)
Canonical: a typed device slice as Box<dyn DevSliceArg>.
Construct as KernelArg::DevSlice(Box::new(my_gpu_ref)) for any
GpuRef<T: CudaDtype> (which is every supported dtype, including
u8 raw byte buffers).
Scalar(Box<dyn ScalarArg>)
Canonical: a typed scalar as Box<dyn ScalarArg>. Construct as
KernelArg::Scalar(Box::new(2.0_f32)).
Usize(usize)
usize is not a CudaDtype (its size is platform-dependent)
so it has its own variant.
DevSliceF32(GpuRef<f32>)
DevSliceF64(GpuRef<f64>)
DevSliceI32(GpuRef<i32>)
DevSliceU32(GpuRef<u32>)
DevSliceU8(GpuRef<u8>)
ScalarF32(f32)
ScalarF64(f64)
ScalarI32(i32)
ScalarU32(u32)
ScalarU64(u64)
Implementations§
Source§impl KernelArg
impl KernelArg
Sourcepub fn canonicalize(self) -> KernelArg
pub fn canonicalize(self) -> KernelArg
Normalise any pre-Phase-0.3 typed-variant alias to the
canonical KernelArg::DevSlice / KernelArg::Scalar /
KernelArg::Usize form.
Used by the actor to fold the ten deprecated typed variants
into the two boxed-dyn variants before the launch loop. After
canonicalisation the launch loop has exactly three arms
(DevSlice, Scalar, Usize) instead of eleven.