Files
metal2vulkan/crates
Anees Iqbal 9ba7b2a45f rt: quiesce leaves a late thread running and keeps it; the teardown joins every thread first
3ed8095758 made quiesce join every thread past its deadline. That made quiesce unbounded, which
breaks the exit contract (077c9722e3, 0071f33d2c, the README): after a false answer a thread can
still be in the driver, on NVIDIA the completion thread in an unbounded semaphore wait until a
later submission the runtime never makes, and a consumer calls quiesce with its bound from its
exit path for exactly that case. The exit-139 hazard is destruction under a live thread, and
quiesce destroys nothing.

Now, as on development, quiesce waits for each thread up to its deadline and joins one only once
it has ended; a thread past the deadline is left running and its handle kept (halt hands the left
threads back, Device::quiesce keeps them in Shared). The teardown, on whichever thread drops the
last handle, joins every runtime thread with no deadline before it destroys anything a thread can
reach: those its own stop waits for, and those a late quiesce left (join). A thread is never
joined by itself: the reaper running a teardown lets its own handle go and ends once it returns.

The late-quiesce upload test is restored as development has it (fa415d77ce undone): it states the
contract, a quiesce that answers at its deadline while host-held work keeps the GPU. The README's
quiesce section and Device::quiesce's doc are development's again, with one sentence each on the
teardown's join; bf561f5241's sentence is gone with them. The quiesce join test becomes the test
the fix needs: with the submit thread held in a scheduled handler, quiesce(0) answers false at
once and leaves it running; the last handle, dropped on another thread, has not returned half a
second later, the blocks live and the thread holds its slot; once the handler lets it go, the drop
returns and every gauge reads zero (every_device_dropped_after_a_late_quiesce_joins_the_late_thread_first,
under the validation layer as every device test).
2026-11-19 03:17:37 -08:00
..