Labels: command buffers and encoders take Metal's label, and a lost device's notice names the hang by them

A lost VkDevice's recovery notice named its hang only as "a command buffer (of queue `Q`)",
so an Iris boot's GpuHang (46 victims) left nothing to tell which work hung. The runtime had
no label for a command buffer or an encoder at all.

CommandBuffer::label/set_label (MTLCommandBuffer.label) and label/set_label on the blit,
compute, render and resource state encoders (MTLCommandEncoder.label) now keep what the
program sets. A command buffer has one encoder open at a time, so the open encoder's label
lives on the command buffer's state, and the encoder's record takes it as it ends: each
EndedEncoder reports its label, in its place, a render encoder that ends on the lowering
thread included. The recovery names its culprit from the command buffer's state as it fails
the pending batches: its label and its queue's, then its first 32 ended encoders' places,
kinds and labels, counting the rest, e.g. "command buffer `busy` of queue `relayed` (its 1
encoder: 0 blit `copies`) failed as the hang (`GpuHang`)".

set_label and label are no calls in EncoderCall's numbering. The API table, the Metal and
conformance coverage maps, docs/API.md's DeviceRecovered entry and the runtime README say so.
The table's WorkCounts::spare_command_buffers_freed_past_recorded line moves to where the
script sorts it.

Verified: fmt only on this machine; tests::labels (both lowering policies) and
tests::device_recovery's relayed-loss test, which asserts the named notice, run on lavapipe next.
This commit is contained in:
Anees Iqbal committed 2026-11-12 12:12:54 -08:00
1 parent d9478fc91f
commit 0a4f4e87f2
21 files changed
+305 -33

No files matched your search

+3 -1
View File
@@ -3630,7 +3630,9 @@ bound.
(`GpuRecoveryVictim`), and every later call of the device and of its command queues goes to the
new `VkDevice`; a queue's lent `VkQueue` (`CommandQueue::with_vk_queue`) comes with the
`VkDevice` it belongs to, the new one from then on. Announced at each recovery, by the call that made it; the reason names the hang's
command buffer (an inference, said so, where two or more `VkQueue`s had work in flight), how
command buffer (an inference, said so, where two or more `VkQueue`s had work in flight) by its
label and its queue's, with its first 32 ended encoders' places, kinds and labels
(`CommandBuffer::set_label`, each encoder's `set_label`), how
long the recovery took, and the objects it carried to the new `VkDevice` and left refused, by
kind. Announced too, at most once each per recovery whatever an earlier
recovery announced: where a call waited past 10 seconds for the recovery under way, where its