Let a linear run's passes name buffers over host pages; a pass a rebind encodes again alone reloads its run

A pass over a linear attachment rendered apart joined no run where its commands named a buffer
over host pages (render.rs's once rule): a rebind of one encodes the pass again alone, and a
linear run had no keep after such a pass. A consumer's setVertexBytes lands in an upload chunk in
its guest RAM, a no-copy buffer over host pages, so every pass of reims's many_passes merged
alone: 706 passes, 706 merges, 705 scratch reuses (11-05).

Measured at development 0165341336 on RADV 780M, release, the rule forced
(linear_runs::passes_reading_host_pages_form_one_run, m3-max-6078, three runs): 706 passes, 706
through copies, 706 merges recorded and 0 taken over, 705 scratches reused; GPU 47.59 to 47.65 ms,
against 12.27 to 12.30 ms for the same passes over a private texture.

Now such a pass joins. Encoded again alone by a rebind, it leaves its run as before
(RunMerge::leave: the merge it took over records at the pass before it) and copies in, keeps and
merges after itself; where a later pass of the run took its merge over, it then copies the run's
box in again from the surface and keeps it into the run's scratch (RunMerge::keep_after's new
linear arm, LinearMerge::record_reload, recorded by EncoderCore::finish_replay; counted as
WorkCounts::linear_runs_reloaded). The run's later passes render over what the bytes hold then
(the run's box may reach past the pass's own, where the pass opened the run over its whole render
area), and its merge writes only what they change. Attachments over host pages other than the
run's own bytes still keep a pass out.

Docs: pass_runs.rs (Which passes join; Encoded again; keep_after), command_buffer/reencode.rs
(Runs of passes), merge_scratch.rs (order 1), linear_merge.rs (Runs), render.rs. API signatures
blessed (one WorkCounts field).

Tests: linear_runs::passes_reading_host_pages_form_one_run (one run expected);
linear_runs::a_pass_of_a_run_encoded_again_alone_reloads_the_run (six passes behind a
host-signalled event, two of them reading a chunk over host pages that is rebound: both encoded
again, both reloading, five merges, the texels a private texture's). Not yet run.

(cherry picked from commit 2b79be56f39ef529db48090dd3185f795ed3c75e)
This commit is contained in:
Anees Iqbal committed 2026-11-07 18:12:34 -08:00
1 parent 00a9aada6f
commit 4368a35894
10 files changed
+290 -49

No files matched your search

@@ -43,11 +43,12 @@
//! its host step needs. Work a host step recorded again since (with the barriers between its
//! commands, `gpu_execute::Rerecord`, or as a route outgrew it, `DeferredPass::outgrown`)
//! keeps that step's recording.
//! - **Runs of passes.** An encoder encoded again that was a pass of a run of passes over a
//! shadowed texture merged once (`pass_runs.rs`) leaves the run once it is put in place: the
//! merge of the run's pass before it, which it took over, records after all, and it keeps the
//! run's scratch after its own merge where a later pass went on over it (`State::replaying_keeps`,
//! recorded by `EncoderCore::finish_replay`). Its run's other passes are not encoded again.
//! - **Runs of passes.** An encoder encoded again that was a pass of a run of passes merged once
//! (a shadowed texture's or a linear attachment's, `pass_runs.rs`) leaves the run once it is
//! put in place: the merge of the run's pass before it, which it took over, records after all,
//! and it keeps the run's scratch after its own merge where a later pass went on over it, a
//! linear attachment's run's box copied in again first (`State::replaying_keeps`, recorded by
//! `EncoderCore::finish_replay`). Its run's other passes are not encoded again.
//! - **What cannot be encoded again stays as before.** An encoder whose log is gone (a compute
//! encoder of a command buffer that used command predication whose unit laid a step before it
//! opened, or one of its own that the unit's later encoders read, or a loop, or left work out;