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 default_cache_dir, av-denoise inside the platform’s cache directory, which turns the ten seconds into a cost paid once per machine rather than once per run.

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.

If using av-denoise as a library you may want to specify the cache directory path yourself via install_compilation_cache_at instead.

// 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"),
}

Enums§

CacheError
Something went wrong installing the kernel cache.

Constants§

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

Functions§

compilation_cache_dir
The directory compiled kernels are cached in.
default_cache_dir
The directory compiled kernels are cached in when nothing overrides it.
install_compilation_cache
Installs the cache at default_cache_dir, or the directory COMPILATION_CACHE_ENV names, unless that variable turns caching off.
install_compilation_cache_at
Points CubeCL’s compilation and autotune caches at dir, creating it if it does not exist.
install_compilation_cache_once
Points CubeCL at a cache the first time it runs, and reports where.