A gather staged through the CPU (31e642ecc2) took its region of the
command buffer's arena on the encoding thread. A region over 32 KiB is a
chunk of its own: fresh pages imported by pointer on NVIDIA, about 2.3 ms
plus 0.25 ms/MiB, and more where the import thread allocates at the same
time. On the RTX 5080 the contended fill bench's first call took
52.8 ms, of which checks, pieces and the staging decision were 0.3 ms.
The gather is now a Deferred::GatherStage whose batch's host step does
all of its work: it takes the region, fills it by the CPU from the
pages, and records the vkCmdCopyBuffer into the buffer at the copy's
place. Like the staged scatter's GPU copy, it is recorded at its step
(records_at_its_step). Its uses are noted at the call. It still waits
for the work before it where the GPU may write the pages
(Deferred::steps_after_the_gpu_now, read by step_waits).
StagedFill becomes StagedGather. The command buffer's staged list,
staged_unfilled, fill_staged and State::next_encoder go: segments
carry it all now.
A rebind's encoding again replaces a staged gather's segment with a copy
through the imports: Segment::records_again and splice_replay take it
(recorded_by_an_encoding_again). So an encoder with a staged gather
keeps its log, as before.
Tests (host_ram_copy_device, device tests):
- Every staged copy test asserts that the encoding took no staging of
the arena (Uploads::bytes below the copy's bytes).
- a_rebind_before_the_first_submission_encodes_a_staged_gather_s_encoder_again:
a staged gather and a fill of a no-copy buffer over a page outside the
RAM, in one encoder behind an event wait. The buffer is rebound after
the commit. The command buffer completes with no error, the encoder
encoded again once, the fill lands in the new page, and the gather's
bytes are in its buffer.
Not yet verified; the gem10 checks follow this commit.
(cherry picked from commit 0f60b71653f9f7dfe9eaba18976c21eb75dd696d)