Skip to main content

register_module_kernel

Function register_module_kernel 

Source
pub fn register_module_kernel(id: KernelId, source: KernelSource)
Expand description

Register a kernel from a module

This should be called during module initialization to register module-specific kernels with the global registry.

ยงExample

use scirs2_core::gpu_registry::{register_module_kernel, KernelId, KernelSource};
use scirs2_core::gpu::GpuBackend;

fn register_fft_kernels() {
    let fft_kernel_source = r#"
        extern "C" __global__ void fft2d_c32(float2* data, int n) {
            // FFT kernel implementation
        }
    "#;

    register_module_kernel(
        KernelId::new("fft", "fft2d", "c32"),
        KernelSource {
            source: fft_kernel_source.to_string(),
            backend: GpuBackend::Cuda,
            entry_point: "fft2d_c32".to_string(),
            workgroup_size: (32, 8, 1),
            shared_memory: 16384,
            uses_tensor_cores: false,
        },
    );
}