Files
metal2vulkan/crates/metal2vulkan-runtime/src/host_ram
Anees Iqbal ca357bf6fa HostRam copies: a copy's chunk ranges made once, the widest gaps selected, and lists searched only where they span the bytes
The surface fill bench on a Radeon 780M put a 7,261-page gather's encoding, besides its lists'
imports, at 2.5 ms for a first fill, 1.7 ms over lists kept and 1.4 ms over chunks imported by
pointer, and a profile of it put most of that in the copy's own per-page work:

- each chunk's ranges of the copy were sorted and joined three times (the staging check, the
  uses, the imports); they are made once, the uses' at most 16 derived from them;
- joining a chunk's ranges to the most the uses name sorted every gap between them to keep the
  widest; a selection keeps the same ones (of two as wide, the first) in one pass;
- each of the copy's runs was searched for by halves in every kept list, and each piece in every
  import of its chunk, though each list holds pages of one band of the RAM's addresses: a list
  whose span (its first run's start to its last's end) misses the bytes is passed at once.

No answer changes: the same ranges, gaps, lists and offsets are found.

(cherry picked from commit 3b1bc11f37ebfbc24eb0c2cb6c698cc57b5c32f8)
2026-11-08 17:12:51 -08:00
..