Files
metal2vulkan/docs
Anees Iqbal 042ec0a481 Keep a host step's recordings of GPU-written render commands, compared with the records
A host step of a render execution whose records the GPU may write recorded every command at
every step: about 12 to 17 ms for the replayed-frames page's 5000 indexed draws on the M3, every
frame, though the page's records are the same bytes each frame. The step now keeps its chunks as
commit keeps the CPU's (render/executions/kept.rs, kept_commands.rs): from a chunk's second step
on it records the chunk apart into a context of its own and keeps it with a copy of the bytes of
its records; a later step runs the kept recording where the records hold those bytes now,
compared whole, and its key is equal, and records it again otherwise. No write forgets such a
chunk: the comparison decides.

The key is everything the recording reads beside the records: the RenderKey commit's chunks use
(inherited pipeline state, pass shape and layout, encoder state, scissors, amplification,
attachments among the resident resources, the resident set compared whole once a list), plus the
inherited tables' buffers by key with offsets and attribute strides (new: commit's chunks need
tables that bind nothing), plus KeptChunk::runs_again's checks (each address named resolves as it
did, no no-copy buffer moved, nothing detached, everything held alive). The step keeps only where
the commands inherit the pipeline state and the inherited tables bind buffers alone; a record
barrier makes its chunk not plain instead of ruling the execution out. Its chunks draw in the
large-buffer form, as the step's other draws do. The step's round trip stays: the records are
known only once the work before them completed.

Counters: WorkCounts::host_step_chunks_kept, host_step_chunks_recorded_again,
host_step_records_compared and host_step_compare_nanos (api_signatures rows added). The
replayed_frames lane prints them and a hash of the target's pixels per frame (a blit copies the
target out); the new kept_steps lane changes one input at a time (the records the GPU wrote, the
inherited buffer and its offset, the inherited state, the scissor, the resident set, the buffer
an index address names at the same address, the inherited no-copy buffer's pages) and checks a
re-record, the pixels of a page that kept nothing, and keeping again after. FAST-PATHS' entry on
kept recordings states the host step's.

Verified: cargo check and clippy -D warnings, all features, plain and --cfg m2v_gpu, for the
runtime and validation crates; api_signatures/api_surface 15/15; fast_paths 19/19; the runtime's
kept and indirect-command unit tests 32/32. The device tests (kept_steps, replayed_frames,
the ICB lane modules) are not run yet.

(cherry picked from commit 9b3d13a6d22fba484cce4923fd87ad503f7bc060)
2026-11-05 02:08:23 -08:00
..