RUNTIME 2446: Shadows: a split merge on the host copies no piece; its kernel skips their columns

A merge on the host past shadow_merge::HOST_WHOLE_BYTES split: its host
step stored the pieces of each row in lines beside the texels, and its
kernel the rest. To keep the kernel off those lines, the GPU copied the
pieces' kept bytes into an arena region and their changed bytes over
them in the kept part: two vkCmdCopyBuffer calls of one region per
piece. On the Iris Xe (ANV) that work cost about 7 to 9 us a region,
growing with the rows, not the bytes: about 0.6 ms for 34 rows
(m3-max-35898) and about 15 ms for 1024 (m3-max-36118: a BGRA8 1023x1024
render target over host pages drew in 17.57 ms a command buffer as a
shadow against 1.26 ms in place, its host step 0.28 ms of it).

Now the kernel takes a column window (bind::ShadowMergeModule: two more
push words, PUSH_BYTES 24; shape_within, shape the whole row): a word
outside the columns is neither read nor written in either store form,
and counts as unchanged in its block. A split merge pushes the words
between each row's pieces where every row's pieces lie at the same
places in it (shadow_merge::columns: whole words, the same head and tail
each row; rows whose pitch is no multiple of the line differ, and those
merges go on the host whole). It records the changed copy and its
dispatches alone, with no save, no mask, two fewer barriers and no arena
region; the host step reads each piece's kept and changed bytes in the
scratch's two parts, which nothing writes after the changed copy.
Removed: HostMerge::saved, ShadowMerge::saves, ShadowCopy::merge_saves,
the merge's region in EncoderCore::merge_on_host, MergeDrain::_region,
and the split's copy uses of the kept part. The bound stays 1 MiB; its
doc comment states the measured costs. Linear merges push the whole row.

Tests:
- bind::shadow_merge's
  a_region_merged_within_columns_leaves_the_words_outside_them: 70 rows
  of 6 words, columns 1 to 4, every word changed; words outside the
  columns keep the current buffer's, in both store forms, and a window
  of every column equals shape.
- shadow_runs' merges_on_the_host_go_whole_up_to_the_bound_and_split_past_it
  also asserts shadow_merge_words_examined: every word of the whole
  merge's rows; for the split, the words between each row's pieces
  alone (height * (row bytes - line) / 4).
- shadow_write_lines' cost test gains a 4K shape: 3839 RGBA16Float texels
  a row, 2160 rows 30720 bytes apart.

The merge module is under no golden table (golden_hashes covers the
fixtures' translations). api_signatures: PUSH_BYTES, shape, and the new
shape_within. Degradation kinds added: none.

Landing note: msi m3-max-36189 at 4b09425f2d (same tree): clippy metal2vulkan + runtime, all targets and features, CLIPPY=0. The API tables, the module tests, rustdoc, clippy m2v_gpu / m2v_cpu_icd, the lavapipe control (development's whole-row kernel fails the split test's words-examined count) and the touched suites, PHOENIX and the Iris re-time follow on development.
This commit is contained in:
Anees Iqbal committed 2026-11-16 04:32:27 -08:00
1 parent 6df2d88550
commit 8562b28fe4
12 files changed
+295 -262

No files matched your search

+2 -1
View File
@@ -2511,7 +2511,8 @@ bound.
stores each byte that differs of each row's bytes in the lines that also hold bytes beside them
(`WorkCounts::shadow_merges_on_host`, `shadow_merge_bytes_on_host`, `shadow_host_steps`; a
merge none of whose rows' lines holds such a byte goes by its kernel alone, and one whose rows
hold at most 1 MiB goes on the host whole; docs/FAST-PATHS.md, **Known gaps**, the Iris Xe's
hold at most 1 MiB, or whose rows' pieces in those lines lie at different places in them, goes
on the host whole; docs/FAST-PATHS.md, **Known gaps**, the Iris Xe's
line write-back, which may still put back a CPU write to a texel the commands left in a line
whose other bytes they changed, where the kernel stores). Where the device is measured to run it
faster so (`DriverFact::ShadowCopyBackDispatchFaster`), a copy back of a one-slice texture of 4-,