From 21cac7f7af4d8b1333b5cf87b0642d2ec7742afc Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Wed, 11 Nov 2026 04:25:00 -0800 Subject: [PATCH] tests::in_place_check: the check's notes of shapes it made no image of say why in words What: a device test that settles the in-place check on a fresh cache and reads its notes of shapes it made no image of in place: each must hold no internal error and no value's debug form ("Internal", "compile failed", "Shadow(", "Refused(", " { "); and on a driver that renders an explicit plane's rows past its height (lavapipe), the dma-buf class's reads of rows inside lines must stay unchecked, noted for the pitch, a cause that lasts. Every such note is printed (IN-PLACE-NOTE). Why: on every device the check notes those shapes as "its making failed: compile failed: Internal(InternalError { kind: Invariant, ... }); it took no image in place: Shadow(Refused(Pitch))" (seen on the RTX 5080 and others): an internal invariant error for an expected outcome, and the placement's debug form for its cause. The consumer reads these notes. Verified: this commit alone is the negative control: the test fails here, at the base, on lavapipe (run in the next commit's evidence); the next commit makes it pass. --- .../src/tests/in_place_check.rs | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/crates/metal2vulkan-runtime/src/tests/in_place_check.rs b/crates/metal2vulkan-runtime/src/tests/in_place_check.rs index 6a8b093d0..12e256d71 100644 --- a/crates/metal2vulkan-runtime/src/tests/in_place_check.rs +++ b/crates/metal2vulkan-runtime/src/tests/in_place_check.rs @@ -350,6 +350,63 @@ fn an_unchecked_verdict_is_checked_again_where_its_cause_may_pass_and_kept_where ); } +/// The check's note of a shape it made no image of in place says why in words: the placement's +/// answer, then the making's refusal (`in_place_check.rs`'s `unmade`, `Error::NotInPlace`), with +/// no internal error and no value's debug form in it; and its verdict and whether its cause lasts +/// are as before. On a driver that renders an explicit plane's rows past its height +/// (`RuntimeDriverDefect::ExplicitPlaneRowsPastHeight`, lavapipe), the dma-buf class's reads of +/// rows that end inside lines, of which the device makes no image at the pitch (no shape of the +/// check whose rows end inside lines has a height that is a multiple of 4): unchecked, for a +/// cause that lasts, which the note names. Printed (`IN-PLACE-NOTE`): each such note. +#[test] +fn the_in_place_checks_notes_say_in_words_why_it_made_no_image() { + let scratch = Scratch::new("in-place-check-notes"); + let device = device(&scratch.0); + assert!(device.settle_in_place_checks(WAIT), "the check answered"); + let mut report = device.in_place_check_report(); + let notes = report.split_off(crate::in_place::VERDICTS); + let unmade: Vec<&String> = (notes.iter()) + .filter(|note| note.contains(" image of ") && note.contains(" bytes apart: ")) + .collect(); + for note in &unmade { + eprintln!("IN-PLACE-NOTE on {}: {note}", device.name()); + } + eprintln!( + "IN-PLACE-NOTES on {}: {} of shapes made no image of", + device.name(), + unmade.len() + ); + for note in &unmade { + for debug in ["Internal", "compile failed", "Shadow(", "Refused(", " { "] { + assert!( + !note.contains(debug), + "a note in words, no {debug:?}: {note}" + ); + } + } + let past_height = (device.properties().driver_defects) + .contains(&metal2vulkan::error::RuntimeDriverDefect::ExplicitPlaneRowsPastHeight); + if past_height { + let verdict = device.in_place_verdict(PagesClass::DmaBuf, Access::Reads, RowEnds::InLines); + assert_eq!( + verdict, + InPlaceVerdict::Unchecked, + "the dma-buf class's reads of rows inside lines: {notes:#?}" + ); + let pitch = "no image the device makes lays the rows at their pitch"; + let named = (unmade.iter()).any(|note| { + note.starts_with("DmaBuf reads: no ") + && note.contains(pitch) + && note.ends_with("(a cause that lasts, kept)") + }); + assert!( + named, + "the dma-buf class's reads of rows inside lines noted unmade for the pitch, a cause \ + that lasts: {notes:#?}" + ); + } +} + /// A private 4x4 `RGBA8Unorm` texture of the program's, at a plain ID. fn texture(device: &Device) -> Texture { let mut descriptor = TextureDescriptor::texture_2d(PixelFormat::RGBA8Unorm, 4, 4, false);