What: did_modify_range (and a CPU write through a texture over a buffer) notes the range on the
device (managed.rs Modified); every commit, at its start and before it returns, copies each
noted range of a buffer with a host copy on the CPU into staging buffers as the host copy holds
it then (Buffer::upload_now, CallerCopy::copy_in_now, managed_copy::stage_in), which the next
submission copies into the device copy before any of its commands. A range the staging buffers
find no memory for falls back to the copy from the host copy as the submission runs.
Why: the copy in read the host copy (the caller's pages through their import, or the runtime's
own host copy) when the GPU ran it, so a CPU write made after the commit, before the GPU reached
the command buffer, was what the command buffer read. Metal on a Radeon Pro 5300M (macOS
26.7.1, reims's oracle) takes the bytes at the commit after didModifyRange: a write before the
commit (after the call, or with the command buffer encoded before it) is read, one made 30 ms
after the commit while the GPU spun is not. Capturing at the call would be wrong (steps 2 and
3 read the later write there). An RX 7900 XTX computed frame 0 of a benchmark on frame 1's
input this way.
Docs: managed.rs and managed_copy.rs state the rule and its cost (a CPU copy of the range's
bytes at the commit); API.md, the runtime README and FAST-PATHS.md's managed row follow.
managed_bytes_copied_in counts a caller copy's copies alone, as before.
Verified: the lane test of the parent commit on an RTX 3090 (job ids in the report).