exit_guard: past half its bound, the hook names where the sections it waits for began

An exit that waited for the runtime's work said nothing about what it waited for until its bound
ran out, and then only that the driver still ran it (the at-once notice). An exits-lane exit
that took 2.08 s on the RTX 5080 (runtime_lane::exits, handler_learns_exit, development
9bd38c7994) left no sign of the call it waited for.

Each thread's outermost section now keeps its caller's place while it lasts (Guard::places, a
slot of 64 each, Location::caller through the #[track_caller] doors: enter, Guard::enter,
Guard::enter_making, driver_making, and so release::object's caller). Once its wait has passed
half its bound, Guard::close says on standard error, once: "metal2vulkan: the exit has waited N ms
for M section(s) of the runtime's Vulkan work, begun at: file:line, ...". A section that begins
while every slot is taken goes unnamed. exit_guard's module docs and docs/API.md's process-exit
difference say so.

Tests:
- tests::exit_guard::the_sections_in_progress_name_where_they_began: an outer section's place
  is named, a nested section's is not, another thread's section is named with its own place,
  and an ended section is gone.
- a_busy_exit_past_the_bound_ends_at_once_with_its_status now reads the naming line before the
  notice for a section in progress, and no such line for a CPU device's work.

Verified: tests::exit_guard on homelab-gem10-1 (plain build), m3-max-8041: 46 of 46 passed.
(cherry picked from commit edee4b49637eddd2f6f2daf83ce2b2246b9fc6a5)
This commit is contained in:
Anees Iqbal committed 2026-11-08 03:41:48 -08:00
1 parent 5ce05e1908
commit f5da0934bf
3 files changed
+135 -14

No files matched your search

+3 -1
View File
@@ -4718,7 +4718,9 @@ each item named states the rule in full.
waits for that work (the runtime's calls in the driver, a CPU device's commands) for at most
2 s, and at most 60 s while a pipeline's making is in progress in the driver; once it ended the
exit handlers registered before the runtime's run, as Metal's exit runs them. Past those bounds
they do not run (a terminal's restore, say), where Metal's exit runs them.
they do not run (a terminal's restore, say), where Metal's exit runs them. Once the wait passed
half its bound, one line on standard error names where the runtime's work still in progress
began.
**Two-plane YCbCr textures**