copy_take answered Now for a gather over a chunk not imported yet whenever
its ranges, joined where under 2 MiB apart, were at most 16 and none was
the whole chunk. The copy then imported those ranges alone on the encoding
thread. With runs scattered over a chunk, the joined ranges cover nearly
all of it. On the RTX 5080 Laptop GPU a 24 MiB cache of 2,477 runs over
five chunks, its runs joined where under 1 MiB apart, pinned 317 MiB in
61 ms (irisperf's first-fill bench), where the CPU copied the same runs
in 2.8 ms. The bench's first call took 105 to 107 ms with import waits of
0, so the staged path (RT 1893) never ran: it covered only gathers that
would otherwise wait. The consumer's mid-playback fills of new 4K
surfaces took 3.4 to 327 ms with one clip and 1.4 to 2.1 s with three.
Now, on a plan that is not listed and with the device's thread running,
a gather over such a chunk is ThroughCpu however few its ranges. It is
staged through the command buffer's arena, filled by the CPU at its
batch's host step, and the chunk is asked of the thread. A gather the
CPU path cannot take (its bytes possibly written by another use, no
staging memory) still takes the imports' path. So do scatters and
listed plans, as before.
Docs: copy_take, the copy module's first-touch bullet, the staging
check, and HOWTO's copy section.
Test: host_ram_copy_device::a_first_gather_of_few_ranges_imports_nothing_on_the_encoding_thread.
It gathers three pages within 2 MiB in one chunk and one in another,
which before this change was an import of the ranges alone. It asserts
no run import is live once the gather is encoded, the gather is staged,
it waits for no import, and it reads the pages. The negative control is
the old match order; it should fail on any device without
AliasedImportBlitsUnordered. Not run yet.
(cherry picked from commit 3dbab04a5849524c694c74aaea52b776cbef6dd2)