Files
metal2vulkan/docs
Anees Iqbal 53501197a8 Host RAM: an object across two imported chunks is a copy, never a second import
A no-copy object whose pages cross the end of a guest RAM's chunk, the chunks on both sides
imported, is bound in neither: route_runs answers Runs, and the object took the gate's path
and imported its own pages, the same host addresses as the two live chunk imports
(VK_EXT_external_memory_host leaves that undefined; imports_inside_live counted it). The
consumer's walks hit it at boot on the 2080 and the 3090: a 2 MiB heap from 0x3f22000 into a
64 MiB chunk, 0xde000 bytes in the first chunk and 0x122000 in the next.

Such an object, and one over a live chunk's pages that no resolver routed, is now a copy of its
pages (CopiedBecause::OverRamChunk, counted in copied_over_live_imports, announced as
copied-host-pages, the gate not asked), at its making and at a heap's rebind. Chosen over:
- aligning chunk imports to objects: the chunks are imported ahead, before the objects over
  them exist, and objects lie anywhere;
- one import over both chunks: each chunk's import already binds objects when the straddling
  one comes, and swapping it would move every bound object;
- a sparse binding of both chunks' memory: heaps place resources at any offset, and not every
  device binds sparse buffers.
A copy costs one copy of the object's pages per commit, the rare edge object alone (one per
chunk end an object crosses).

Test: a_heap_across_two_imported_chunks_is_a_copy_and_imports_nothing (the consumer's shape:
both chunks imported by a buffer each, then a 2 MiB heap from 0xde000 before the first chunk's
end): one copy, no pointer import, imports_inside_live 0, the gate not asked; a buffer placed
across the chunks' end reads the RAM's bytes and a fill through it reaches them.
2026-11-11 21:20:02 -08:00
..