diff options
author | Michael Jones <michael_jones> | 2022-11-11 21:10:16 +0300 |
---|---|---|
committer | Michael Jones <michael_p_jones@apple.com> | 2022-11-11 21:10:29 +0300 |
commit | 2c596319a4888aa40bfdf41f9ea5d446179141d0 (patch) | |
tree | 747a944a3b3cfe9714d260672ee56a8b7ec07280 /intern/cycles/util/path.h | |
parent | 6f6a0185f2be5074bcde4082dd3d1e31843151d9 (diff) |
Cycles: Cache only up to 5 kernels of each type on Metal
This patch adapts D14754 for the Metal backend. Kernels of the same type are already organised into subdirectories which simplifies type matching.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D16469
Diffstat (limited to 'intern/cycles/util/path.h')
-rw-r--r-- | intern/cycles/util/path.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/intern/cycles/util/path.h b/intern/cycles/util/path.h index 48b1fb65919..6d02267e182 100644 --- a/intern/cycles/util/path.h +++ b/intern/cycles/util/path.h @@ -55,8 +55,15 @@ bool path_remove(const string &path); /* source code utility */ string path_source_replace_includes(const string &source, const string &path); -/* cache utility */ -void path_cache_clear_except(const string &name, const set<string> &except); +/* Simple least-recently-used cache for kernels. + * + * Kernels of same type are cached in the same directory. + * Whenever a kernel is used, its last modified time is updated. + * When a new kernel is added to the cache, clear old entries of the same type (i.e. in the same + * directory). */ +bool path_cache_kernel_exists_and_mark_used(const string &path); +void path_cache_kernel_mark_added_and_clear_old(const string &path, + const size_t max_old_kernel_of_same_type = 5); CCL_NAMESPACE_END |