Files
metal2vulkan/crates
Anees Iqbal ce6bc460cf A lost generation's live buffers' table goes at its rest: the lost VkDevice no longer lives on
What: at a lost generation's rest (`DeviceShared::keep_nothing`), its table of the live buffers
and the table's spare go (`LiveBuffers::close`), before its recycler closes, so their buffers
park there and go with it. The table's lifetime rule says so (`live_buffers.rs`: its module docs
and `Inner::current`, `Inner::spare`), and `keep_nothing` lists it among the device-level objects
of work.

Why: the table's upload buffer (and the spare), buffers of the runtime's own on the generation,
hold it "only while a listed buffer lives, which holds it too". A recovery breaks that rule: it
carries the listed buffers on, and they stop holding the lost generation, but no command buffer
runs there again to make the next change that would drop the table. So once any command buffer
had made the table (an indirect command buffer's execution, which resolves its records'
addresses through it), the lost `DeviceShared` kept two strong holds (the upload buffer's handle
and its pages') for the life of the process, its `VkDevice` and driver memory with it, after the
program let go of everything. Development had it before this change (a diagnostic on lavapipe:
"1 tables made", live VkDevices 2 before and after the program's release of everything; the
generation came to rest).

Test: `device_recovery_live_table::a_lost_generation_s_live_buffers_table_goes_at_its_rest`.
An indirect execution makes the table (`WorkCounts::live_tables_uploaded` rises: the path ran),
the buffer and its state go, the three buffers live past a marked loss (not a parked
generation); the live VkDevices fall to 1 while they live, and stay 1 once they go. Its helpers
(the indirect state, buffer, command and execution) serve the every-kind test next.

Verified, at the change on a0b85d89d4 (with the carry after it): on lavapipe (msi, nextest, one process a
test) this test and the 41 other recovery, indirect-command-buffer and released-program tests
pass; its negative control (`close` made a no-op) fails it at the live count with the buffers
alive (after the test's 60 s wait), and the every-kind test at its end. On the GPUs, one
process a test: the Radeon 780M (RADV) and the Iris Xe (ANV) pass it with the 41 others; the RTX 3090
passes it, and fails one other, the exportable test, as development does there (its DmaBuf
re-export's inode). Clippy of the runtime, validation and conformance (all targets and
features, --cfg m2v_gpu and m2v_gpu_hazards): no message.
2026-11-13 00:37:07 -08:00
..