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§
Required Methods§
Sourcefn into_kernel_arg(self, launch_config: &LaunchConfig) -> Self::Output
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.
impl SafeKernelArg for bool
Available on neither AMD GPU nor NVidia GPU.
type Output = bool
fn into_kernel_arg(self, _: &LaunchConfig) -> Self::Output
Source§impl SafeKernelArg for f32
Available on neither AMD GPU nor NVidia GPU.
impl SafeKernelArg for f32
Available on neither AMD GPU nor NVidia GPU.
type Output = f32
fn into_kernel_arg(self, _: &LaunchConfig) -> Self::Output
Source§impl SafeKernelArg for f64
Available on neither AMD GPU nor NVidia GPU.
impl SafeKernelArg for f64
Available on neither AMD GPU nor NVidia GPU.
type Output = f64
fn into_kernel_arg(self, _: &LaunchConfig) -> Self::Output
Source§impl SafeKernelArg for i8
Available on neither AMD GPU nor NVidia GPU.
impl SafeKernelArg for i8
Available on neither AMD GPU nor NVidia GPU.
type Output = i8
fn into_kernel_arg(self, _: &LaunchConfig) -> Self::Output
Source§impl SafeKernelArg for i16
Available on neither AMD GPU nor NVidia GPU.
impl SafeKernelArg for i16
Available on neither AMD GPU nor NVidia GPU.
type Output = i16
fn into_kernel_arg(self, _: &LaunchConfig) -> Self::Output
Source§impl SafeKernelArg for i32
Available on neither AMD GPU nor NVidia GPU.
impl SafeKernelArg for i32
Available on neither AMD GPU nor NVidia GPU.
type Output = i32
fn into_kernel_arg(self, _: &LaunchConfig) -> Self::Output
Source§impl SafeKernelArg for i64
Available on neither AMD GPU nor NVidia GPU.
impl SafeKernelArg for i64
Available on neither AMD GPU nor NVidia GPU.
type Output = i64
fn into_kernel_arg(self, _: &LaunchConfig) -> Self::Output
Source§impl SafeKernelArg for u8
Available on neither AMD GPU nor NVidia GPU.
impl SafeKernelArg for u8
Available on neither AMD GPU nor NVidia GPU.
type Output = u8
fn into_kernel_arg(self, _: &LaunchConfig) -> Self::Output
Source§impl SafeKernelArg for u16
Available on neither AMD GPU nor NVidia GPU.
impl SafeKernelArg for u16
Available on neither AMD GPU nor NVidia GPU.
type Output = u16
fn into_kernel_arg(self, _: &LaunchConfig) -> Self::Output
Source§impl SafeKernelArg for u32
Available on neither AMD GPU nor NVidia GPU.
impl SafeKernelArg for u32
Available on neither AMD GPU nor NVidia GPU.
type Output = u32
fn into_kernel_arg(self, _: &LaunchConfig) -> Self::Output
Source§impl SafeKernelArg for u64
Available on neither AMD GPU nor NVidia GPU.
impl SafeKernelArg for u64
Available on neither AMD GPU nor NVidia GPU.
type Output = u64
fn into_kernel_arg(self, _: &LaunchConfig) -> Self::Output
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.
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.type Output = &'a T
fn into_kernel_arg(self, _: &LaunchConfig) -> Self::Output
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.
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.type Output = &'a T
fn into_kernel_arg(self, _: &LaunchConfig) -> Self::Output
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.
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.type Output = &'a [T]
fn into_kernel_arg(self, _: &LaunchConfig) -> Self::Output
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.
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.type Output = &'a [T]
fn into_kernel_arg(self, _: &LaunchConfig) -> Self::Output
Source§impl<'a, T: SafeKernelArg<Output = T>> SafeKernelArg for &'a mut Box<[T]>
Available on neither AMD GPU nor NVidia GPU.
impl<'a, T: SafeKernelArg<Output = T>> SafeKernelArg for &'a mut Box<[T]>
Available on neither AMD GPU nor NVidia GPU.
type Output = ThreadIndexedSlice<'a, T>
fn into_kernel_arg( self, launch_config: &LaunchConfig, ) -> ThreadIndexedSlice<'a, T>
Source§impl<'a, T: SafeKernelArg<Output = T>> SafeKernelArg for &'a mut Vec<T>
Available on neither AMD GPU nor NVidia GPU.
impl<'a, T: SafeKernelArg<Output = T>> SafeKernelArg for &'a mut Vec<T>
Available on neither AMD GPU nor NVidia GPU.
type Output = ThreadIndexedSlice<'a, T>
fn into_kernel_arg( self, launch_config: &LaunchConfig, ) -> ThreadIndexedSlice<'a, T>
Source§impl<'a> SafeKernelArg for &'a String
Available on crate feature amd-allocator and neither AMD GPU nor NVidia GPU only.
impl<'a> SafeKernelArg for &'a String
Available on crate feature
amd-allocator and neither AMD GPU nor NVidia GPU only.type Output = &'a str
fn into_kernel_arg(self, _: &LaunchConfig) -> Self::Output
Source§impl<T> SafeKernelArg for *const T
Available on neither AMD GPU nor NVidia GPU.
impl<T> SafeKernelArg for *const T
Available on neither AMD GPU nor NVidia GPU.
type Output = *const T
fn into_kernel_arg(self, _: &LaunchConfig) -> Self::Output
Source§impl<T> SafeKernelArg for *mut T
Available on neither AMD GPU nor NVidia GPU.
impl<T> SafeKernelArg for *mut T
Available on neither AMD GPU nor NVidia GPU.
type Output = *mut T
fn into_kernel_arg(self, _: &LaunchConfig) -> Self::Output
Implementors§
Source§impl<'a, T: SafeKernelArg<Output = T>> SafeKernelArg for &'a GpuBox<T>
Available on neither AMD GPU nor NVidia GPU.
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.
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 mut GpuBox<[T]>
Available on neither AMD GPU nor NVidia GPU.
impl<'a, T: SafeKernelArg<Output = T>> SafeKernelArg for &'a mut GpuBox<[T]>
Available on neither AMD GPU nor NVidia GPU.