Files
metal2vulkan/docs
Anees Iqbal 8c3fae2243 replay: the rt arm plays guest-RAM copies in the host's one-copy form
The new runtime's backend played a copy back to the guest's RAM as one
buffer copy per run, word-widened, in the guest's own blit encoder, and a
copy from the guest's RAM as one copy per piece in that encoder. The host
does neither: on the new runtime every staged fill and download is one rt
buffer-to-buffer copy, since rt answers no linear row pitch. In f355 of
the syncview stream the per-run form made 8,029 copies from 28 calls,
with a barrier pair each, which the host never makes.

Now each call is one copy, in a command buffer of the backend's own on
the call's queue, through a Shared scratch of its own (new module
new_runtime/guest_ram.rs):
- copy back: one copy of the whole words the runs span, committed just
  after the call's command buffer; a wait for that command buffer waits
  for the copy too (the guest sees its RAM written when its command
  buffer completes), then the CPU copies each run out of the scratch;
- copy in: the pieces gathered on the CPU into the scratch laid out as
  the bytes they span (gaps and edges from the target's mapping), one
  copy committed just before the call's command buffer; into a buffer
  with no mapping, one copy per run of touching words, so no gap is
  written.
Surface texel copies stay in the guest's blit encoder. The work is
counted apart as the stand-in (guest_ram_* counters, guest_ram_gpu_nanos
for its command buffers' GPU time, outside gpu_busy) and the report's
"guest RAM: copy-back played in the one-copy form" line. The old arm is
unchanged. staged_guest_ram_bytes and copied_back_guest_ram_bytes give
way to guest_ram_fill_bytes and guest_ram_download_bytes.

Tests: the copy-back device test now expects one copy of 100 bytes and
two runs copied out; a new device test plays copies in to a Shared and a
Private buffer and reads both back. docs/REPLAY-STREAM.md section 10
describes the form.
2026-11-19 08:01:21 -08:00
..