Files
metal2vulkan/docs
Anees Iqbal 5458ac7954 validation: a check or dump of a buffer with two copies names the copy it read
A two-copy stream's Managed buffer has a CPU copy, which Metal's contents answers, and a device
copy, which commands read. The player's check and dump read the CPU copy (Backend::read on the new
runtime), and nothing said so: on a discrete card, two plays' dumps of #106455 agreed as CPU copies
while the device copies the kernel read differed (count word 1848 against 12), and the verdict
'inputs equal' rested on them.

Now a check line of such a buffer ends '(CPU copy)' or '(device copy, read back)', a dump holds
cbC-objO.copy with those words, and compare-dumps compares only the same copy of both plays,
reporting 'copies differ' otherwise and counting the buffers compared as CPU copies and as device
copies in its summary. The new runtime's play reads the device copy with --read-device-copies yes:
through a blit into a Shared buffer of the play's own where the runtime keeps one, through the
buffer's mapping where the device's one copy is the GPU's and the player keeps the CPU's. On a
device that keeps a device copy, the report's 'managed digests' line after its device line says
which copy the play reads. Backend::read_copy names it; the old runtime's backend names none.

Tests: a_read_of_a_buffer_with_two_copies_says_which_copy_it_took (no device: both labels in the
check lines and dumps, the compare of like and unlike copies) and, on a device,
a_check_of_a_managed_buffer_names_the_copy_it_read (a blit's fill reaches the device copy: the CPU
copy reads zeros, the device copy read back reads 7s; the header line where the device keeps a
device copy). docs/REPLAY-STREAM.md section 10 says it.
2026-11-19 20:00:32 -08:00
..