Files
metal2vulkan/docs
Anees Iqbal dcac15a5c6 RUNTIME 2449: Host RAM: a rebind encodes the encoder of a gather staged past the imports again
An encoder that left a gather from a guest RAM staged through the CPU
kept no log (Unlogged::Segments) where an encoding again could not copy
the gather through the imports in its place: over a chunk that takes no
import while it runs (Staging::cpu_only: a chunk the device refuses, or
one an object's own import of its pages holds back), or in a part of its
own after the GPU completed the work before it (Staging::after_the_gpu:
a copy into those chunks was recorded, or a buffer over host pages lies
over the bytes), which a copy through the imports would not start. A
rebind, before the command buffer's first submission, of a buffer over
host pages that encoder used then failed the command buffer with
EncodedUseRebound, where Metal runs it over the new pages.

Now such a gather is staged again as its first encoding staged it, as
RUNTIME 2448 does for a staged scatter: HostRamCall::staged_again answers
the first encoding's Staging for a gather that is not
Staging::through_imports (StagedGather::encoded_again_through_imports),
and Deferred::left_again_by_an_encoding_again answers for such a
GatherStage, so the encoder keeps its log, its place takes the encoding
again, and finish_replay leaves the step for its host step. Every other
staged gather is copied through the imports by an encoding again, as
before (Deferred::recorded_by_an_encoding_again).

Unlogged::Segments now names a GPU-written indirect dispatch's host
step, a scrub, and a shadow's copy in left to its batch's submission
(shadow::GatedCopyIn, which no Segment::records_again test holds
either; the doc did not name it). Docs: host_ram/copy.rs (First touch,
the gather; Staging; StagedGather), deferred.rs, encoder.rs,
reencode.rs, rebound_use.rs, and docs/HOWTO.md's two sentences on a
gather's rebind.

Test: host_ram_copy_device's
a_rebind_before_the_first_submission_encodes_a_gather_staged_after_the_gpu_again,
on the shape of a_first_gather_over_chunks_a_scatter_wrote_waits_for_no_import
(each chunk import held in flight 300 ms by making_pause): one encoder
scatters into scattered pages, gathers them back (staged after the GPU,
the scatter having written the chunks) and fills a no-copy buffer,
behind a shared event; the buffer is detached and rebound before the
signal. Asserts the command buffer completes with no error, the first
encoding staged both copies, the rebind encoded the encoder once and
staged both again, the fill is in the new pages alone, the RAM's runs
hold the scatter's bytes, and the gather's buffer holds them too. At
RUNTIME 2448's files it is expected to fail on the error
(EncodedUseRebound): the gather's step keeps the encoder from keeping
its log.

Degradation kinds added or removed: none.

Verified: m3-max-36303 at 75b7873bc2 (same tree), clippy -D warnings of the runtime (all targets and features) 0 and rustdoc -D warnings 0. The cfg clippy, the lavapipe control at the old files, the staged rebind tests and the touched suites run after the merge.
2026-11-16 05:14:10 -08:00
..