On the Iris Xe (ANV) a pass that clears and stores a linear image, and a draw into it, write back
whole the 64-byte line that holds a row's last texels. That puts an older value back over a CPU
write beside the texels, so the check fails render targets over host pages there, and every such
texture is a shadow. The write-back cannot reach a CPU write when no line holds both a texel and
a byte beside the texels: the probe read 0/100 for rows that end on a line, and 0/25 for a
3840x2160 surface of tight rows. A 3840x2160 BGRA8Unorm surface's 15360-byte rows are 240 lines
each.
The check's verdicts are now kept per class, access and row ends (in_place::RowEnds):
- The line is the device's nonCoherentAtomSize. vkspec defines it as "the size and alignment in
bytes that bounds concurrent access to host-mapped device memory".
- RowEnds::of reads the texels' address, offset and pitches. Texels are OnLines where their first
byte and their end lie on a line, and so do each row's (or slice's) start and end where bytes
lie between rows (or slices). Elsewhere they are InLines.
- The check runs the shapes whose texels share no line first (Shape::rows; seven of SHAPES at
64-byte lines). A byte changed beside one of them fails both row ends. A byte changed beside a
shape that shares a line fails InLines alone, since the OnLines rounds have already run (the
verdicts function). A device that fails InLines now also runs its OnLines shapes.
- SHAPES gains two shapes whose rows end inside a 16-byte line, at the 16-byte pitch a driver
that lays rows tight uses: BGRA8Unorm 101x51 at 416 bytes and RGBA16Float 33x17 at 272, the
same shapes STORE_SHAPES already holds. MoltenVK makes no linear image with bytes between rows
except at that pitch, and its line is 16 bytes. Without these two, none of its shapes whose
texels share a line was made, so its reads and renders were Unchecked for those texels: on
the M3, a probe of this change without them gave Pointer and Fresh reads and renders Unchecked
5/5 for InLines (m3-max-6750).
- SHAPES and STORE_SHAPES gain the same widths at the 64-byte pitch of a driver that lays rows
at the next multiple of 64: BGRA8Unorm 101x51 at 448 and RGBA16Float 33x17 at 320, and
RGBA8Uint 101x51 at 448 and RG32Uint 33x17 at 320. On lavapipe (llvmpipe's linear images take
64-byte rows, its line 64 bytes) no shape whose texels share a line was made without them:
tests::in_place_check::the_in_place_check_checks_fresh_pages_where_held_imports_cost_submissions
read the Fresh verdicts Unchecked for all three accesses of those texels (m3-max-6991). The
shape test now holds that drivers whose rows lie at the next multiple of 16, 64, 128 or 256
bytes each have such a shape, for each access.
- The record holds 18 verdicts. CHECK_VERSION goes to 6, so a record of the old check is not read.
- The report keeps its nine lines, now the InLines verdicts (the old verdict exactly, since an
OnLines failure fails both), and adds nine ", rows on lines" lines after them.
- The texture's own row ends decide, everywhere a texture asks for its verdict: its making
(Texels::rows), a shadow's move in place (MoveWait, move_wanted) and a copied rebind into fresh
pages (fresh_pages_take_images, from the watch's place in its pages). ShadowCause::CheckPending,
CheckFailed and Unchecked name the row ends, and the notice says them.
- Device::in_place_check_line (doc-hidden) answers the line. The lanes that hold a texture to its
verdict compute its row ends themselves (runtime_lane::in_place_rows, apart from the runtime's
reckoning) and read that row ends' line.
Docs: FAST-PATHS row 41 and the API guide describe the row ends. The ShadowedTexture notice
docs name them. The known gap for rows that end on a line is closed and deleted.
Tests: RowEnds::of covers an offset, an address, a pitch and slices off a line, tight rows that
do or do not end on a line, a 1-byte line, the 3840 and 3662-wide surfaces, and the check's
shapes per class. The verdicts function: a change beside OnLines texels fails both row ends, a
change beside InLines texels fails InLines alone, and a forced failure and an unchecked class are
covered. The decision test runs every class with both row ends. The record test covers 18
verdicts.
Verified, the whole check on fresh caches (the probe test, this change plus the test alone;
the Iris Xe and RADV runs at 5beb0be2a5, before the 64-byte shapes, on development 0950c1a0ab):
- Iris Xe (RPL-P), ANV, Mesa 26.2.6, 64-byte line (m3-max-6892), 20 runs, every run the same:
reads Passed for both row ends, Pointer and Fresh; renders and writes Failed for texels that
share a line and Passed for texels that share none, Pointer and Fresh; DmaBuf Unchecked for
all six. The failures are a byte between two rows: a clear and store or a draw of R8Unorm
61x37 at 256 bytes a row (renders), and storage writes of RGBA8Uint 101x51 at 512 (writes).
323-383 ms a check (median 345), against 156-342 ms before (m3-max-6226): a class that fails
for texels that share a line now runs its rounds for texels that share none to the end, as a
passing device's do. A build job ran on the same host meanwhile.
- M3 Max, MoltenVK 1.4.2, 16-byte line: Pointer and Fresh Passed 5/5 for reads, renders and
writes, for both row ends (12); DmaBuf Unchecked for all six (no dma-bufs on macOS). 290-304
ms a check at 5beb0be2a5 (m3-max-6804); with the 64-byte shapes, at 19a7c36f69 on
development ee5d3cfab9 (m3-max-7142), the same verdicts and 306-311 ms, the first run 548 ms.
Before this change, 299-582 ms (m3-max-6160). That earlier run had six verdicts Passed and
the three DmaBuf ones Unchecked, not all nine Passed as 31b19fa7f0's body says. No M3 cost
record's case changes path: every verdict the M3 passed before passes for both row ends.
- RX 7900 XTX, RADV, Mesa 26.2.6, 64-byte line (m3-max-6817): all 18 Passed 5/5. 535-561 ms a
check, against 626-642 ms before (m3-max-6523).
Verified, self_reads on the Iris Xe (m3-max-6892, release, each process on a cache of its own),
the previous commit's lane alone (before) against this change (after), two rounds each, GPU
ms per frame (median) of the baseline and of 30 self-read pairs:
- 3840x2160 surface over host pages, InPlace policy: before a shadow, 3 shadow copies a frame,
8294400 texels copied in, 1 keep and 1 merge; baseline 3.487 and 3.526, self-reads 4.994 and
5.014. After in place: no shadow copy, no texel copied in, no keep or merge; baseline 1.676
and 1.674, self-reads 4.544 and 4.559 (30 snapshots a frame, as before).
- 3662x2039 surface, InPlace policy: a shadow before and after (its rows end inside a line);
self-reads 4.141 and 4.187 before, 4.168 and 4.205 after.
- Private targets, unchanged: 3662x2039 self-reads 11.48 to 12.12, 3840x2160 14.68 to 15.04
(30 splits a frame, before and after, on development 0950c1a0ab). Under 61a367cb51's area
rule, landed since, these readers are expected to take snapshots instead (not run here).
- The check, as the lane's device ran it: 202.6 and 193.8 ms before, 411.5 and 369.7 after.
The lanes that hold a texture to its verdict passed on the Iris Xe under validation
(in_place_textures 7, linear_attachments 25, snapshot_reads 7, linear_alignments 3,
first_use_writes 1, device_copies 5; m3-max-6892).
Checked at b0043502d1 (this change before the 64-byte shapes, on development ee5d3cfab9;
homelab-gem10-1, m3-max-6991): clippy with --cfg m2v_cpu_icd and with --cfg m2v_gpu, all
targets and features, clean; rustdoc with -D warnings clean; the API tables, the ledger test,
check_draw and tests::in_place (44) passed; on lavapipe 306 of the 307 touched tests passed, and
the one that failed is the fresh-pages test the 64-byte shapes fix (above). That test and the
runtime's in-place tests on lavapipe at this commit: m3-max-7152 (homelab-um870-1). The RADV
probe at this commit plus the probe test: m3-max-7153, then its run on the RX 7900 XTX.
(cherry picked from commit f815203f074e1b2f922cd2a2d337ba31ea51e02f)