Files
metal2vulkan/docs
Anees Iqbal 4b88203551 rt: a texture over a Managed buffer's device copy that the device's linear image does not take is copied at Metal's Managed events
Where the device's linear image does not hold a texture over a Managed buffer's device copy in
place (another pitch, an offset off the image's memory alignment, a format or usage the linear
tiling lacks), the texture was refused (Gap::TextureOverBuffer). It is now an optimal image of
its own, copied from and to the device copy only at Metal's own Managed events, with no tracking
of commands:

- in, from the device copy, by the upload that leads the next submission using the texture,
  where a did_modify_range met its range (after the upload's copy of that range) or submitted
  device work wrote the buffer (a binding whose compiled interface writes it: the translator's
  uses, not the declared access; a blit or fill into it) or another texture over a range that
  meets its;
- back, where device work wrote the texture, before the next reader of the device copy (a
  binding that reaches the buffer, a blit from or into it, a copy into another texture over a
  range that meets its, a synchronize_resource, a did_modify_range over it). A reader recorded
  after the write takes it in its own commands; the upload that leads a submission, which runs
  before the submission's commands, takes it only once the write's segment was submitted
  (Segment::managed_wrote; the segment's submission settles each write it made).

The buffer keeps each such texture's entry (ManagedOvers). A texture released while its copy
back is owed leaves its image with the buffer until a reader takes it or the buffer is released;
a lookup by id skips a released entry, whose id a texture made since may hold. The Shared rules
(crate::over's per-submission copies) now apply only to textures over a buffer of no device copy
(copied_shared). The planner ruled that Managed keeps its device side; this is that side's copy
form.

Tests (device cfg): the Managed device test (100 uses copy in once; a modify over the range
copies once, one outside it not at all; a kernel's write owes one copy, a read none; a written
texture read through its buffer by a blit; a synchronize; two textures over one range; a
released texture whose buffer goes copies nothing back and frees its image; one released before
a kernel reads its buffer goes back first), and a kernel that declares a Managed buffer
read-write and never touches it owes no copy. README, Gap::TextureOverBuffer's doc and
docs/REFUSALS.md follow.

Verified: lint m3-max-44117 and device legs m3-max-44136 (780M HawkPoint, 3090), 44137 (RX 550),
44138 (XTX, 2080, 780M Phoenix, lavapipe), 85/85 each with the validation layer on, on the same
tree based on ed6d11d477. The Managed tests ran on the six GPUs and took the Shared rule on
lavapipe. An earlier form, which marked a write's copy back owed at its encoding, failed the last
step on five GPUs (m3-max-44101, 44102, 44103): the upload leading the write's own submission
took it before the write ran.
2026-11-17 20:47:55 -08:00
..