Repository navigation
d3d12: console heap slots record what their V#s resolved to; a release re-fixes only the slots naming it (RT-VSHARP-SLOT-RECORDS) - #2407
Conversation
…e re-fixes only the slots naming it (RT-VSHARP-SLOT-RECORDS) After any arena release, title-window or geometry block destroyed, or alias change, the next submission walked every live V# slot of the console heap (about 580,000 in world runs), reading each from the copy in ReBAR VRAM: 1.1-1.5 s a walk whatever the scene, about 2.9 s of a 4.6 s frame. It existed only because nothing recorded which slot resolved into which backing. Each V# half of a console resource heap's copy now has a record in host RAM (src/console_heap_slot_records.h): the title's base and span, the device address its copy names, and whether it resolved or waits. Two indexes (by base, by target; per power-of-two span class and 64 KiB-or-larger granule) find the halves near a range. fix_console_slot, the only writer of a slot's copy, writes them; a zeroed range, a deferred slot and a rewritten slot drop theirs; a destroyed heap takes them with it. Releases (backing(), title_block_gone), alias ranges removed or replaced (TitleVaAliases tells its listeners as it happens, forget_copy included) and additions (backings, alias ranges, title memory) go on an unbounded per-device list. refresh_console_heaps takes it whole; every heap re-fixes exactly the slots it touches: a release or removal every half naming the range, an addition the waiting halves over it. A new heap log line gives the changes, slots looked at, slots fixed again and ms per submission. Removed: the live_vsharps walk and its bitset (console_heap_vsharp_slots.h and its test), the release generation checks (released_backings, TitleVaAliases::invalidations), LEONIDA_CONSOLE_RELEASE_FILTER, the 4,096-entry DescriptorRangeChanges ring with its full-sweep overflow and changed_ranges(), the empty-slot probe and retry_unmapped_slots (unreachable: nothing set its flag). LEONIDA_CONSOLE_GPU_FILTER now defaults to unset instead of the removed variable's value. The T# retries (retry_console_slots) stay. Tests: console_heap_slot_records_test (portable): releasing a buffer 10 of 60,010 slots name looks at 10 entries and fixes 10 slots; an alias moved, removed and added back; overwritten and zeroed slots; partial overlap; two slots on one backing; a buffer back; a refused alias copy backed later; a large span; a destroyed heap; and 400 random rounds compared with a full re-resolution of every slot. d3d12_unmapped_vsharp_test now expects all 128 waiting slots restored at the first submission after their alias comes (was: 16 by the probe in 64 submissions), none after it goes, and the slots naming a released buffer null. title_va_alias_test and geometry_views_test check the listener in place of the ring. Linux ctest 113/113; Windows suite under Wine (clang-cl, iGPU, RADV) equal to main 2d43417 test by test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merging. This is a self-merge.
AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2) |
|
A/B of this pull request on NVIDIA for #2464 part A ("NVIDIA device losses on PROVISIONAL (n=2 per side): no device loss and no GPU fault in any of the four runs, on either side. How far the runs got does not compare: in A cold and B warm the profile-selection page came up after the input script's last press (90 s), so those two runs stayed on it for the whole 20 minutes; A warm and B cold went into the story load. So only one run per side reached the heavy part of the load, and the result says nothing about losses later than that.
|
A console heap's copy now keeps a record per V# of what it resolved to. A released buffer, a removed alias range or a
retired copy re-fixes only the slots that name it. Before this, every live slot of the heap was walked. Nothing walks
the heap any more.
Claimed in the coordination issue as: RT-VSHARP-SLOT-RECORDS
What was wrong
every live V# slot of the console heap: about 580,000 in our world runs.
LEONIDA_CONSOLE_RELEASE_FILTER=1, the walk read words 0-2 of both halves of each slot fromheap.copy. Thatcopy is in ReBAR VRAM, so these were uncached reads. Without the variable, it fixed every live slot again.
was held for about 70% of the wall time.
What changes
runtime/src/console_heap_slot_records.h(new, portable). For each V# half (the buffer V# and the UAV counter),a record of:
64 KiB, so a range lookup visits only the entries near the range.
calloc, so pages for slots that are never written stay untouched.fix_console_slotis still the only writer of a slot's copy, and now also the only writer of its records.mutex for the list:
backing()add and release;title_block_gone;forget_copy:TitleVaAliasesnow tells listeners as each changehappens;
refresh_console_heapstakes the whole list and every heap re-fixes exactly the slots ittouches:
probe of 8 slots every 32 submissions.
slot records per submission: N changes, N slots looked at, N fixed again, N ms.What is removed
live_vsharpswalk and its bitset:src/console_heap_vsharp_slots.hand its test.LEONIDA_CONSOLE_RELEASE_FILTERand its README row.LEONIDA_CONSOLE_GPU_FILTER(GPU heap pass, opt-in) nowdefaults to unset instead of copying that variable's value.
released_backingsandTitleVaAliases::invalidations().DescriptorRangeChangesring (src/descriptor_range_changes.h), whose overflow fell back to a fullsweep, and
changed_ranges().retry_unmapped_slots. The second was never reached: nocaller set its
unmappedflag.retry_console_slots, the T# retries. Textures are not backings, so they need their own index (step A3).Tests
console_heap_slot_records_test(portable, CPU only):that only partly overlaps a slot's range; two slots naming the same backing; a buffer that comes back; a refused
alias copy that is backed later; a large span; a destroyed heap.
d3d12_unmapped_vsharp_test(Wine/Windows):all 128 restored at the first submission after their alias is added, and none after it is removed.
title_va_alias_testandgeometry_views_testcheck the listener in place of the ring and the invalidation counter.ctest(RelWithDebInfo, Ryzen 9 7950X3D iGPU, RADV, Mesa 26.3.1): 113 of 113 pass,2 skipped (as on
main).main2d43417d4: 423 pass, 23 fail, 39 skipped on both. The 23 failures are the same presentation, bcrypt andfile-system tests as on
main. The only differences areconsole_heap_slot_recordsadded andconsole_heap_vsharp_slotsremoved. No test went from pass to fail.tests/test_ci_registration.py,tests/test_docs_*.py,tests/test_text_write_line_endings.pyandscripts/check_no_game_data.pyon the changed files all pass.World run
RX 7900 XTX, RADV (Mesa 26.3.1), Wine, from a local build of
mainfac8b4bb9with this change and two others (RT-BINDLESS-DIMENSION-LIMITS and #2230), same settings as a run of plainmain:rescansand noCPU release filterlines in the whole run.submit phasesis 2.2 to 2.4 ms per submission in the world, where plainmainhad 32 to 321 ms at the same run time.slot records per submissionshows changes arriving and slots fixed again (for example 19.6 changes, 4,610 slots looked at, 22.5 fixed again, 0.074 ms).mainhere (three of nine earlier runs). In the windows before it there were no slot changes at all, and the paths that release or move a backing were checked again against the code; nothing shows this change as its cause. The run did not reach play, so the frame time in play is not measured yet.Not tested
rescansand noCPU release filterlines;slot records per submissionline: slots looked at in the thousands, not about 580,000;submit phases;AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2)