An indirect command buffer's records live in Shared host memory by design (the host step reads
them on the CPU, and plain Metal lets the CPU write a Private ICB's commands), so a blit's reset
of a whole ICB was a vkCmdFillBuffer over every record across the link: on the consumer's Modern
Rendering sample (45k commands, 101 MB of records) 56.9 ms of GPU time a frame on an RTX 2080
over PCIe x4, against 0.26 ms for the same fill in device-local memory, while the sample writes
~1.3k commands a frame.
Each command now has a u32 written flag in an optional tail after the records (16 +
capacity*2248 + 4*i; CommandBuffer::initialize and decode unchanged). The lowered encode
operations and copy_command store 1 through the contained wide_at (no tail: the sink; a faulting
operation stores nothing); the CPU setters and edit mark it, and a CPU write of the reset record
(reset_with_range) clears it; a blit copy fills the destination's flags with 1. A blit reset is
one dispatch of the new owned kernel bind::icb_reset_module per run of commands, a workgroup a
command that zeroes a flagged record with 8-byte stores and clears its flag; the overflow clear
stays a fill. The carry copies the whole storage, flags included; a lost carry rewrites the header
and zeroes the flags.
Verified (radvcompile, at 273dbba28c on 045c6fedf9):
- 2080 (26425, 26442; 45k commands): old reset 56.8-56.9 ms in every shape; flagged reset 0
written 0.256 ms, ~1.3k written 1.736 ms, all written 60.47 ms (+6.5%: 8 bytes is the widest
store every record allows; recorded in blit_indirect.rs "What a reset costs"). A culling-shaped
encode kernel (45k render commands, 3 operations each): 19.80 -> 20.11-20.16 ms.
- msi 26494: engine and interpreter round trips with flag asserts and the reset kernel's tests
59/59, runtime unit tests 1536/1536; clippy workspace all features, each feature alone, runtime,
--cfg m2v_gpu all 0; rustdoc -D warnings and the API reference check 0.
- RTX 5080 (26478, the change before the rebase): 281/282, both new device tests passing
(a_reset_resets_what_each_writer_wrote_since_the_last on the host step;
an_execution_on_the_gpu_alone_runs_what_a_reset_left); the one failure, a getter test's old fill
count, fixed in this commit. Negative control (26505, the kernel's flag store removed): both new
tests fail. A device rerun at the landing tip is queued.
SEMANTICS_VERSION 2096 -> 2097 (the lowered encode operations store the flag), RUNTIME_VERSION
2238 -> 2239.