pub fn get_or_compile_kernel<F, E>(
ast_id: u64,
device: &str,
compile_fn: F,
) -> Result<Arc<CachedKernel>, E>Expand description
Get or compile a kernel by UOp ID and device.
Thread-safe: if multiple threads call this with the same key concurrently, exactly one will compile the kernel, and all others will receive a clone of the Arc to that kernel.
§Arguments
ast_id- The UOp ID of the kernel AST (from hash consing)device- Device string (e.g., “CPU”, “CUDA:0”)compile_fn- Function to compile the kernel if not cached
§Returns
Arc to the cached kernel (either from cache or freshly compiled).
§Errors
Returns error if compilation fails