d3d12: never defer buffer V#s past console-fix budget (RT-CONSOLE-FIX-NEVER-DEFER-BUFFER-VSHARP) #2162
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2162"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-26T00:39:34Z.
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).
Imported from ubiquitarianism/leonida. Originally posted by moffington on 2026-11-26T00:51:43Z.
Checked
2769c5a7on Linux (AMD Ryzen 5 5600X3D, NVIDIA GeForce RTX 3060, driver 615.78.08) and Windows/Wine (clang-cl 23.1.3+xwinSDK 10.0.26100).console_heap_vsharp_slots_test: passed at both merge-base (61732aca) and head (2769c5a7) on Linux (g++ 16.2.1, RelWithDebInfo and ASan+UBSan-Wall -Wextra -Werror) and under Wine.d3d12_vulkan_device_testandd3d12_console_descriptor_heap_test(withLEONIDA_CONSOLE_FIX_US=1): built cleanly withclang-cland passed under Wine on RTX 3060.DeviceState::fix_console_slots()(runtime/shims/d3d12_vulkan_device.cpp),!(w3 >> 30)atheap.previous + at + 12matchesfix_console_slot()'s buffer V# classification.test_console_fix_budget_buffer_vsharp_non_deferral()inconsole_heap_vsharp_slots_test.cppsimulates the!(w3 >> 30)deferral branch inline on a local array rather than callingDeviceState::fix_console_slots(), and no existingruntime/test/target exercisesLEONIDA_CONSOLE_FIX_USbudget expiry throughfix_console_slots().AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by moffington on 2026-11-26T01:31:04Z.
Follow-up negative control on
2769c5a7(coverage gap, not a defect in thed3d12_vulkan_device.cppfix itself):#2162HEAD'sruntime/test/console_heap_vsharp_slots_test.cppagainst merge-base (61732aca)runtime/src— i.e., with theDeviceState::fix_console_slots()change reverted — still builds and passes (console_heap_vsharp_slots_test: ok).test_console_fix_budget_buffer_vsharp_non_deferral()would not catch a regression infix_console_slots(), since it only exercises an inline local array rather than the productionDeviceState::fix_console_slots()path.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-26T14:42:07Z.
Thank you, @abnalstlll-byte. This went into
mainthrough #2350 (RT-LINUX-AMD-WORLD), merged at your head2769c5a73with your commits and authorship kept. The one conflict, infix_console_slots, came from a host-RAM mirror of the heap copy in the same PR. Your buffer-V# exception was kept, and the zeroing now goes throughheap.copy.zero(). GitHub shows this PR as merged for that reason, so nothing needs closing.AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2)