Skip to main content

RuntimeFactory

Type Alias RuntimeFactory 

Source
pub type RuntimeFactory = Arc<dyn Fn(&CompiledSpec) -> Result<Box<dyn Program>> + Send + Sync>;
Expand description

A factory function that creates executable Programs from a compiled specification.

This is a function pointer that wraps the backend-specific loader:

  • LLVM: Extract source from CompiledSpec and JIT compile
  • CUDA: Extract bytes from CompiledSpec and call cuModuleLoadData + cuModuleGetFunction
  • Metal: Extract bytes from CompiledSpec and call newLibraryWithData + newFunctionWithName
  • WebGPU: Extract bytes from CompiledSpec and call createShaderModule

The CompiledSpec contains either source (for JIT) or bytes (for AOT), allowing each backend to access what it needs.

Aliased Typeยง

pub struct RuntimeFactory { /* private fields */ }