Skip to main content

Module cache

Module cache 

Source
Expand description

Where CubeCL keeps its compiled kernels.

Compiling this crate’s kernels takes about ten seconds, and CubeCL caches nothing on its own. Its cache setting defaults to None, so every run recompiles from scratch unless something points it at a directory.

install_compilation_cache points it at one. By default that is av-denoise inside the user’s cache directory, which turns the ten seconds into a cost paid once per machine rather than once per run. A warm cache takes the 53-frame reference clip from 11.8 s to 1.3 s.

The AV_DENOISE_COMPILATION_CACHE environment variable overrides the location, which is what CI runs and containers use to put the cache on a mounted volume. Setting it to off disables caching entirely, which is what benchmarking wants, because a warm cache hides the compilation cost that a first run pays.

install_compilation_cache has to run before the first Denoiser is created, because building a CubeCL client locks the global config.

// Call this at the top of `main`, before any denoiser exists.
match av_denoise_core::install_compilation_cache()? {
    Some(path) => println!("caching compiled kernels in {}", path.display()),
    None => println!("kernel caching is off, every run recompiles"),
}

Structs§

CacheAlreadyInitialisedError
The CubeCL global config was already set up before this helper ran, so the override can no longer be installed.

Constants§

COMPILATION_CACHE_ENV
The environment variable that overrides where compiled kernels are cached, or turns caching off.

Functions§

install_compilation_cache
Points CubeCL’s compilation and autotune caches at a directory.