Skip to main content

ScalarArg

Trait ScalarArg 

Source
pub trait ScalarArg:
    Send
    + Sync
    + 'static {
    // Required methods
    fn push<'a>(&'a self, builder: &mut LaunchArgs<'a>);
    fn dtype(&self) -> Option<DType>;
}
Expand description

Type-erased typed-host-scalar argument for an NVRTC kernel launch.

Boxed as Box<dyn ScalarArg> inside KernelArg::Scalar. A blanket impl impl<T: CudaDtype> ScalarArg for T covers every dtype the runtime understands. usize and bool are not CudaDtype so callers use the dedicated super::nvrtc::KernelArg::Usize variant for sizes — the most common scalar arg by far.

Required Methods§

Source

fn push<'a>(&'a self, builder: &mut LaunchArgs<'a>)

Push the scalar value onto builder by reference.

The 'a lifetime ties &self to the builder so the borrowed scalar reference lives at least as long as builder.

Source

fn dtype(&self) -> Option<DType>

Dtype for tracing / debugging.

Implementors§

Source§

impl<T> ScalarArg for T
where T: CudaDtype + DeviceRepr + Sync,