From 3b176b8bd4756155b289e8964fe944ebc7a4dc83 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Thu, 5 Nov 2026 14:58:09 -0800 Subject: [PATCH] Expect a GPU fill of logged pages to gate the next copy in to its pages `a_gpu_write_of_the_pages_reaches_the_device_copy` expected the copy in after a blit fill of rows 40 to 47 of a buffer over logged host pages to copy every row (one gated copy, one whole), as when the log could not say which pages the GPU wrote. shadow-sync reports the runtime's own writes of logged pages to their log after they ran (`dirty_pages.rs`), so the next copy in is gated to the pages the fill wrote and none is whole. The test now expects that, and bounds the bytes copied to the fill's rows and the pages they lie in; its texel checks (the fill reaches the read, rows 40 to 47 read 0x5a) are unchanged. Verified: at d363fe79d2 on the RTX 5080 (b5080 entries in stack 33's gate and alone, 5 of 5) the copy in was gated 1, whole 0, and every texel check passed; this commit's run follows on the 5080. --- .../src/runtime_lane/device_copies.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/crates/metal2vulkan-validation/src/runtime_lane/device_copies.rs b/crates/metal2vulkan-validation/src/runtime_lane/device_copies.rs index a29bdf42a..e9269e884 100644 --- a/crates/metal2vulkan-validation/src/runtime_lane/device_copies.rs +++ b/crates/metal2vulkan-validation/src/runtime_lane/device_copies.rs @@ -356,16 +356,26 @@ fn a_gpu_write_of_the_pages_reaches_the_device_copy() { .all(|&byte| byte == 0x5a)); let counted = copied(&start, &device.work_counts()); eprintln!( - "DEVICE-COPY on {}: after the fill gated {}, whole {}", + "DEVICE-COPY on {}: after the fill gated {}, whole {}, bytes {}", device.name(), counted[1], - counted[2] + counted[2], + counted[4] ); if copies_on(&device) { + // The runtime reports its own write of the pages to their log (`dirty_pages.rs`), so the + // next copy in is gated to the pages the fill wrote: no whole copy, and at least the + // fill's rows but no more than the pages they lie in. assert_eq!( counted[1..3], - [1, 1], - "the fill let go of the hold: every row" + [1, 0], + "the fill's pages, gated: no whole copy" + ); + let fill = 8 * bpr; + assert!( + (fill..=fill + 2 * GUEST_PAGE as u64).contains(&counted[4]), + "the fill's pages alone: bytes {}", + counted[4] ); } drop((texture, buffer, target));