A recovery carries indirect command buffers, visible function tables and argument encoders; one test over every kind

What: a device's recovery now carries the three kinds a program makes that it left the lost
generation's, so each is the same object on the new VkDevice, as Metal keeps its objects:
- An indirect command buffer (`indirect_command_buffer/carry.rs`). Its records' storage and its
  slots past them are buffers of the runtime's own whose `contents` pointer no program holds,
  carried as such (`Buffer::carry_runtime`): in the runtime's own pages, the same pages and the
  records as they are; in pooled host-visible memory, new memory, the records lost with the
  VkDevice (vkspec 5.2.3), written again as a new buffer's: its header, every command reset.
  The program each command's state runs is the state's program there (made by the state's
  carry, after it), or a released state's made again there, as are the programs it keeps for
  GPU-written records (`released_programs.rs`); its kept chunk recordings go; the new
  generation's keepers list it where the GPU may write it. Its records ID, address,
  gpuResourceID, uniqueIdentifier and label are the line's and stay.
- A visible function table (`function_table/carry.rs`), after its pipeline state: its words
  buffer carried the same way; where it went to new memory, the words written again from a
  host copy the table now keeps of what the CPU wrote (`TableShared::writes`), so its entries
  call what they called; listed among the new generation's tables. A table whose state stays
  the lost generation's stays with it.
- An argument encoder: it holds no Vulkan object, so its device becomes a `LineDevice`, the
  handle carried; `ArgumentEncoder::device` answers the generation handle by value (it answered
  a borrow).
The registry keeps both buffer kinds weakly (`Carry::indirect_command_buffer`,
`Carry::function_table`), the recovery carries them after the pipeline states, and its notice
counts them (`", and N indirect command buffers, M of them whose records were lost (every
command reset)"`, `", and N visible function tables with their entries"`). The docs of what a
recovery carries and leaves say so: `RuntimeGap::MadeBeforeRecovery`,
`Degradation::DeviceRecovered`, docs/API.md, the runtime's README, `device/carry.rs`.

Why: after a 3090 recovery, `resetCommandsInBuffer:withRange:` on an indirect command buffer
made before it was refused (`MadeBeforeRecovery`) thousands of times and every later command
buffer of the pass failed, where Metal's buffer goes on. The whole class at once: every kind a
program can make, each with its carry status, was listed for the change (none other was left
uncarried that holds only what the program could make again; sparse heaps and textures and
pooled `Shared` buffers stay left, as documented).

Test: `device_recovery_every_kind::every_kind_of_object_made_before_a_recovery_serves_after_it`
makes one of each kind (a queue, a `Private` buffer, a heap and a placed buffer, a texture, an
event, a shared event, a fence, a sampler state, a depth/stencil state, a library and function,
a compute and a drawing state, an address pool, a rasterization rate map, a binary archive, a
dynamic library, an indirect command buffer of dispatches executed before and one of draws, an
argument encoder, a visible function table called before), recovers, uses each on the next
generation by command buffers that complete (the indirect buffers reset by a blit and encoded
again, the table called and set, the encoder writing), and ends with the lost VkDevice gone
while all live. Helpers made `pub(super)` in the pipelines and states recovery tests.

Verified, at the change on a0b85d89d4: the every-kind test passes on lavapipe (msi, nextest, one process a
test, with the 41 other recovery, indirect-command-buffer and released-program tests), on the
Radeon 780M (RADV) and the Iris Xe (ANV), 42 of 42 each, and the RTX 3090 (41 of 42: the exportable test's
DmaBuf re-export inode, which development fails the same way there). Its negative control, the
product's sources at bfcd63c5e2 and the test kept, fails at the notice's count of the indirect
command buffers (lavapipe). The validation lanes `function_tables` and `argument_buffers`
(the argument encoder's device): 28 of 28 on the 780M, the Iris Xe and the 3090. Clippy of
the runtime, validation and conformance (all targets and features, --cfg m2v_gpu and
m2v_gpu_hazards): no message. The API signatures check passes (`ArgumentEncoder::device`
blessed); docs/REFUSALS.md is unchanged.
This commit is contained in:
Anees Iqbal committed 2026-11-13 00:37:07 -08:00
1 parent ce6bc460cf
commit 2c21b3e6f1
20 files changed
+903 -88

No files matched your search

+6 -4
View File
@@ -3721,18 +3721,20 @@ bound.
which of the two, and was parked: never destroyed, its queues never waited for
(`Device::is_parked`). `Device::recover_for_test` runs the
same recovery with no GPU fault. Cost: the events, fences, depth/stencil states, libraries,
functions, dynamic libraries, binary archives, address pools, rasterization rate maps, uses of
guest RAM, no-copy
functions, dynamic libraries, binary archives, address pools, rasterization rate maps, argument
encoders, uses of guest RAM, no-copy
buffers, `Private` buffers, buffers in the runtime's own pages (fresh pages, and the blocks of
pages the `Shared` and `Managed` buffers lie in where the device's checks found a held host-page
import costs its submissions nothing and textures over such pages take what they take over its
own memory), `Private` heaps and heaps over the caller's memory with the buffers and textures
placed in them, textures of `new_texture`, textures over the buffers carried and views of them,
and pipeline and sampler states made before it go on, the contents of a `Private` buffer or heap
pipeline and sampler states, indirect command buffers and visible function tables made before it
go on, the contents of a `Private` buffer or heap
lost (it reads zero) but an exportable buffer's, re-imported over its own memory, which keeps
whatever that memory holds, and of a texture of `new_texture` or of a `Private` heap of any
storage mode (it reads as a new one) but a texture buffer over its texels' buffer carried, a
heap over the caller's memory and what is placed in it reading the same pages; the other objects
heap over the caller's memory and what is placed in it reading the same pages, and of an indirect
command buffer's records outside the runtime's own pages (every command reset); the other objects
made before it are refused (`MadeBeforeRecovery`), where Metal's go on; the calls during it wait
for it, and a device call the loss met while it ran runs again after it. A no-copy buffer is
made again over