mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-20 06:09:58 -04:00
Let the completion thread's collect give way while an upload holds the upload lock.
completion_main calls vk_mem_collect after it publishes each new done, and vk_mem_collect waited for cmd_lock. An upload flush holds that lock across vk_queue_lock, behind a present call (FIFO, a frame limiter inside the present, frame generation) or another long queue-lock hold. With wait = 1 it also holds it across its batches' fence waits, and stg_create waits for batch fences under it. The single completion thread blocked there could not process the next timeline value, so the next done, and every fence waiter for it, waited for that chain. vk_mem_collect_try only tries cmd_lock. When the lock is busy it still destroys the finalized pools, which need only retire_lock, and leaves the deferred objects to a later completion or to the next upload flush's own collect. After eight busy tries in a row it waits as vk_mem_collect does, which keeps the deferred list bounded, as before. pool_fini keeps the waiting vk_mem_collect. The trace=perf "mem: sizes" GPU line counts the collects that gave way. Not reproduced before the change: the completion thread's lock waits are not timed. Checks that passed: pass_cc_check on every runtime file (vk.h changed), no new -Wall -Wextra warnings in vk_memory.c and vk_sync.c, sync_hw_check, gpa_check, mem_budget_check, tex_release_check, mem_growth_check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -609,6 +609,7 @@ void vk_astc_release(void); // vk_device.c, before the device goes:
|
||||
void vk_mem_note_submit(uint64_t timeline_value); // vk_sync.c: after each submit that signals ctx->timeline with this value
|
||||
void vk_mem_oom_report(const char *what, VkResult r); // logs heaps and upload batches after an out-of-memory failure
|
||||
void vk_mem_collect(void); // frees what has completed
|
||||
void vk_mem_collect_try(void); // the same, unless the upload lock is busy (completion thread)
|
||||
typedef struct { uint64_t imported_pools, physical_pools, virtual_pools, import_failures, upload_batches; } VkMemStats;
|
||||
void vk_mem_stats(VkMemStats *s);
|
||||
void vk_mem_shutdown(void); // before vk_shutdown: waits idle, frees every memory and texture object
|
||||
|
||||
Reference in New Issue
Block a user