mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-20 10:19:57 -04:00
Keep the pipeline cache files under their limit when writing them, and set the limit from the RAM.
The limit was only checked when a file was read, all or nothing, so a run could write a file the next start then dropped whole. On an RTX 5080 (0.9.2) pipeline-cache-play.bin reached 524.9 MB in one session and the next start began empty; pipeline-cache.bin grows 14-28 MB at each fold and crosses 512 MB within a few sessions. Now a fold is made only when its result fits, and a cache past the limit is not saved again, so the file keeps its last save under the limit. Unset, the limit is the RAM / 32 between 512 and 4096 MB (512 on 16 GB as before, 2048 on 64 GB), which on that PC took boot hits from 14 to 84 % and left no pipeline to background builds. Taken into the 0.10.0 line with its conflicts resolved: the line had raised the limit to 1024 MB and says why in the comment above cache_data_read, in nx2navi.ini.example and in AUDIT.md; those texts keep that reason and give the RAM-based default, whose floor the next commit raises to match.
This commit is contained in:
@@ -39,6 +39,9 @@ static volatile int32_t cache_saving_at_exit;
|
||||
static volatile LONG active, snapshots;
|
||||
static HANDLE old_in, release_old, new_in, file_in, release_file;
|
||||
static int block_file, fail_file, writes, save_result;
|
||||
static uint64_t mock_cap; // cache_cap: 0 no limit
|
||||
static int prep_mode;
|
||||
static uint64_t cache_cap(void) { return mock_cap; }
|
||||
static struct {
|
||||
VkPipelineCache cache, play;
|
||||
int device, fold, feedback;
|
||||
@@ -143,7 +146,18 @@ int main(void) {
|
||||
assert(plat_mutex_trylock(&cache_rw));
|
||||
assert(cache_save_one(0, 0, 1) == 0 && writes == before && !cache_saving_at_exit);
|
||||
plat_mutex_unlock(&cache_rw);
|
||||
puts("cache save at exit: builds held back and waited for, autosave unchanged, timeout, failures and merges passed");
|
||||
|
||||
// A cache past the limit is not written (the next start would drop the file), holds no build back and lets the
|
||||
// next save run; a preparation writes it anyway.
|
||||
P.saved[0] = 0; mock_cap = 2; before = writes;
|
||||
assert(cache_save_one(0, 100, 1) == 1 && writes == before && !cache_saving_at_exit && P.saved[0] == 0);
|
||||
assert(cache_save_one(0, 0, 0) == 1 && writes == before);
|
||||
cache_build_enter(); plat_mutex_unlock_shared(&cache_rw);
|
||||
prep_mode = 1;
|
||||
assert(cache_save_one(0, 100, 1) == 1 && writes == before + 1);
|
||||
prep_mode = 0; mock_cap = 0;
|
||||
puts("cache save at exit: builds held back and waited for, autosave unchanged, timeout, failures, merges and the "
|
||||
"size limit passed");
|
||||
return 0;
|
||||
}
|
||||
'''
|
||||
|
||||
Reference in New Issue
Block a user