Vulkan's memory aliasing asks that an image over bytes another resource wrote move from
VK_IMAGE_LAYOUT_UNDEFINED before it is used. rt moved a heap texture only once, at its making, so a
device that keeps a compression state beside an image's bytes read the alias's state: on the Iris
Xe (ANV, Mesa 26.2.6) a 512x512 RGBA16Float array written through a 2D view after eight aliased
arrays read 8152 of 262144 texels wrong (job m3-max-71690, the test c26698712c).
The form (crate::alias):
- Each heap texture and heap buffer is a Place, linked at placement with the placements of its heap
whose bytes meet its, both ways and weakly; a release drops its links. A placement with no links
pays one test at each use.
- A write of a placement makes its links stale. A stale texture's next write moves its whole image
from undefined to home, in one barrier from every command's writes to every command's reads and
writes. Reads move nothing; a buffer is never moved. A declared write counts as a write.
- Inside a command buffer, encode order is run order: Building's marks keep each touched
placement's state (fresh, stale, untouched) and the segment its commands last read it in. A write
of a stale one moves in place: before a dispatch, a pass's begin or a blit; inside a rendering,
through the pass's interruption.
- A write of an untouched one adds a check at its segment's head; where the segment read one of its
links before, the segment ends first. The submit thread resolves a segment's checks as it stages
it, in the order the device's one queue runs segments (so a command buffer committed out of its
encode order, or held by an enqueue, is decided where it runs), recording the moves owed into a
command buffer of the cb's recorder staged just ahead of the segment's, in its submit info and so
its vkQueueSubmit2; then it applies the segment's writes. A failed record loses the device as a
failed submission does.
- A texture placed over another's bytes is stale from its making, and its making move waits for
every earlier write (ALL_COMMANDS / MEMORY_WRITE in place of NONE).
- Metrics::heap_moves counts the moves, in place and leading.
No upload piece: a heap texture sits on a Private block and Metal gives a heap's textures the
heap's storage mode, so no Metal-valid replaceRegion reaches one (TextureBytesPrivate).
The README's gap line now says what remains: a read of a stale texture, writes rt cannot name, a
declared write taken whole, the making move's effect on a live alias's bytes, the move's whole
image, and a draw's check at the head of its pass's segment.
Tests: src/tests/alias.rs holds the state machine on every device of the cfg (commit order against
encode order, the segment ended before a check behind an alias's read, moves in place, a draw's
write through the pass, apart placements with no check or move); the red test is
heap_alias.rs's array test. Gate and device runs follow in the next commits.