mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-18 06:59:57 -04:00
Merge the audit: its map and ledger, the perf-trace markers and size lines, and the fixes of its Phase 4.
Verified by runs in the audit: the Market's periodic stall (a pool slot was listed once per refresh pass instead of once; the list fell from 160,385 entries to at most 3,192 and no frame over 20 ms remained while standing), orderly exits delete the pipeline prebuild's running marker (left behind, the next start wrote a skip file and every later start skipped the prebuild), the log and crash report name an area a save asks for that the game does not have, and the menu atlas hash no longer overflows a signed multiply. The other fixes compile and pass the regression route but their faults were never reproduced: see AUDIT.md section 13 for each. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -1778,7 +1778,8 @@ static struct {
|
||||
int unres_more; // it left a lookup for the creation budget: the next submission walks again
|
||||
PoolSlot *ps; // [id]
|
||||
uint8_t *unres_on; // [id]: its last fill resolved to no entry (POOL_FAST: retried each submission)
|
||||
int *unres, nunres, cunres; // those slots (some may have left: unres_on clear)
|
||||
uint8_t *unres_in; // [id]: the slot is in unres (once: pool_unres never lists it a second time)
|
||||
int *unres, nunres, cunres; // those slots (some may have left: unres_on clear, dropped by the next walk)
|
||||
uint32_t *ent; // [id]: the entry its last fill resolved to, held there (pool_hold); 0: none
|
||||
uint64_t dirty_pos; // vk_texture_dirty_slots_locked position (0: the next sync walks every slot)
|
||||
int ready, uab, sealed; // sealed: a part of the current submission already reads sets[cur]
|
||||
@@ -1859,8 +1860,9 @@ static VkDescriptorSetLayout pool_layout_make(void) {
|
||||
PL.samp = calloc(VK_POOL_SAMP, sizeof *PL.samp);
|
||||
PL.ps = calloc(VK_POOL_TEX, sizeof *PL.ps);
|
||||
PL.unres_on = calloc(VK_POOL_TEX, 1);
|
||||
PL.unres_in = calloc(VK_POOL_TEX, 1);
|
||||
PL.ent = calloc(VK_POOL_TEX, sizeof *PL.ent);
|
||||
if (!PL.tok || !PL.view || !PL.samp || !PL.ps || !PL.unres_on || !PL.ent) rt_fatal("vk: out of memory");
|
||||
if (!PL.tok || !PL.view || !PL.samp || !PL.ps || !PL.unres_on || !PL.unres_in || !PL.ent) rt_fatal("vk: out of memory");
|
||||
rt_log("vk: bindless texture pools: %d kinds x %d textures, %d samplers, %s, %d sets (one per submission in turn)%s",
|
||||
VK_POOL_KINDS, VK_POOL_TEX, VK_POOL_SAMP,
|
||||
PL.uab ? "update after bind" : "no update-after-bind on this GPU (entries written while bound are undefined)", PL.nsets,
|
||||
@@ -2227,13 +2229,18 @@ static void pool_hold(uint32_t id, uint32_t ent) {
|
||||
|
||||
// Slot id's last fill resolved to no entry (got 0) or to one: the slots without one are looked up again each
|
||||
// submission (pool_sync_entries), as the walk over every slot did: an entry their storage could not have then may be
|
||||
// made now, and its address generation then refills them.
|
||||
// made now, and its address generation then refills them. A slot that resolved keeps its place in the list until the
|
||||
// next walk drops it; when it stops resolving before that walk, that place serves again. Listing it a second time
|
||||
// made the list grow by one entry per such change (160,000 entries for the 32,768 slots after a minute in the Market),
|
||||
// and every 8th submission's walk over it then held the texture lock for 15 to 30 ms.
|
||||
static void pool_unres(uint32_t id, int got) {
|
||||
if (got || PL.unres_on[id]) {
|
||||
if (got) PL.unres_on[id] = 0;
|
||||
return;
|
||||
}
|
||||
PL.unres_on[id] = 1;
|
||||
if (PL.unres_in[id]) return;
|
||||
PL.unres_in[id] = 1;
|
||||
if (PL.nunres == PL.cunres) {
|
||||
int n = PL.cunres ? PL.cunres * 2 : 1024;
|
||||
int *p = realloc(PL.unres, sizeof *p * (size_t)n);
|
||||
@@ -2501,6 +2508,7 @@ static void pool_sync_entries(VkExec *ex) {
|
||||
int r = t && t == PL.tok[id] ? vk_texture_slot_retry_locked(id) : -1;
|
||||
if (r) { // resolves now (an entry it made changes its token: refilled), was refilled since, or
|
||||
PL.unres_on[id] = 0; // resolves to none until its token changes (the refill lists it again)
|
||||
PL.unres_in[id] = 0;
|
||||
PL.unres[i] = PL.unres[--PL.nunres];
|
||||
continue;
|
||||
}
|
||||
@@ -5808,3 +5816,19 @@ void vk_exec_op_draw(VkExec *ex, uint32_t op, const void *payload) {
|
||||
op_draw_impl(ex, op, payload);
|
||||
perf_replay_op_at(op_is_draw(op) ? PERF_RP_DRAW : PERF_RP_BIND, op, plat_now_ns() - t0);
|
||||
}
|
||||
|
||||
// NX2NAVI_TRACE=perf "mem: sizes" (perf.c): the image view cache (under the texture lock), the spare descriptor pools
|
||||
// and transient chunks, and the continuations held for event order.
|
||||
void vk_exec_sizes(PerfSizes *s) {
|
||||
vk_texture_lock();
|
||||
uint64_t views = view_of.n, imgs = views_by_image.n;
|
||||
vk_texture_unlock();
|
||||
plat_mutex_lock(&spare_lock);
|
||||
uint64_t sp = (uint64_t)nspare_pool, sc = (uint64_t)nspare_chunk;
|
||||
plat_mutex_unlock(&spare_lock);
|
||||
perf_size(s, "image views", views, 0, PERF_SIZE_NONE);
|
||||
perf_size(s, "images with views", imgs, 0, PERF_SIZE_NONE);
|
||||
perf_size(s, "spare descriptor pools", sp, SPARE_POOLS, PERF_SIZE_NONE);
|
||||
perf_size(s, "spare transient chunks", sc, SPARE_CHUNKS, sc * CHUNK_BYTES);
|
||||
perf_size(s, "held continuations", (uint64_t)vk_exec_held(), 36, PERF_SIZE_NONE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user