transpile_ring_kernel

Function transpile_ring_kernel 

Source
pub fn transpile_ring_kernel(
    handler: &ItemFn,
    config: &RingKernelConfig,
) -> Result<String>
Expand description

Transpile a Rust handler function to a persistent ring kernel.

Ring kernels are persistent GPU kernels that process messages in a loop. The handler function is embedded within the message processing loop.

§Example

use ringkernel_cuda_codegen::{transpile_ring_kernel, RingKernelConfig};
use syn::parse_quote;

let handler: syn::ItemFn = parse_quote! {
    fn process_message(value: f32) -> f32 {
        value * 2.0
    }
};

let config = RingKernelConfig::new("processor")
    .with_block_size(128)
    .with_hlc(true);

let cuda = transpile_ring_kernel(&handler, &config)?;
// Generates a persistent kernel with message loop wrapping the handler