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§
Sourcefn source_for_backend(&self, backend: GpuBackend) -> Result<String, GpuError>
fn source_for_backend(&self, backend: GpuBackend) -> Result<String, GpuError>
Get kernel source for the specified backend
Sourcefn metadata(&self) -> KernelMetadata
fn metadata(&self) -> KernelMetadata
Get kernel metadata (workgroup size, memory requirements, etc.)
Sourcefn can_specialize(&self, params: &KernelParams) -> bool
fn can_specialize(&self, params: &KernelParams) -> bool
Can this kernel be specialized for the given parameters?
Sourcefn specialize(
&self,
params: &KernelParams,
) -> Result<Box<dyn GpuKernel>, GpuError>
fn specialize( &self, params: &KernelParams, ) -> Result<Box<dyn GpuKernel>, GpuError>
Create a specialized version of this kernel for the given parameters