Record the short last row's shadow among the known gaps

A texture over host pages whose buffer ends inside its last row's pitch is a shadow
(Refused(Placement)): a linear image's last row takes the whole pitch, so the image's memory
requirements reach past the buffer's bytes, over an import of the caller's pages and over a copied
host buffer's copy alike, whose placement is the buffer's length. Metal reads such a texture in
place, so it is a runtime cost above the driver's: docs/FAST-PATHS.md's known gaps now say so, and
InPlaceRefusal::Placement's doc names the case.

Seen on the Iris Xe (ANV) and the 780M and RX 550 (RADV) by a probe at the guest's shape, which
stays on a branch of its own.

Verified: cargo fmt; scripts/api-signatures --check (signatures unchanged; a doc change).
(cherry picked from commit 9493894b26cee3b1a525d9a0916a83f3fc6a594f)
This commit is contained in:
Anees Iqbal committed 2026-11-08 09:08:35 -08:00
1 parent a5cc119ae9
commit bfcd71e5d6
2 files changed
+11 -1

No files matched your search

@@ -192,7 +192,9 @@ pub enum InPlaceRefusal {
Image,
/// No image the device makes lays the rows (or slices) at the buffer's pitch.
Pitch,
/// The image's alignment, size or memory type misses the bytes' place.
/// The image's alignment, size or memory type misses the bytes' place: among them a texture
/// whose buffer ends inside its last row's pitch, whose image's last row takes the whole pitch,
/// past the buffer's bytes (`docs/FAST-PATHS.md`, known gaps).
Placement,
/// Over pages imported as dma-bufs: the caller's source made no one dma-buf of the texture's
/// own pages.
+8
View File
@@ -447,6 +447,14 @@ driver's. Each is open work.
creation never fails because of a hang. Where a wait found the loss first, the call waits for
the recovery and goes on.
- **A texture over host pages whose buffer ends inside its last row's pitch is a shadow**
(`InPlaceRefusal::Placement`, `WorkCounts::host_texture_shadows_refused_placement`,
`shadowed-texture`), where Metal reads it in place: a linear image's last row takes the whole
pitch, so the image's memory requirements reach past the buffer's bytes, which are not the
runtime's to bind. So over the caller's pages imported by their pointer and over a copied host
buffer's copy alike, whose bytes are the buffer's length (ANV on the Iris Xe, RADV). The shadow
copies the texels in before each command buffer that uses the texture and merges them back
after each write.
- **A copied host buffer costs O(its size) at every batch's completion that may have written
it, and at every commit where its pages carry no log** (`copied.rs`, `copied-host-pages`): each
compares every byte of the copy with the bytes the copy and the pages last agreed on, a page at