Skip to main content

SafeKernelArg

Trait SafeKernelArg 

Source
pub unsafe trait SafeKernelArg {
    type Output;

    // Required method
    fn into_kernel_arg(self, launch_config: &LaunchConfig) -> Self::Output;
}
Expand description

Marker trait for types that are safe to pass to GPU kernels.

The Output type that is passed to the GPU can be the same as the type the trait is implemented for or it can be different. This is useful to e.g. allow an allocated Vec<T> to be passed as a &[T] but not allow passing a slice directly as it might not point to memory that is readable by the GPU.

§Safety

An implementor guarantees that a GPU kernel receiving the output can freely use it in safe code.

Required Associated Types§

Source

type Output

The type that is passed to the GPU.

Required Methods§

Source

fn into_kernel_arg(self, launch_config: &LaunchConfig) -> Self::Output

Convert into the actual GPU argument.

May panic if necessary constraints are violated.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl SafeKernelArg for bool

Available on neither AMD GPU nor NVidia GPU.
Source§

impl SafeKernelArg for f32

Available on neither AMD GPU nor NVidia GPU.
Source§

impl SafeKernelArg for f64

Available on neither AMD GPU nor NVidia GPU.
Source§

impl SafeKernelArg for i8

Available on neither AMD GPU nor NVidia GPU.
Source§

impl SafeKernelArg for i16

Available on neither AMD GPU nor NVidia GPU.
Source§

impl SafeKernelArg for i32

Available on neither AMD GPU nor NVidia GPU.
Source§

impl SafeKernelArg for i64

Available on neither AMD GPU nor NVidia GPU.
Source§

impl SafeKernelArg for u8

Available on neither AMD GPU nor NVidia GPU.
Source§

impl SafeKernelArg for u16

Available on neither AMD GPU nor NVidia GPU.
Source§

impl SafeKernelArg for u32

Available on neither AMD GPU nor NVidia GPU.
Source§

impl SafeKernelArg for u64

Available on neither AMD GPU nor NVidia GPU.
Source§

impl<'a, T: SafeKernelArg<Output = T>> SafeKernelArg for &'a Arc<T>

Available on crate feature amd-allocator and neither AMD GPU nor NVidia GPU only.
Source§

impl<'a, T: SafeKernelArg<Output = T>> SafeKernelArg for &'a Box<T>

Available on crate feature amd-allocator and neither AMD GPU nor NVidia GPU only.
Source§

impl<'a, T: SafeKernelArg<Output = T>> SafeKernelArg for &'a Box<[T]>

Available on crate feature amd-allocator and neither AMD GPU nor NVidia GPU only.
Source§

impl<'a, T: SafeKernelArg<Output = T>> SafeKernelArg for &'a Vec<T>

Available on crate feature amd-allocator and neither AMD GPU nor NVidia GPU only.
Source§

impl<'a, T: SafeKernelArg<Output = T>> SafeKernelArg for &'a mut Box<[T]>

Available on neither AMD GPU nor NVidia GPU.
Source§

impl<'a, T: SafeKernelArg<Output = T>> SafeKernelArg for &'a mut Vec<T>

Available on neither AMD GPU nor NVidia GPU.
Source§

impl<'a> SafeKernelArg for &'a String

Available on crate feature amd-allocator and neither AMD GPU nor NVidia GPU only.
Source§

impl<T> SafeKernelArg for *const T

Available on neither AMD GPU nor NVidia GPU.
Source§

impl<T> SafeKernelArg for *mut T

Available on neither AMD GPU nor NVidia GPU.

Implementors§

Source§

impl<'a, T: SafeKernelArg<Output = T>> SafeKernelArg for &'a GpuBox<T>

Available on neither AMD GPU nor NVidia GPU.
Source§

impl<'a, T: SafeKernelArg<Output = T>> SafeKernelArg for &'a GpuBox<[T]>

Available on neither AMD GPU nor NVidia GPU.
Source§

type Output = &'a [T]

Source§

impl<'a, T: SafeKernelArg<Output = T>> SafeKernelArg for &'a mut GpuBox<[T]>

Available on neither AMD GPU nor NVidia GPU.