Files
metal2vulkan/crates
Anees Iqbal a0d2d2efdd rt: a failed wake of the completion thread is owed to the next wake, and a failed host wait is made again
vkSignalSemaphore fails only for want of memory or with VK_ERROR_UNKNOWN,
never with a loss. The wake ignored the failure and marked the thread woken,
under a comment that said a failure is a loss. The thread stayed in its GPU
wait with nothing to end it, and every later flight-only wake returned early,
because the thread already waited for the progress semaphore. With work in
flight, a listener or an end then waited for the front batch to complete.
That is a deadlock where that batch waits on a host signal the listener
would give.

The form (the planner's ruling, which withdrew its "next wait is bounded"
form, a record the wait in progress cannot read):
- A failed signal leaves the wake owed. The thread stays marked waiting on
  the GPU, and the next wake from any thread signals again at a higher
  value, flight-only wakes included. The thread clears the debt as it next
  reads the state.
- There is no polling: tests/event_values.rs's thread-does-not-spin
  assertion holds as before.
- The limit, stated in the code: a failed wake that no later wake follows
  waits for the wait's other semaphores.

vkWaitSemaphores (the dma-bufs import's bind wait before vkDestroyBuffer)
and vkDeviceWaitIdle ignored every failure under a comment that named loss
alone. Both now go through complete::wait_through:
- success, a loss the call reports, or a loss the runtime has seen ends the
  wait;
- an out-of-memory or unknown result, which says nothing of what is
  pending, is called again 100 ms (LOSS_POLL) later.
So a lasting out-of-memory result on a live device waits, and no buffer
whose bind may still be pending is destroyed. On a lost device,
vkDeviceWaitIdle returns success or VK_ERROR_DEVICE_LOST in finite time
(Lost Device), so a teardown does not spin on a dead device.

The two tests of the previous commit, failed_waits.rs, turn green here
through the same seams (fail_wakes, fail_waits).
2026-12-02 23:36:31 -08:00
..