Repository navigation
d3d12: never defer buffer V#s past console-fix budget (RT-CONSOLE-FIX-NEVER-DEFER-BUFFER-VSHARP) - #2162
Conversation
…-NEVER-DEFER-BUFFER-VSHARP) In fix_console_slots, when the LEONIDA_CONSOLE_FIX_US budget expires, do not null or defer buffer descriptors (!(w3 >> 30)). Only defer image T# descriptors to retry_console_slots. Buffer V# descriptors only rebase address offsets and are fast to fix, whereas image T#s perform costly texture lookups and view creation. Compute shaders during world transition (e.g. lib_cs_01144) read loop bounds and record counts from buffer descriptors; nulling them causes infinite loops and device loss. Tested with console_heap_vsharp_slots_test and vk_console_heap_gpu_test. AI-assisted (Claude Code).
|
Checked
AI-assisted. |
|
Follow-up negative control on
AI-assisted. |
|
Thank you, @abnalstlll-byte. This went into AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2) |
Both came in with #2350 as additions on top of stopgap mechanisms, broke world runs (remap release: a GPUVM page fault and a lost device; the mirror: a GPU hang) and were made opt-in by #2356. They go completely; with both variables unset, main behaves as before. Remap release (LEONIDA_GEOMETRY_REMAP_RELEASE, from 36771ec): - xmem.cpp: RemapReleases, remap_releases_enabled() and the page recording in unmap_range_locked; the four call sites (XMemMapPhysicalPages, the scatter call, both copy_page_mappings). - xmem.h/xmem.cpp: the test seam rt::xmem::reload_remap_release_setting(). - xmem_test: test_remap_releases (and the title_geometry_watch.h include only it used). - README row, the docs/d3d12_vulkan.md paragraph; comments that named it. Console heap mirror (LEONIDA_HEAP_MIRROR, LEONIDA_HEAP_MIRROR_CHECK, from 7460590): - src/console_heap_copy.h goes. ConsoleHeap::copy is a plain std::uint8_t* again, written with memcpy/memset as before the mirror, including the zeroing site that #2350's merge of #2162 resolved as heap.copy.zero(); the compute-input probe reads it directly again. Without the mirror, view() was the copy itself, so nothing changes. - heap_mirror_enabled(), heap_mirror_check_enabled(), check_console_heap_mirror(), the per-heap check counters and log line, and the test API console_heap_mirror_mismatches() (d3d12_com.h). - Tests console_heap_copy, d3d12_console_heap_mirror, _off and _default with their CMake entries; README rows and the docs/d3d12_vulkan.md sentences. Kept, because other paths use them or main's behaviour with the variable unset depends on them: - LEONIDA_GEOMETRY_HOST and its DeviceState memory-type assert (dc9ef1a). - The final copy at retirement (GeometryViews::retire_range's final_copy, "copied at retirement" in the geometry buffers line): XMemFree of a title heap block (free_title_block) reports a release while the block's memory stays committed and readable, so that copy is still made without remap release. Comments now say that instead of naming remaps; geometry_views_test case 15 stays. - forget_pool_span and "retired with their copy" in the title memory line: any retirement (free, decommit, unmap) feeds it. - The release queue's joining of touching ranges (title_geometry_watch.h): unmaps report page runs too; geometry_views_test case 16 stays. - LEONIDA_CONSOLE_RELEASE_FILTER, which predates the mirror; its sweep reads the copy again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claimed in Issue #1608: RT-CONSOLE-FIX-NEVER-DEFER-BUFFER-VSHARP.
What and why
In
fix_console_slots()(runtime/shims/d3d12_vulkan_device.cpp), when theLEONIDA_CONSOLE_FIX_USsubmission budget expires (heap.fix_over == true), the code currently zeroes every remaining descriptor slot and defers them toretry_console_slots.Nulling buffer descriptor slots (V#s) causes compute shaders during the world transition (e.g.
lib_cs_01144) to divide by 0 or read zero loop bounds from buffer descriptors, causing an infinite loop and GPU device loss.Buffer V# descriptors (
!(w3 >> 30)) only rebase virtual addresses and are fast to process without causing submission stalls (the 28s freeze is driven by thousands of image T# descriptors performing image binding and view lookups).This change ensures that buffer V# descriptors are never nulled or deferred when the fix budget expires: they are always resolved in-place with
fix_console_slot, while image T# descriptors continue to be safely deferred toretry_console_slots.Testing
console_heap_vsharp_slots_test: addedtest_console_fix_budget_buffer_vsharp_non_deferral()verifying that underfix_over == true, buffer V# descriptors are preserved live while image T#s are deferred and nulled. Passed (100%).vk_console_heap_gpu_test: passed on NVIDIA GeForce RTX 5060 Ti.scripts/check_no_game_data.py: passed (0 violations).tests/test_text_write_line_endings.py: passed.AI-assisted (Claude Code).