A consumer that makes some notices fatal (reims-vgpu's ReleasedCommandState,
PrivateResourceOption, HostDeallocatorDelayed) could not tell which command
buffer a notice was about: a ReleasedCommandState announced at a host step on
the scheduler's steps thread ended its whole VM. Now every notice carries the
ID of the command buffer whose work the runtime was doing on the announcing
thread, so the consumer can fail that one command buffer.
What changed:
- CommandBuffer::object_id: an ObjectId, minted at the command buffer's
making from the process-wide count buffers, textures and heaps use.
- DegradeNotice::command_buffer: Option<ObjectId>, read at the notice's making
from a thread-local scope (degradation::NoticesFor), as `call` reads the
call being lowered. The scope is set where the runtime holds the command
buffer and does its work: the compute and blit encoders' logged funnels and
their other recording calls and ends, the render lowering's at-call funnel,
its unit calls, its batches' lowering (on the lowering thread or a drain)
and its end, the resource state encoder's calls, encoder openings, the
commit (at the call or queued behind a render end), a batch's submission and
the storage-form settle that rides on it, host steps, a rebind's encoding
again, and GPU-time reads. Nested scopes name the innermost.
- None, explicitly, for a recovery of the device (device-recovered), for
grouped-completion (several command buffers' batches), and inside the
program's code the runtime calls (exit_guard::program, indirect command
checks, executed-commands handlers).
- A bind's memoized notices, announced again at each later bind under
announce_each, are named as that bind's: its command buffer and the call
being lowered (the call was the first bind's before; same mechanism).
- ObjectId docs, docs/API.md section 9, docs/RUNTIME-PORTING.md; API
signatures re-blessed (two records: the field and the method).
Tests (runtime crate, device tests):
- notice_command_buffers: an ICB execution recorded at a host step announces
released-command-state on the steps thread naming the executing command
buffer; its commit's host-replayed-indirect-commands, on the program's
thread, names it too; private-resource-option of an ICB made between the
encoder's calls names none.
- deferred_calls: the call-naming test also checks the command buffer under
both lowering policies; a new test waits for the lowering thread to announce
unsized-points after end_encoding and checks the thread, call and command
buffer, and that a device notice between the encoder's calls names none.
- vertex_conversion_notices: a memoized bind notice (device-nan-encoding)
announced at a second command buffer's draw names that command buffer and
its own call index, with bound_notices_made proving the memo was reused.
(cherry picked from commit b4c2ba83ea726229f129a405ce6f432b0bdb0127)