Owner 3406 follow-up to L212. A copy between two buffers whose ranges meet
in one block was refused (Refusal::BufferCopyOverlap, basis "ours"). Two
buffers placed over each other in a heap are aliases. Metal's validation
names copies between buffers among the defined copies between aliases in
a placement heap (job m3-max-81493), and plain Metal on an Apple M3 Max
gives memmove's bytes for them (probe overlapping_alias_copies.m, job
m3-max-81544).
Form (blit.rs):
- buffer_to_buffer takes whether the two are one buffer and answers
BufferChunks.
- Ranges apart are one chunk.
- Two buffers' ranges whose bytes meet are chunks no longer than the shift
|to - from|, the last chunk the rest. The chunk at the end the shift
points to goes first: the last first where the destination lies past the
source, else the first. So no command's source and destination share a
byte (VUID-vkCmdCopyBuffer-pRegions-00117, which each one-region command
meets on its own), and no chunk reads a byte an earlier one wrote.
- copy_from_buffer_to_buffer records one vkCmdCopyBuffer a chunk with the
slabs' execution barrier (between) between two, each counted as a blit
barrier. Every hazard between two chunks is a write after a read.
- Two ranges on the same bytes copy nothing.
- One buffer's overlapping ranges stay Refusal::BufferCopyOverlap. Its basis
is now metal-documented: Apple's page for the copy allows the same buffer
only "if size is less than the distance between sourceOffset and
destinationOffset". The conformance case buffer-blit-overlapping-copies
is one buffer, so its ledger row holds. Only its note's wording changed;
coverage.py regenerated with no change.
- A shift of n bytes takes size/n commands, rounded up. That is the fewest
any form without an intermediate takes.
Unit test a_copy_between_buffers_takes_ranges_inside_both_and_cuts_two_buffers_bytes_that_meet
(renamed) expects the chunk orders both ways, a partial last chunk, and
nothing for the same bytes. The rest of its cases are unchanged.
Docs: the copy's doc, BufferCopyOverlap (REFUSALS.md and basis.rs
regenerated), the runtime README's blit encoders, the tests' module doc.
Verified: refusal_surface.py --check exits 0. Green under the validation
layer, which fails a test on any message, so each one-region chunk met
VUID-vkCmdCopyBuffer-pRegions-00117 on these devices: the 27 blit tests pass
on lavapipe (llvmpipe, LLVM 23.1.4; job m3-max-81597), the AMD Radeon 780M
(RADV PHOENIX; m3-max-81592), the NVIDIA GeForce RTX 2080 (m3-max-81600) and
the AMD Radeon RX 7900 XTX (RADV NAVI31; m3-max-81671). The runs built the
series before its rebase onto development; the patches are the same.