Skip to main content

KernelCompiler

Trait KernelCompiler 

Source
pub trait KernelCompiler: Send + Sync {
    // Required method
    fn compile_kernel(
        &self,
        name: &str,
        function_bytecode: &[u8],
        config: &KernelCompileConfig,
    ) -> Result<SimulationKernelFn, String>;

    // Provided method
    fn supports_feature(&self, feature: &str) -> bool { ... }
}
Expand description

Trait for JIT kernel compilation.

This trait is implemented by shape-jit::JITCompiler and injected into ExecutionContext to enable JIT kernel compilation without circular dependencies.

The bytecode is passed as raw bytes since we can’t reference BytecodeProgram here.

Required Methods§

Source

fn compile_kernel( &self, name: &str, function_bytecode: &[u8], config: &KernelCompileConfig, ) -> Result<SimulationKernelFn, String>

Compile a strategy function to a JIT kernel.

§Arguments
  • name - Name for the compiled kernel (for caching/debugging)
  • function_bytecode - Serialized bytecode of the strategy function
  • config - Kernel configuration with field offsets
§Returns

The compiled kernel function pointer, or an error message.

Provided Methods§

Source

fn supports_feature(&self, feature: &str) -> bool

Check if the compiler supports a given feature.

Implementors§