METAL2VULKAN_PENDING_AUDIT: a default-off audit of command buffers freed or reused while pending
A GPU hang on Iris (ANV) left a compute dispatch reading an interface descriptor that another pass's viewport state had overwritten: the hung command buffer's dynamic state went back to ANV's pool (a reset or begin) while its request still ran. The path that freed it is not known yet. This adds a diagnostic that finds it where it happens, against the GPU's own timelines rather than what the host saw of them. What it checks, where it is on (DeviceOptions::pending_audit, or METAL2VULKAN_PENDING_AUDIT set, read at device creation): - every vkBeginCommandBuffer made through the device's functions (Vk's begin_command_buffer, in both the full and the exit guard's tables), a primary begun ahead in a spare pool among them; - each vkResetCommandPool of a spare pool, and each pool given back to the spares, for every command buffer the pool made; - each submission of a command buffer submitted before and not begun for simultaneous use (ANV rewrites a chainable primary's tail at each submission). What carries a command buffer: a batch's submission (direct or held in the scheduler's group) to its queue's timeline value; the device's own and the staging queue's submissions to their timelines; a secondary through each primary that executes it (Vk's cmd_execute_commands notes it, a begin of the primary forgets it). A failed submission is withdrawn. Each check reads the carrying timelines with vkGetSemaphoreCounterValue; a value not reached is a finding, logged (id name metal2vulkan-pending-audit, Info) with the thread, command buffer, timeline, counter and value, and a backtrace for the first 8. Off, each site tests an Option; on, it changes no work. Tests: tests::pending_audit (the ledger: timelines, latest value per timeline, one read per timeline per check, secondaries through primaries, withdrawal, unreadable timelines, simultaneous use), and the device test tests::pending_audit_device: a command buffer held on the GPU by a wait for a reserved event signal has its pool given back early (a cfg(test) hook); the audit finds it once and says it; after the host signal, the next command buffer's pool reset, the primary begun ahead and its taking are checked and nothing more is found. env_vars.rs registers the variable with its cost; docs/API.md and api_signatures.tsv carry the option. Verification: pending (potluck jobs on lavapipe and Iris). (cherry picked from commit 2c524391e70921596add39688daf761cbc20662f)
This commit is contained in:
1 parent
26f4338e93
commit
6ee9db2b60
18 files changed
+931
-7
No files matched your search
+10
@@ -1631,6 +1631,16 @@ texture's image of its stored frame and its twin, a two-plane extended-range tex
|
||||
depth or stencil texture's tiled twin over a surface plane, and a YCbCr texture's converted image
|
||||
and render shadow. A heap texture's shadow, a view's shadow of an image and a texture buffer's
|
||||
staging are not logged.
|
||||
With `METAL2VULKAN_PENDING_AUDIT` set (or `DeviceOptions::pending_audit`), a device checks, at each
|
||||
`vkBeginCommandBuffer`, each `vkResetCommandPool` of a spare command pool, each command pool given
|
||||
back to its spares and each submission of a command buffer submitted before (one not begun for
|
||||
simultaneous use), that the GPU completed every submission that carries the command buffers
|
||||
concerned: a batch's, the device's own and the staging queue's, to the timeline value each signals,
|
||||
and a secondary through each primary that executes it. It reads those timelines
|
||||
(`vkGetSemaphoreCounterValue`) and logs each command buffer found pending (id name
|
||||
`metal2vulkan-pending-audit`, `Info` severity): what was done, the thread, the command buffer, the
|
||||
timeline, its counter and the value, with the thread's backtrace for the first 8; and a line as the
|
||||
device is made and as it goes, with the checks and findings by kind. It changes no work.
|
||||
Whatever the variables, a placement heap's `newTextureWithDescriptor:offset:` that makes no texture
|
||||
(`Nil` or `OutOfMemory`) at an offset inside the heap says so (id name
|
||||
`metal2vulkan-heap-texture-refused`, `Info` severity): the descriptor, the offset, the heap's size,
|
||||
|
||||
Reference in new issue
Block a user