inplace-modifier: where the device enables VK_EXT_image_drm_format_modifier and its natural linear image
misses the buffer's pitch, a texture over a padding-unobserved buffer of the runtime's own memory is a
DRM_FORMAT_MOD_LINEAR image with an explicit row pitch at the buffer's, judged by a new pooled-memory
check class (the first move from UNDEFINED, as for host pages) and Access::UnobservedRenders (a render
round that changed only its rows' own padding); past 256 KiB it stays a shadow
(TextureShadowReason::LinearCost: a linear image renders and samples slower there, Iris sweep 7957).
Private buffers count lines from their memory object's offset. CHECK_VERSION 11, 56 verdicts. New:
WorkCounts::pooled_pitched_images. Verified by inplace on the Iris (ms01 8057): reims's 93-cache mix
86 in place / 7 shadows (the 7 past the bound), median frame 4137-4140 -> 3823-3840 us (-7.2..-7.6%);
device and unit tests 18/18; negative controls 7965 and 8028 gave 0 of 93. M3 43/43 (8058). The 780M
is unchanged (RADV refuses the modifier off a 256 multiple, sweep 7949). Clippy, rustdoc and the Linux
suites run on development after the merge.
Texels::rows and Texels::padding answered InLines and Kept for any buffer the CPU does not address,
so a texture over a Private buffer that declares its padding unobserved asked the strict Renders
verdict, which the Iris Xe fails for rows ending mid-line: the pooled_pitched_costs lane (Private
buffers, as the consumer's device caches are) made 0 of 93 caches in place at a8b823e90e/c92b83ba5d
(job 8028) while the Shared buffers of the padding_unobserved device test went in place.
A buffer of the runtime's own memory now counts its lines from its offset in its VkDeviceMemory
(Buffer::memory): a VkMappedMemoryRange's offset is a multiple of nonCoherentAtomSize from the
memory object's start, and the runtime maps each block from 0, so a Shared buffer's address and
that offset agree modulo a line. Only a buffer over the caller's VkBuffer stays InLines and Kept.
Product effect: Private pooled buffers' textures (the only ones without contents that reach the
in-place verdicts) take the verdicts of their real row ends and padding.
(cherry picked from commit c5a9b1db0a292cb8d83f8bc7a7ebf05864bdd589)
The Iris Xe sweep (job 7957, four textures each, a frame's clear-and-store pass and a draw reading
each): 47-166 KB textures run faster in place, 256 KB alike, 530 KB and up slower, so the bound
stays 256 KiB. The Radeon 780M sweep (job 7949) found RADV refusing DRM_FORMAT_MOD_LINEAR images at
pitches off a multiple of 256 bytes (ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT) for every
such shape, and its own linear image already aliases at those multiples: no crossover there, and
no texture on it takes a pitched image. Comment only.
(cherry picked from commit f9f354681b85527402b10f94d41841587b3ad181)
The assertion counted eight (its comment said six, stale since the four shapes at a driver's own
pitch were added); 2ff1e3e39a added the 172x67 shape at a 704-byte pitch, whose rows end inside a
line. Verified: M3 job 8008 failed this test alone (left (7, 9), right (7, 8)) among 42.
(cherry picked from commit 5ce0f7f80f09350726f04c5f060e61f11025057a)
What: a new check access, UnobservedRenders, that the renders rounds answer beside Renders, as the
storage-write rounds answer BufferWrites beside Writes. Where a shape's rows' padding is free
(Shape::padding), a renders round that changed no byte but of that padding (after a row's last
texel, before its pitch, the last row's included) fails Renders for its row ends and keeps
UnobservedRenders. A byte past the last row's pitch, or a texel, fails both. A new Padding variant,
Unobserved (Free padding over a buffer that declares padding_unobserved, Texels::padding), makes
in_place() ask UnobservedRenders in the stead of Renders (Access::rendered); the wider render-target
plan of an image in place asks the same. The check's SHAPES gain 172x67 BGRA8 at a 704-byte pitch,
whose last row's pitch ends 64 bytes past a multiple of 128 and 256, so a device that writes back
more than a line around a row's last texels changes a byte past the image and fails both.
VERDICTS 48 -> 56 (7 accesses), the record 56 bytes; CHECK_VERSION stays 11 (unlanded).
Why: on the Iris Xe (job 7965 at c4eeeba7e8), the pooled class's Renders verdict failed for rows
ending mid-line (the clear and store, and draws, write back the 64-byte line holding a row's last
texels whole), so none of the 93 device caches went in place (93 shadows, frame 4145 us declared
and undeclared alike), and the item's case (a padding-unobserved texture at a 64-aligned pitch, rows
ending mid-line, rendered) stayed a shadow (CheckFailed{Renders, InLines}). The declaration already
lets a render pass's load and store write those bytes; no byte past the last row's pitch may change,
and Padding::of guarantees the last row's pitch ends on a line.
Also: a padding-unobserved buffer in fresh pages takes the same rule; BufferDescriptor's doc says so.
Tests: unit cases for the compare (the line write-back of each row's padding is Padded; a 128-byte
write-back past the last row's pitch, a byte past it or a texel is Changed), Padding::declared, the
tally (Renders answers two), the decision test over Unobserved padding, the shadow-cause words; the
device test asks the UnobservedRenders verdict and asserts the texels' padding is Unobserved. Device
evidence follows on the Iris.
(cherry picked from commit 990d744ec71269663e292c7f2f3e4148d166bacb)
A guest's device caches on the Iris Xe (eight of its most common small shapes at their counts
and its large ones, 93 textures that render over Private buffers) over buffers that declare
their padding unobserved and over ones that do not, the check settled under the in-place
policy: each form's caches in place and as shadows and its frame GPU time, one command buffer a
frame clearing every cache and reading each whole.
Verified: cargo fmt; runs follow.
(cherry picked from commit 9e1d61c34408c297c937836386f314e95084f504)
Measured on the Iris Xe (probe 7933): a small cache's shadow costs a fixed 3.5-4.3 us a
command buffer that writes it, which a linear image at Metal's pitch saves, while caches of
1.4 MB and more render and sample 8-18% slower as linear images than as shadows with their
copies. Over Private memory both forms give the same answer (no CPU reads the bytes, the check
judges the first move), so this chooses between two speeds and takes no FAST-PATHS row or
switch. in_place::POOLED_PITCHED_BYTES bounds a texture's rows to their pitch, the same on every
device; past it the cause is ShadowCause::LinearCost, which the placement query answers as the
new public TextureShadowReason::LinearCost { bytes } through the shared route. docs/API.md (the
padding-unobserved reason) and HOWTO say why.
The bound's value here (256 KiB) is provisional: the size sweep on the Iris and the 780M places
it at the measured crossover in a following commit.
Verified: cargo fmt; api signatures re-blessed (one variant added); REFUSALS.md regenerates
unchanged; builds follow.
(cherry picked from commit 366e098c15c7227006ba7633ecda574da224690e)
The pooled class adds four narrow lines (two accesses, two row ends). Correction to
44fa96d151's message: WorkCounts is not #[non_exhaustive], so a consumer building it with a
struct literal breaks on the new field; its docs say it is for the lanes, not part of the API.
Verified: the M3 run 7901 failed here (16 lines, asserted 12); rerun follows.
(cherry picked from commit f430e4a52279d588cf73cbf2b89bb52a69d997dc)
A new public counter field; nothing breaks for a consumer (WorkCounts is non-exhaustive to
construct). Verified: scripts/api-signatures/signatures.py --bless, one line added.
(cherry picked from commit 1b18926fc7ad570e0cb075d767a3716a2addd413)
The padding-unobserved device test settles the check and holds the answer to the making's
(NotHostPages exactly where the texture aliases, else the shadow's cause); a new device test
renders textures of the guests' cache shapes (64-aligned pitches, rows ending inside a 64-byte
line) over declared buffers and checks that a pitched image appears only where the pooled
class passed for reads and renders, that the CPU's texels read back through the texture, that a
clear reaches the buffer's rows, and that the bytes after the last row keep the CPU's. The
validation lane reads 48 verdicts. Docs: in_place.rs and in_place_check.rs module docs,
FAST-PATHS row 41, API.md (placement answers, the shadow reasons), HOWTO's padding-unobserved
paragraph, the runtime README, BufferDescriptor::padding_unobserved, TexturePlacement's
NotHostPages and Pending (a pooled texture made before its verdicts stays a shadow).
Verified: cargo fmt only; builds and the device runs follow.
(cherry picked from commit ae31d0fd3841b136c692897cbdf425633e9344c3)
A texture over a buffer of the runtime's own memory aliases it only where the device's own
linear image lies at the buffer's pitch. ANV lays linear rows tight, so a padded row (the
guest's device caches at 64-aligned pitches, rows ending mid-line) never aliases on the Iris
and every such texture is a shadow, copied in at each command buffer that uses it after a
write.
Where the device makes DRM_FORMAT_MOD_LINEAR images, such a texture now takes one with an
explicit plane at Metal's pitch (VkImageDrmFormatModifierExplicitCreateInfoEXT), no external
memory, bound in the buffer's memory. The image is made by the builder dma_buf.rs already has
(ModifierMemory gains Own: no external chain, no import check). Binding it to memory of no
external handle type is valid (VUID-VkImageCreateInfo-tiling-02261 asks only the modifier's
create info; VUID-vkBindImageMemory-image-01445 only a dedicated allocation where required,
which the runtime refuses), and a DRM_FORMAT_MOD_LINEAR image is linear, so in GENERAL it
aliases the buffer's bytes as host-accessible subresources do. It is made UNDEFINED
(VUID-VkImageCreateInfo-initialLayout-12478: PREINITIALIZED is for linear tiling alone), and a
move from UNDEFINED may discard the bytes: so the device's check gains a class for its pooled
memory (PagesClass::Pooled: a Shared buffer under half a pooled block that declares its padding
unobserved, its textures' images at Metal's pitch alone), and the image is taken only where its
verdicts pass for the texture's accesses, under HostPageTexturePolicy (Shadow turns it off).
CHECK_VERSION 11; the record holds 48 verdicts. The placement query answers a texture over the
device's own memory by the making's steps up to the bind (Device::alias_image_made): an
aliasing image (NotHostPages), or the shadow's cause. Counted: WorkCounts::pooled_pitched_images.
Verified so far: cargo fmt only; builds, tests and the device evidence follow.
(cherry picked from commit 25aa0cfda816f91a8148d4afbf81b19e7c870c07)
a_raw_copy_on_a_reserved_queue_moves_the_runtime_s_own_buffers asked
SharedEvent::vk_wait(10) once the first command buffer was scheduled and
panicked unless it answered Counter. On an RTX 5080 the two 4 KiB fills can
complete before the question, and vk_wait then answers Reached, which its
contract defines as 'the submission needs no wait'. The test failed so in
2 of 10 runs alone (perdraw6-rawcopy-a, at 37637be4d4) and once in a whole
runtime suite beside the exits lane's making_exit (the 5080 exit entry):
'a submitted signal's counter: Reached' at reserved_queues.rs:279.
The raw copy now waits for counter 0 (none) where the signal was reached, and
for the counter as before where it was not; its line names which it saw. Only
NotYet, which a scheduled signal never answers, still fails the test.
Verified: pending, the test 30 times on the RTX 5080 (b5080 c entry), its
line counting Reached and Counter runs; clippy in the m2v_gpu cfg.
(cherry picked from commit 39b2a53adcb6e2b61dffef7f9d342c39e999dd1e)
macOS 11's own Core Image libraries (file type 1, format 2.5; reims's 11.7.11 guests, 118977 and
320632 bytes) name one 8-byte private-metadata record, a size word and ENDT, from every function, over
the one module they share; the parser refused the second function's entry with BadOffset (at 245 and
223), so the guest's Core Image got "Invalid library file". In a library whose functions share a module
(Core Image kernel, dynamic), a function may now name exactly the record the previous one did when it
holds no tags; a shared record holding a tag, and any sharing in an executable library, stay
BadOffset, so parsing stays linear in the file size. Test: a 2.5 Core Image library sharing one empty
private record parses with no private tags; the tagged and executable variants are refused.
(cherry picked from commit 200ca7984d84dde9aba214115e4df5745ade5123)
tests::host_import_counts::copies_between_a_buffer_and_a_texture_never_read_apart failed once in
development's lavapipe leg on msi-laptop at edde5779b1 (lavapipe of LLVM 23.1.1): at its first
copy (host_import_counts.rs:268) left (23, 0, 1), right (23, 0, 2): an import live as the test read
its gauges before that blit, besides its own buffer's, went during it. settled_device waited for
the device's in-place check to settle and for host_imports_read_apart to reach 0. A buffer of the
check's counts its import's read apart off as it goes, but where a keep-alive alone waits for the
import's free, that free goes to a handler thread (HostImport::drop, buffer.rs), and
host_imports_live falls only once it ran; the check settles right after its last class's buffers
went. settled_device now also waits until no import is live and no posted release is pending: a
device made just now holds no import of its own.
Verified (lavapipe, --cfg m2v_cpu_icd, homelab-um790-xtx-1, Mesa 26.2.6 with LLVM 23.1.4):
- A posted release was still pending as the check settled in every run printed (16 of 16, a
scratch print at 96ba9a104c, m3-max-7851). There it was the dma-buf class's, whose memory
host_imports_live does not count (an import of the class's own exported allocation), so the
gauges the test reads did not move: the failure did not reproduce there (0 of 424 runs at
dc064aec27 under four runs of the freed_memory in-place check test, eight of this one and 20
busy loops, m3-max-7902; 0 of 498 at 96ba9a104c). On msi-laptop's lavapipe the check made
fewer commits that used its imports before it settled (22, against 40 on um790), and the
import whose free was still pending was one host_imports_live counts.
- this change: 0 of 784 runs under the same load (m3-max-7985).
Not run: the test on msi-laptop's lavapipe, where it failed (msi-laptop takes no CPU jobs of
ours now).
(cherry picked from commit ef98c2917e32e77d79f1cbf91bcacc80ef09acf8)
tests::freed_memory::the_in_place_check_s_buffers_delay_no_deallocator_behind_batches_in_flight
keeps a batch of 16 fills of 64 MiB in flight from its first command queue until the device's
in-place check settled and its imports went, and failed once 60 s (WAIT) had passed since it
began. On a device of one queue (lavapipe) each of the check's submissions waits behind such a
batch, so the check runs as long as its submissions times a batch, which a loaded host
stretches: 27 to 29 s alone, and past 60 s in development's lavapipe leg on msi-laptop at
edde5779b1 (FAIL at 60.3 s, "the check's buffers never went"). Nothing was stuck: the check was
still going.
The bound now holds for each step of the check the test sees: a new verdict, an image of one of
its rounds (ObjectChurn::vk_images_made, which the fills on a private buffer never move), a
release of its imports posted (host_import_releases_posted) or one of them freed
(host_imports_live). A step must come within 60 s of the one before. The test prints its longest
step.
Verified (lavapipe, --cfg m2v_cpu_icd, homelab-um790-xtx-1, 16 threads, Mesa 26.2.6; each run
a process, under the same load each time: four runs of this test at once, eight of
host_import_counts::copies_between_a_buffer_and_a_texture_never_read_apart and 20 busy loops):
- development dc064aec27, m3-max-7902 (the two trees' loops side by side, two and four runs of
each): 16 of 20 runs failed ("the check's buffers never went"); the four that passed took
53 to 60 s.
- this change, m3-max-7985: 0 of 40 failed, in 51 to 63 s; longest step 3.1 s; delayed 0 and
posted 8 in each run.
- The same at 96ba9a104c with 12 busy loops, m3-max-7783: 44 of 48 failed.
Not run: the test on a GPU (its steps are the same counters there).
(cherry picked from commit efda039eef9ab6c165f192785d81c8c6ff30a15b)
amdperf-33 (the three tiled-mips follow-ups): a command counts as a use of a multi-level tiled
texture's level-0 shadow only where its range touches level 0, so generate_mipmaps and blits or passes
into levels 1+ copy level 0 in and out no more; the multi-level image takes the level-0 unorm and word
views, so its merges fetch instead of copying back by dispatch; while its bytes are detached, the tiled
texture keeps its own image (levels 1+ unchanged, level 0 its bytes' last texels) where a texture over
the pages alone reads zeros. Verified by amdperf: M3 320/320 (7858) with the negative control failing
the 4 new tests (7865); 780M (7898). Clippy, rustdoc and lavapipe run on development after the merge.
The later-levels test asserted the level-1 blit's counts before it ran
generate_mipmaps, so a build without the fix (the negative control) printed no
generate_mipmaps counts. It now runs both for each shape, prints them, checks the
texels, and asserts the counts after the loop.
(cherry picked from commit 565fa393e25d2c3078a9b61a171dbcd29b1e84a8)
- tests/in_place_check.rs imported RuntimeDriverDefect for its Linux-only dma-buf
test alone, so a macOS build under --cfg m2v_gpu warned of an unused import
(pre-existing on development; Linux builds use it). The import is now Linux-only.
- tests/tiled_texture_device.rs: the render encoder of the later-level pass test
needs no mut.
Seen in the M3 build m3-max-7840 (cargo test --lib under --cfg m2v_gpu).
(cherry picked from commit 82c6f2b219142814c349ac43b2606b44cd935725)
A tiled texture of more than one level (Buffer::new_tiled_texture) over a no-copy
buffer presented the shared zero stand-in at every level while the bytes were
detached, and refused CPU access at every level (DetachedTexelAccess). On a Mac its
later levels are the texture's own memory, which a detach leaves, and its first
level the pages it took, whose last bytes its CPU access reaches.
The texture's image is its own, so it now keeps presenting it: noted with keeps
(NotedTexture::keeps), it takes no stand-in at the detach (TexturesOver::images
leaves it out, and so do the stale-reach notes) nor at its making over detached
bytes. Before anything is detached, the detach loads its first level with the
bytes' texels as they are then (keep_first_levels, Texture::keep_first_level: a
get_bytes of the pages, then a write into the image), so an unnamed read and
get_bytes read the last texels, those the CPU wrote after the last copy in
included; a replace_region of that level stays refused. The later levels are read
and written in the image as before. Once the bytes lie in pages again the first
level copies them in at its next use. The load reads the level's texels once on
the host (11.7 KB for WindowServer's 54x54) and stages one copy for the next
submission, at a detach only.
Docs: the item's rustdoc says the difference (its first level reads its last bytes
while detached, where a texture over the pages alone reads zeros), with its other
levels' rule and the copies of item 1 and 2; detach.rs, stand_in.rs,
DetachedTexelAccess's doc and docs/API.md. REFUSALS regenerated (unchanged), api
signatures checked (no change).
Verified by the device tests: see the tip's evidence.
(cherry picked from commit 87435362577424f2e7757ff69bcb292b401dc9ed)
with_word_view and with_unorm_view required a one-level image, so the shadow of a
tiled texture of more than one level (Buffer::new_tiled_texture) took neither: its
merges copied the texels out instead of fetching them through the BGRA8/RGBA8
unorm view (every device), and on ANV its copies back stayed copies where a
dispatch is measured faster. Both views are of level 0 alone, and its copies are
one region of level 0, so a multi-level image takes them as a one-level one does.
The condition is now one slice. sRGB and the other formats keep copying out, as
every shadow's do (unorm_read), or take the word view where it is made.
Verified by the device tests: see the tip's evidence.
(cherry picked from commit 0d124cfc62ab10bb4be87ff5909f8602ff28db05)
shadow::copies_used matched a command's uses to a shadow by its key alone, and
render/shadows.rs took every attachment of a shadowed texture as a use of its
shadow. A tiled texture of more than one level (Buffer::new_tiled_texture) is one
image whose first level alone is a copy of the bytes (shadow_range levels 0..1),
so a command that used only its later levels was planned as a use of the first:
a blit into or out of level k copied level 0 in, and after a write copied it back
or, over a Shared buffer, kept and merged it; generate_mipmaps' chain (read N,
write N+1) left level 0 dirty and merged it back at the end of the encoder, a
merge that stored nothing. WindowServer makes such textures in its first seconds.
ShadowCopies::holds: a use names the shadow where it holds a copy of the truth,
its key in a range that meets shadow_range. copies_used counts only those uses
(and writes only theirs); attachment_shadows and count_colors take an attachment's
shadow only where the attachment's level and layers meet it (held_shadow). Every
other shadow's range covers its whole image (or, for a heap's two-plane texture,
its first level, whose later levels likewise lie in the image alone), so nothing
else changes.
Verified by the device tests of the commit before: see the tip's evidence.
(cherry picked from commit 35d39664702c4d34219226ca2bee6755365737e3)
Four device tests in tiled_texture_device.rs, for the three tiled-mips follow-ups
(Buffer::new_tiled_texture):
- uses_of_the_later_levels_alone_copy_nothing_of_the_first: a blit into level 1
takes no shadow copy, and generate_mipmaps copies level 0 in and nothing back,
keeps nothing and merges nothing.
- a_render_pass_into_a_later_level_copies_nothing_of_the_first: a pass into level 1
takes no shadow copy.
- a_merge_of_the_first_level_fetches_through_its_view: a blit into part of level 0
over a Shared buffer merges back through a view (shadow_merges_fetched 1), the
bytes outside the part kept.
- detached_bytes_leave_the_first_level_s_last_texels_and_the_later_levels: over a
no-copy buffer, detached, the texture keeps its VkImage, get_bytes of level 0
reads the CPU's last write (made after the last copy in), the later levels read
and take writes, a level-0 write is refused; a rebind gives level 0 the new
pages and keeps the later levels.
Each prints its counts before asserting. They fail on this commit alone, where
the fixes that follow are absent: the negative control.
(cherry picked from commit e873588a623425c2cc8137296b4b5ec3dcd87432)
perdraw-11 (e318666636) changes how a buffer slot whose offset alone moved tests for a reshape
(BoundBuffer::same_shape instead of comparing two whole shapes); the answer is the same by construction
(tested over every pair of 184 bindings at 3 alignments), and the work counts are equal on both sides
(draws_rebound 239952, bound_offsets_moved 239040), so RUNTIME_VERSION stays. Instructions per draw:
gem10 lavapipe 5037 -> 4973, M3 5184 -> 5132. Verified by perdraw: M3 cost --check 0 and MoltenVK suite
1834/1834 (7883), lavapipe suite 1864/1864 (ms01 7960), clippy x3 + rustdoc + bind_shape_of (gem10 7881).
A rebound draw whose buffer slot moved only its offset (refresh_offset) asked
Reshape::replace whether the slot's shape changed by making both bindings'
BufferShapes: two length_class calls (u128 arithmetic) for a length the two
bindings share by construction. The fp call graph of draws.10k on lavapipe
(release, line tables, frame pointers) put BoundBuffer::shape at 1.24% of the
process, 0.78% in length_class, all of it under refresh_offset.
BoundBuffer::same_shape answers as the two shapes compare, skipping the class
of a length or offset the two bindings share; Reshape::replace_by takes such a
predicate, and replace is written over it. refresh_offset uses same_shape.
Test: bind_shape_of's new test checks same_shape against shape equality over
every pair of 184 bindings at three view base alignments. API signatures
blessed (one new method).
(cherry picked from commit 29fc8605db0229f0e2d7ca5522bb2e56855ee86d)
selfread dmabuf7: the check's dma-buf export carries the device-address flag every runtime import carries
(ANV refused the import otherwise, so DmaBuf was Unchecked on the Iris and the guest's dma-buf textures
were shadows); compares read in wide loads (ANV maps exported BOs uncached: 2.7 s a 4K round byte-wise);
a store-path failure (renders, writes, buffer writes, narrow writes) seen beside the texels, with that
class's reads passing, fails every class's verdict; verdicts are given together at the check's end.
CHECK_VERSION 10. Verified by selfread on the Iris (ms01 7779 at the rebased tree): the rule's unit test
passes and fails with the rule taken out; device test 3/3 with the guest's 234x18 BGRA8 texture at
1024-byte rows in place; 6 fresh checks of 1.21-1.41 s (18.9 s with the flag fix alone, 7688) with
identical verdicts, the carry firing for DmaBuf narrow writes in 3 of 6. Clippy, rustdoc and lavapipe
suites pending (gem10 7780), then the 780M A/B.
On development the check has rounds of 1- and 2-byte texels a kernel stores (NarrowWrites, and
NarrowBufferWrites for a free padding), and CHECK_VERSION 9 is theirs. Those rounds store as
the storage-write rounds do, so a failure of theirs beside the texels, where the class's reads
of those row ends passed, carries across classes as theirs does: carried_store_failures counts
them among the store-path accesses. The unit test takes every access and adds a narrow case: a
narrow-writes failure of one class and a narrow buffer-writes failure of another each fail the
other classes' passes of theirs.
CHECK_VERSION 10: the dma-buf class's export and imports (commit 1), and the carried failures
and verdicts given together (commits 2 and 3), change what the check answers on ANV, whose
records of 9 hold the dma-buf class unchecked.
Verified: pending (the rule's unit test and the Iris device test at this tree).
(cherry picked from commit f50901a1fb49cacdcb770b82f6eb92e423b7610f)
carried_store_failures carried any failure of renders, storage writes or buffer writes of a
class whose reads of those row ends passed. A round that reads a texel other than the stores
left it fails those accesses too, and that is the class's own: whether the CPU sees the GPU's
stores depends on the class's mapping and import, as whether the GPU sees the CPU's bytes does
for reads. What carries is the GPU's write-back of a line beside the texels, which every class
shares.
check_class now returns, with its verdicts, whether every byte its rounds found changed lay
beside the texels (after a row's texels, or after the image; a padding change is); the run keeps
it in each Found (now a struct), and a failure carries only where it holds. The unit test adds a
store failure at a texel, which carries nowhere, and the same failure beside the texels, which
carries to both other classes.
Verified: pending (with the commit before's runs: the unit test with and without the rule, the
780M and lavapipe verdicts against development's, the Iris check again at this tree).
(cherry picked from commit 196b3f4f42046e265910e90d71255d6cad775f2c)
With the dma-buf class's pages imported on the Iris Xe (the commit before), two things showed,
both from one cause: ANV maps its exported memory uncached for the CPU, whatever the memory type
(job 7706: types 1 and 2 alike), so each byte the check reads there is a bus read of about 80 ns.
1. A flaky pass. The check's writer reads each byte before it rewrites it, sweep after sweep,
while the GPU stores; a sweep of a 101x51@512 window there takes about 2.7 ms, against a store
step of 0.1 to 0.8 ms, so it revisits a row's last line about 40 us apart instead of under a
microsecond, and rarely lands a write between the GPU's read of the line and its write-back.
The storage-write rounds of rows that end inside lines saw the padding change in 3 of 18
dma-buf rounds against 10 and 14 of 18 of the pointer and fresh-pages classes (job 7706), and
the dma-buf class passed storage writes inside lines in one fresh check of three (job 7688),
where its pass would have put a kernel's writes in place over kept padding on a guest's pages.
In that run every round agreed (none saw a change).
carried_store_failures: a class's failure of an access whose rounds store (renders: the pass's
clear and store, and the draw; storage writes and buffer writes: the kernel's stores), where
that class's reads of those row ends passed (so the failure is the stores', not the first
move's), fails the other classes' passes of that access and row ends. The line write-back
belongs to the store path every class's images share; how often a class's rounds see it does
not. A reads failure (whether the GPU sees the CPU's bytes depends on the class's mapping and
import), an unchecked verdict and a class whose pages could not be made carry nowhere. Each
carried failure is noted. To change no verdict a texture already took, the check now gives
its verdicts together once every class is done, not per class.
2. A 19 s check. Bytes::matches compared the window byte by byte: 2.7 s for each round of the
3840x2160 surface over the dma-buf pages (the fill took 4 ms). It now compares each period
whole first (slice equality, in wide loads) and looks for the byte only where one differs; a
cleared row's texels likewise, a chunk of zeros at a time.
CHECK_VERSION stays 9 (the commit before, not yet released).
Docs: the module's verdicts paragraph and run's, API.md's in-place check paragraph.
Test: a_store_failure_fails_the_other_classes_passes_and_nothing_else_carries (tests/in_place.rs),
the Iris's verdicts of the flaky run: the dma-buf class's pass of storage writes inside lines
alone fails, as the pointer class's failure; a failure of the dma-buf class's own carries to the
others; reads failures, an unchecked verdict and a store failure of a class whose reads failed
carry nowhere.
Verified: pending (the unit test with and without the rule, the Iris check time and verdicts in
release, the device test repeated, the 780M and lavapipe verdicts against development's).
(cherry picked from commit f2f0e284c2b62980bbc3f1e1881e01b2c8ce9227)
On the Iris Xe (ANV, Mesa 26.2.6) the check's DmaBuf class stayed Unchecked for every access
and row end, so a guest's surfaces over dma-buf pages took the shadow (the reims guest counted 756
of 786 shadows there). ExportedPages::make exported its pages fine, but their no-copy buffer was
refused (Unsupported, HostMemory, NotRepresentable) both pointer-first and dma-buf-only (probe
job 7595), so the class had no pages to check.
The cause, measured by a matrix of exports and imports of a dma-buf of the device's own memory
(probe job 7667, every host-visible type, 1, 2, 5 and 6, against every other, each with and
without VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT): ANV takes the import exactly where its
device-address flag matches the allocation's, and refuses it with
VK_ERROR_INVALID_EXTERNAL_HANDLE where it differs, whatever the memory types. The export was
allocated without the flag; import_dma_buf imports a buffer's dma-buf with it (bufferDeviceAddress
is enabled there), and every block of the runtime's own carries it (BlockMaker::make_as).
- ExportedPages::make allocates with the device-address flag where the device enables
bufferDeviceAddress, as every allocation of the runtime's does.
- import_dma_buf gives an image's dedicated import the flag too, so every import of one dma-buf
(the check's buffer and its textures' images share one) and the device's own allocation of it
agree.
- ExportedPages::make takes a host-cached type first, system memory before device-local: on the
Iris every host-visible type is device-local, so the old rule (cached system memory, else
system memory, else the first) took type 1, which is uncached, and the whole check took 19.0 s
there (job 7667). RADV and NVIDIA, whose cached types are system memory, keep the type they
had.
- CHECK_VERSION 9: a record of 8 holds the DmaBuf class unchecked on ANV, which the check now
answers.
- The check's device test (the_in_place_check_imports_its_dma_buf_pages_as_dma_bufs) passed where
the device exported pages it then refused to import, as "exports no dma-buf pages"; such a
refusal now fails it. Before this fix that is what the Iris did (job 7595: both imports
refused).
- The module doc no longer says ANV takes its own mapped allocation's pointer: lavapipe does
(job 7573), ANV refuses it (job 7667).
Verified with the flag fix alone (job 7667, ms01 Iris, release --cfg m2v_gpu at the probe tree
c2e854b698): the device test passed, with "pointer-first import over the dma-buf true, dma-buf-only
true; the DmaBuf verdicts [Passed, Failed, Failed, Passed, Passed, Passed, Passed, Passed]" (rows
inside lines: reads, renders, writes, buffer writes; then rows on lines) and the guest's 234x18
BGRA8Unorm texture at 1024-byte rows in place. A fresh check answered DmaBuf as Fresh and Pointer
answer (renders and writes Failed only for rows inside lines). The cached type and the test's
refusal check: pending (next Iris run).
(cherry picked from commit 8bbc7686c038ae7ca309361aced2219e434f5d1c)
inplace narrow stores: Access::NarrowWrites and NarrowBufferWrites, checked apart by the device's in-place
check (CHECK_VERSION 9, 36 verdicts), so R8/A8/RG8/R16 textures a shader writes over host pages are no
longer shadows by store width (the guest had 23 such textures). A narrow failure never fails the wider
verdicts. Verified by inplace on the M3: 44/44 (7736), clippy m2v_gpu (7726); check time in release
0.36-0.77 s base against 0.37-0.45 s tip (7773), narrow rounds 9 ms of a 289 ms check. MoltenVK refuses a
256 pitch for these textures, so the in-place half awaits lavapipe and the 780M (gem10 7728/7729).
The last of the narrow store shapes was a 1024x1024 R8Uint surface at a 1024-byte pitch. On the
M3 (release, job 7745's probe) its three rounds took 7.5-8.4 ms of each class's 14-16 ms of
narrow rounds, and the narrow rounds put the whole check 30 ms past the base's (0.33 s to
0.36 s; the base's spread is about 7 ms). A sixteenth of its rows keeps its 1024-byte rows, the
row width of the largest such guest texture, and the many workgroups of its dispatch, and cuts
its fill, word-per-texel source and compare by sixteen.
Verified: cargo fmt; the shape tests read NARROW_STORE_SHAPES and name no size. The check's
time is measured again on the M3 in the next jobs.
(cherry picked from commit 3927363fbd5883c78cf2835255ae145e2f1541f3)
clippy (--cfg m2v_gpu, the M3's job m3-max-7723) refused chunks_exact(4) with a constant size.
Verified: the M3's clippy of the runtime reruns next.
(cherry picked from commit 7f60624041671d7a0d8d5888003a5555f267f938)
the_answer_is_the_route_the_texture_takes made an R8Unorm texture a shader writes and required
Shadow(StoreWidth { texel_bytes: 1 }). The device's check now stores 1-byte texels, so the M3
(job m3-max-7687) answered InPlace there, and the test failed. The case now works out the
texture's row ends and padding and the narrow writes check of them (Access::written), and
requires the answer that verdict gives: in place, or refused by the image, where it passed; the
shadow naming the failed or unchecked writes check where it did not; Pending while pending.
made_as_asked still requires the texture made to match the answer.
Verified: cargo fmt; the M3 run follows.
(cherry picked from commit ef07355d5f25ffb3e158fdfb1ac2fc5d2695dc78)
The import served only the_in_place_check_imports_its_dma_buf_pages_as_dma_bufs, which is
cfg(target_os = "linux"), so the macOS build of the runtime's device tests (--cfg m2v_gpu)
warned that it was unused. Warnings are errors in clippy. The test now names the type by its
path, and the import is gone.
Verified: the M3's --cfg m2v_gpu test build (job m3-max-7676) printed the warning before this
change; the rebuild follows in the M3 run.
(cherry picked from commit 568d5b3bb6abf2af449c670b51661c0c0d4fae30)
Two passages still said a shader's writes of 1- or 2-byte texels keep a texture over host pages a
shadow: the shadowed-texture entry of docs/API.md's degrade-notice catalogue and the host-pages
bullet of docs/FAST-PATHS.md's costs. The device's check now stores those widths too; a texture
is a shadow by its width only for a width outside the ones it stores.
Verified: docs only; grep finds no other passage that names 1- or 2-byte written texels as a
shadow's cause.
(cherry picked from commit 90bd51d7a55257a40e115c55da2a53c7bb0b4f80)
the_in_place_check_checks_fresh_pages_where_held_imports_cost_submissions compares a device's
Fresh verdicts (each access for each row ends) with all-unchecked where the device lays no long
buffer in fresh pages. It wrote that as [Unchecked; 6], the count from when three accesses
existed (532fc35b7a). Since BufferWrites there are 8, and with the narrow accesses 12, so that
branch could never pass. The count now comes from RowEnds::ALL and Access::ALL. The DmaBuf test's
printed legend names the narrow accesses too.
Verified: cargo fmt; the test runs in the device jobs that follow (lavapipe, M3, Radeon 780M).
(cherry picked from commit 8c28280b17d260effe202cc90fb0f2353b9889d6)
Two lines of the module docs ran past 100 columns after the narrow rounds were added; rewrapped,
and the free-padding verdicts name the narrow form beside the wide one.
Verified: cargo fmt; no line of in_place_check.rs passes 100 columns.
(cherry picked from commit 47b865ab1de2318db21192d724062d1fee27f9f4)
In every guest session reims measured (Iris Xe and Radeon 780M, macOS 26.7.2 guests),
host_texture_shadows_store_width was 114, from 23 distinct R8Unorm, A8Unorm and R16 textures a
shader writes (32x32 at 256-byte rows among them). They were shadows because the in-place
check's write kernel stored only 4-, 8- and 16-byte texels (STORED_TEXEL_BYTES,
ShadowCause::StoreWidth), so no check covered a driver's writes of narrower ones.
What changes:
- in_place.rs (from selfread's parked 0c587bcad5): Access gains NarrowWrites and
NarrowBufferWrites, with 36 verdicts instead of 24. Access::written picks the writes check of
a texel width and padding. STORED_TEXEL_BYTES holds 1, 2, 4, 8 and 16; NARROW_TEXEL_BYTES
holds 1 and 2. in_place asks the written check in place of Writes. The report names
"narrow writes" and "narrow buffer writes". CHECK_VERSION goes to 9 (development's dma-buf
import fix took 8).
- in_place_check.rs: NARROW_STORE_SHAPES, rounds of their own for the narrow accesses, through
the copy-in kernel's R8_UINT and R16_UINT views (a801dac7d7). The shapes are packed R8 256x16
and R16 128x16 at 256; R8 61x37 and R16 45x29 at 256, whose rows end inside a word and whose
heights are odd; the 16- and 64-byte tight pitches; and an R8 1024x1024. The source buffer
holds a word per texel, the texel's bytes low and zeros above, since CopyIn takes 4*words()
bytes a texel. A narrow round's change fails only the narrow verdicts, never a 4/8/16-byte
texture's. A device whose kernel or image is not made (no shaderStorageImageExtendedFormats)
leaves them unchecked.
- in_place::storable: one helper for a render target's storage usage, used by route.rs and
storage_form.rs. It asks Access::written(texel, Padding::Kept) instead of Writes, so a narrow
render target never takes the 4-byte verdict. writes_reach (the storage usage an image that
does not render takes beyond its usage) and fresh_pages_take ask the written check of the
texels' width; InPlaceWatch carries the width.
- InPlaceAccess::Writes covers the narrow accesses. Docs (in_place, the check, API.md, HOWTO,
FAST-PATHS row, runtime README, WorkCounts, HostPageTexturePolicy, TextureShadowReason) say
1, 2, 4, 8 and 16 bytes, with narrow writes checked apart. The lane's VERDICTS goes to 36.
Tests:
- The decision test runs every width, 3 bytes for StoreWidth among them, against narrow answers
that differ from their wide twins'. It also checks storable.
- Shape tests cover the narrow set: tight pitches, row ends at 16/64/128/256, free padding.
- New: each_check_of_storage_writes_stores_its_texels_width. A narrow tally case.
- New device test narrow_writes_device: the guest's 32x32 R8Unorm and A8Unorm (and RG8Unorm and
R16Unorm) at 256-byte rows over a no-copy buffer. Each takes its narrow verdict's path, its
placement query agrees, a kernel's writes reach the bytes, and the padding and the bytes past
the last row are kept.
- in_place_storage adds an R8Unorm render target.
Verified: not yet built; the build, clippy, unit and device runs follow as jobs.
(cherry picked from commit dbb985df199b1c46bb783aafbd50efd40bcab187)
The device's in-place check stores every texel of an image a shader writes through the
crate-owned copy-in kernel (Texture::store_in_place), whose views covered texels of 4, 8 and 16
bytes alone, so a texture of 1- or 2-byte texels that a shader writes (R8Unorm, A8Unorm, RG8,
R16) had no check of its writes and stayed a shadow (host_texture_shadows_store_width: 114 in a
guest session on the Iris Xe and on the Radeon 780M, 23 distinct R8, A8 and R16 textures). This
gives the check a kernel that stores such texels.
ShadowTexelView gains R8Uint and R16Uint (storage formats R8ui and R16ui, extended formats like
Rg32ui). A narrow texel takes a whole word of every shadow kernel's word buffers, its bits low and
zero above them, as an unsigned fetch returns it: words() is 1, so every module's addressing is
unchanged. The copy-in kernel keeps the word's low byte or bytes for the texel it stores and the
word it keeps alike (a stored value its format represents, and a kept word a fetch reads back
equal); copy back and the merges move the fetched word as for any one-word view. Such a view's
kernels move narrow texels through buffers of a word per texel, never through a narrow texture's
own rows, whose texels share their words: the runtime's shadows keep picking views of 4, 8 and 16
bytes alone (shadow_copy_back::word_format), and the kept images' formats name the two new views
for exhaustiveness. ShadowMergeRead::ALL lists their word reads; api_signatures.tsv follows.
Tests: the copy-in, copy-back and image-merge interpreter tests run through every view, a narrow
view's image texel x + 0x1d * y in its bits so its rows differ; the copy-in validity test skips
the three extended views where a profile lacks the formats; owned_divisions builds every view.
Verified: pending (the translator's unit tests and the runtime build run in the stacked checks).
(cherry picked from commit c1ebd43750bce173bb0e6ab3c16cb5696718bfbd)
amdperf-32: the snapshot-or-split choice for a draw that reads its pass's color now follows that
reader's coverage, measured by an occlusion query in its last pass (readers only, no query inside an
app's counting visibility query or an instance of views), with up to 16 spare query pools a device.
New WorkCounts: reading_draws_by_coverage, coverage_queries, coverage_pools_made. Verified by amdperf:
tests::learned_coverage and the reader tests 41/41 on the Iris (7575), XTX (7578), 780M (um870 7628),
lavapipe (7727) and the M3 (7584); clippy x3 and rustdoc on gem10 7576. Cost: lavapipe +37
instructions a draw (0.11%); query cost 1.00-1.06 Iris, 1.00-1.01 780M, 1.00-1.08 XTX. Crossover against
pre-amdperf-30: Iris learned sparse rows 0.37-0.85, self_reads 3662x2039 11.10 -> 1.74 ms; XTX 0.68-1.05;
780M dense 1.00, self_reads 9.57 -> 2.33 ms.
FAST-PATHS' attachment-read paragraph and render/snapshot.rs now state what learned coverage
does where the device measures readers, and the measured results against the build before the
area rule (pre) and the spare-pool scratch (q4):
- Iris Xe (job 7575, pre from 7439): crossover rows at most 1.03 times pre, except 320x180
readers covering 1.5% or 12.5% (both builds snapshot) at 1.05-1.07, the query's own cost;
readers that learned a dense coverage now split (area lane 0.99-1.01 of the split).
- RX 7900 XTX (7578, pre from 7481): 0.68-1.05 of pre after the control's drift between runs;
per-round spread up to 1.4x.
- Radeon 780M (um870, 7628): dense readers 1.00 of pre; readers over 12.5% of a scissor their
pass filled whole 1.15-1.26 of pre, as the area-rule control takes too.
The spare-pool doc states the Iris measurement: from pools made a pass, the measured readers
took 1.07-1.19 times the same forms unmeasured, and from spare pools 1.00-1.06.
(cherry picked from commit 1978c9008cf2ee9a7d90033e940a93ba24680fbe)
A pass without readers of its own colors now keeps a null pointer for them instead of the
state's vectors and options, so the lowering of every pass grows by one word. lavapipe's
frame_costs_plain (job 7482) counted 30 more instructions at a pass's opening, 66 at a draw and
59 at a pass's end for the build before, against the build without learned coverage.
(cherry picked from commit b3d187f0ced28dc3a67dc72e0f5ddf46b6eeb271)
The Iris Xe A/B (job 7439) put the coverage queries at about 15% of the GPU time of
snapshot_crossover's private passes, with the same forms as the build before (q scratch against
ctl, and tip against ctl where they took the same form), while the area lane (one command buffer
a frame, waited for) showed 0.2-0.5% and self_reads 2%. The crossover commits four command
buffers back to back, so each pass's pool was released while the next pass ran on the GPU.
A device now keeps up to 16 pools no pass holds (render/coverage.rs SparePools): a pass that
measures a reader takes one, reset on the host, and gives it back as its command buffer
completes; a pass makes one only where none has come back. Released as the device ends.
Counted: WorkCounts::coverage_pools_made; tests::learned_coverage asserts at most two pools over
its seven passes.
(cherry picked from commit f1e328796c8218553c5834e4044a71bdebaf9be5)
The view shadow's Texture::root already walks a view to the texture it was made from; the copy
in texture.rs duplicated it. The replay lowering (render/executions.rs) builds a RenderLowering
of its own and now starts with no readers. Readback reads the results of the queries its
readers took, the pool's first ones, not all 64.
(cherry picked from commit 599984b2e727c986e50ec59bd0f83dea63a3cc61)
A precise occlusion query begun in a subpass with a view mask uses one query of the pool for
each view (VUID-vkCmdBeginQuery-query-00808), which would overlap the next reader's query. The
snapshot path refuses passes of more than one layer, so no measured reader draws views today;
the filter makes the query's recording not depend on that.
(cherry picked from commit d7b0e5652610fb46d5288d53e7c514c8258860cf)
The area rule weighs a reader through no scissor at the share least favourable to each form,
since a draw's recording cannot know what it covers. A 1280x720 or 1080p reader covering the
whole target therefore took the snapshot, 1.97-2.34x the split's GPU time on the Radeon 780M,
while the consumer's readers over 3% of a 3662x2039 target need the snapshot (Iris 12.8 ->
1.7 ms a frame). Both shapes weigh the same at recording, so no static rule serves both.
Now, on a device with occlusionQueryPrecise that resets queries on the host, each reader the
rule would weigh records its drawing commands inside a precise occlusion query of its pass's
own pool (render/coverage.rs). As the command buffer completes, the count is kept on the
reader's first color's texture, keyed by the pipeline state and the reader's place among that
state's readers of the texture in the pass. Later passes weigh that reader at its count: the
snapshot where SNAPSHOT_PIXEL_COST per covered pixel per color costs no more than the split's
copy. A device without precise queries or host reset, a reader inside an app's visibility
query (already refused the snapshot), a pending pipeline's draw and a replay record no query
and keep the area rule. Instances recorded inline after a split keep the query's begin and end
with their draws. Both forms are exact; a stale count costs the form it chose until a pass
after the change completes.
Counted: WorkCounts::coverage_queries and reading_draws_by_coverage. The crossover lane runs
each cell once untimed so its timed frame is weighed by the learned count.
Tests: tests::learned_coverage (forms and bytes across a sparse -> whole -> sparse change;
an app's Counting visibility query keeps its count with a reader inside), coverage unit tests.
(cherry picked from commit 1108cd1bdebfb15f9da91b39ed80d91d8624bc28)
wake's readied host-copy blocks (20038c5c45) added WorkCounts::host_copy_blocks_readied:
a block for color host-copy images made ready off the program's thread. The case's first
host-copy texture now lands in a readied block (1); its record predates the count, so the
replay held it to 0 (round at 9bd38c7994, m3-max-7680: that case, that field alone over
bounds; 35333 counts gated within bounds otherwise). Recorded on the M3 at 12b73cfe04 (s37-pl.sh
record: the whole-set write, every other record put back, then cost --alone --write and
times over the one case). Records outside it touched: 0.
(cherry picked from commit 322a3752ecc68396fcccd92152ee05d2f53fae0d)
The exit hook now runs ahead of the destructor of anything a returned pipeline making registered (a static
of the driver's compiler, or a library loaded at its first compile), and it still waits for makings in
progress. This closes the NVIDIA exit-time crash in the driver's SPIR-V compiler racing teardown.
Verified by perdraw: fork tests with a negative control on msi 7686 (43 vs 42 with the registration
removed, pass restored), and the exits lane making_exit case 10/10 on the M3 (7685, 7695: pool_busy=1,
at_makings=1, clean exits in 18-22 ms) and 10/10 on lavapipe (7686). Clippy in three cfgs and rustdoc on
7686. A 5080 entry is queued.
The parent prints the child's line and holds it to a registration after a making:
the evidence that the program's thread's making registered the hook again, and
whether the pool's making was still in progress at the exit (pool_busy).
Verified: cargo fmt only locally.
(cherry picked from commit 37637be4d47b303840e65c810997f582bb31b8ff)