A consumer's frame executes the buffer and then encodes it again. After an
execution kept its chunks' recordings (kept_commands.rs), each CPU write
forgets the chunk it lies in through KeptChunks::wrote. With the --kept flag,
the compute row now also times its encoding in that state. Before each
repetition, untimed, a compute encoder executes every command twice, each
time in a command buffer that is committed and waited for. The second
execution runs every chunk from the first's recordings, and the bench prints
indirect_chunks_kept for each second execution. This mode submits GPU work;
the other modes still submit nothing.
Verified on the M3 Max (MoltenVK, release) under maclock, one run, median of
6 repetitions x 16384 commands, every second execution running all 64 chunks
from kept recordings:
- parent e3444f3273: compute command 10187.8 instructions (589.3 ns), after
the kept executions 13788.8 (826.3 ns); a set_kernel_buffer pass after them
2728.2 a call.
- df69cd7b7a: compute command 2528.7 (163.4 ns), after the kept executions
6140.9 (406.7 ns); set_kernel_buffer after them 1168.2 a call, against 441.1
with nothing kept.
Both sides pay about 725 instructions more per setter while chunks are kept:
KeptChunks::wrote's retain walks over the kept chunks and the stepped set. That
is the figure to compare a one-store invalidation against.
(cherry picked from commit ac8eae71c9d063369c6568a2b38fb2fd30e22f47)
(cherry picked from commit 2c542021bff8d4bb7f500b63e69cf35e6005bf3c)