In-place reads: the lane test and docs name the devices whose passes fetch no color

A pass on a device with rasterization-order color attachment access (lavapipe) or without the
pixel interlock (the RX 550) fetches its colors as input attachments, and in place, like the
snapshot, takes no such pass (its subpass would name the color in two layouts). The lane test
asserts the read in place only where the device's passes fetch no color, and API.md, FAST-PATHS.md
and render/snapshot.rs say which devices keep the copy.

Verified: lavapipe lane job m3-max-22227 (msi) at e83d75fe83: 33 of 34 attachment-read, snapshot
and in-place tests passed, debug and under METAL2VULKAN_LANE_VALIDATION=sync; the one failure was
this expectation (lavapipe fetches through inputs: copies 1, in place 0).
This commit is contained in:
Anees Iqbal committed 2026-11-12 11:55:21 -08:00
1 parent 7284147b43
commit 99146ff67f
4 files changed
+33 -15

No files matched your search

@@ -66,8 +66,11 @@
//! not, where the device enabled `attachmentFeedbackLoopLayout`, the color renders the
//! texture's image in place with feedback loop usage, no other color renders that image, the
//! pipeline fetches no color, and the checks below that concern the pass and its colors hold
//! (`RenderLowering::in_instance`: the pass's shape, the format, the pins, one image a color);
//! not those of the second draw (the area rule, its features, the visibility query). The color
//! (`RenderLowering::in_instance`: the pass's shape, among it no input attachment fetch, which
//! every pass with a color makes on a device with rasterization-order color attachment access or
//! without the pixel interlock, `framebuffer_fetch::through_inputs`, as its subpass would name
//! the color in two layouts; the format, the pins, one image a color); not those of the second
//! draw (the area rule, its features, the visibility query). The color
//! is in the feedback loop layout for the instance as below, the pipeline made with
//! `VK_PIPELINE_CREATE_COLOR_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT` (`GraphicsKey::feedback_loop`),
//! and the slot bound to the texture in that layout. `B1` before the draw, from the color
@@ -1,7 +1,10 @@
//! Device tests of a draw that reads, at its own pixels, a texture its own render pass instance
//! renders as color 0, and writes nothing of that color: it writes what it read into color 1
//! alone (`ipr_read_second` of the owned fixture `ipr_reads.metal`), under the validation layer.
//! Where the device enabled `attachmentFeedbackLoopLayout` and the color's image took feedback
//! Where the device enabled `attachmentFeedbackLoopLayout`, its passes fetch no color as an input
//! attachment (it has `fragmentShaderPixelInterlock` and not
//! `rasterizationOrderColorAttachmentAccess`: lavapipe and a device without the interlock fetch
//! so, and their subpass would name the color in two layouts) and the color's image took feedback
//! loop usage, the draw reads the attachment in place, with a memory barrier before it or not
//! (`render/snapshot.rs`, in place; `WorkCounts::reading_draws_in_place`): no copy, snapshot or
//! split, and it reads what the draw before it wrote, the x86 Macs' answer (`docs/API.md`'s
@@ -18,8 +21,8 @@
//! - [`a_reader_that_writes_nothing_of_its_color_reads_in_place`]: a private target, and a surface
//! over host pages (a texture of an IOSurface plane over a no-copy buffer, as a compositor's
//! guest makes its layers), each with the barrier and without: in place wherever the device
//! enabled the feature and the image the pass renders took feedback loop usage (the counts
//! printed say).
//! enabled the feature, its passes fetch no color, and the image the pass renders took feedback
//! loop usage (the counts printed say).
//! - [`with_the_feedback_loop_withheld_it_reads_the_copy`]: the private target with
//! `attachmentFeedbackLoopLayout` withheld: the copy, [`CLEARED`] without the barrier.
@@ -246,6 +249,13 @@ fn holds(what: &str, bytes: &[u8], block: u8, outside: u8) {
}
}
/// Whether `device`'s passes fetch no color attachment as an input attachment: it has the pixel
/// interlock and not rasterization-order color attachment access (`framebuffer_fetch.rs`).
fn fetches_no_color(device: &Device) -> bool {
let fragment = device.compile_device().profile().fragment();
fragment.pixel_interlock && !fragment.rasterization_order_color_access
}
/// The lane's device under the default policy, the consumer's, with `adjust` applied too.
fn on_default_policy(adjust: impl FnOnce(&mut DeviceOptions), test: impl FnOnce(&Device)) {
on_device_with(
@@ -269,10 +279,11 @@ fn a_reader_that_writes_nothing_of_its_color_reads_in_place() {
let left = read_pass(device, &queue, surface, barrier);
let moved = &left.moved;
eprintln!(
"in-place reads, {what}, feedback loop {}: {moved:?}",
left.feedback
"in-place reads, {what}, feedback loop {}, fetches no color {}: {moved:?}",
left.feedback,
fetches_no_color(device)
);
if left.feedback {
if left.feedback && fetches_no_color(device) {
let want = Moved {
in_place: 1,
snapshotted: 0,
+8 -6
View File
@@ -5020,12 +5020,14 @@ each item named states the rule in full.
Graphics 630 (macOS 26.7.1) it read the earlier draw's texels at 98.6% and 99.99% of the pixels,
and at all of them after a barrier over the render targets; the rest read the load's or the
clear's texels. The runtime answers as the x86 Macs, which costs no copy: where the device
enabled `attachmentFeedbackLoopLayout`, a draw whose fragment function reads the texture at the
fragment's own pixel alone, and that writes no channel of the color, reads the attachment
itself, behind a barrier inside the pass, and sees the load and every earlier draw of the pass
(`WorkCounts::reading_draws_in_place`, the runtime's `render/snapshot.rs`). A draw that writes
the color it reads still reads a copy taken before the pass, the M3 Max's answer, and so does
every such draw on a device without the feature.
enabled `attachmentFeedbackLoopLayout` and its passes fetch no color as an input attachment (it
has `fragmentShaderPixelInterlock` and not `rasterizationOrderColorAttachmentAccess`), a draw
whose fragment function reads the texture at the fragment's own pixel alone, and that writes no
channel of the color, reads the attachment itself, behind a barrier inside the pass, and sees
the load and every earlier draw of the pass (`WorkCounts::reading_draws_in_place`, the runtime's
`render/snapshot.rs`). A draw that writes the color it reads still reads a copy taken before the
pass, the M3 Max's answer, and so does every such draw on any other device (lavapipe, which has
rasterization-order access, and a device without the interlock, such as the Radeon RX 550).
**GPU hangs and faults** (a draw of private primitive type 9, `DrawPrimitiveType::Nine`)
+3 -1
View File
@@ -280,7 +280,9 @@ recorded here.
pass that loads it (`shadow_standing.rs`, `WorkCounts::shadow_texels_unskipped_stale_within`).
A draw that reads the color at its own pixels alone and writes no channel of it reads the
attachment in place instead, no copy, with a barrier before it or not, where the device enabled
`attachmentFeedbackLoopLayout` (`render/snapshot.rs`, `WorkCounts::reading_draws_in_place`):
`attachmentFeedbackLoopLayout` and its passes fetch no color as an input attachment (it has
`fragmentShaderPixelInterlock` and not `rasterizationOrderColorAttachmentAccess`; lavapipe and
the RX 550 keep the copy) (`render/snapshot.rs`, `WorkCounts::reading_draws_in_place`):
a by-region barrier before it orders the load's and the earlier draws' writes before its reads,
and one after it its reads before the later color writes. With no barrier it then reads what the
earlier draws wrote, the x86 Macs' answer, where the M3 Max reads the texels from before the pass