GpuKernel

Trait GpuKernel 

Source
pub trait GpuKernel: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn source_for_backend(
        &self,
        backend: GpuBackend,
    ) -> Result<String, GpuError>;
    fn metadata(&self) -> KernelMetadata;
    fn can_specialize(&self, params: &KernelParams) -> bool;
    fn specialize(
        &self,
        params: &KernelParams,
    ) -> Result<Box<dyn GpuKernel>, GpuError>;
}
Expand description

GPU Kernel interface

Required Methods§

Source

fn name(&self) -> &str

The name of the kernel

Source

fn source_for_backend(&self, backend: GpuBackend) -> Result<String, GpuError>

Get kernel source for the specified backend

Source

fn metadata(&self) -> KernelMetadata

Get kernel metadata (workgroup size, memory requirements, etc.)

Source

fn can_specialize(&self, params: &KernelParams) -> bool

Can this kernel be specialized for the given parameters?

Source

fn specialize( &self, params: &KernelParams, ) -> Result<Box<dyn GpuKernel>, GpuError>

Create a specialized version of this kernel for the given parameters

Implementors§