From ac9cad48bf56ae6f0c330ec3e4620182034516a3 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Mon, 16 Nov 2026 17:27:38 -0800 Subject: [PATCH] Tests: a pass's shared copy barriers and the type 9 hang scenarios begin once the view check answered runtime_lane::pitched_surfaces::a_pass_s_copies_in_share_their_barriers and runtime_lane::private_primitives::type_nine's hang scenarios each make a device over a fresh scratch cache, which holds no record of the device's view check, so the check (RUNTIME 2495, f2367d8956) runs from the device's making on a thread of its own. Beside the runtime lane on the RTX 5080 Laptop GPU it ran into what the tests count and time: - The barrier count is the device's: in the last counted pass the view check's internal submissions (one dispatch between two timestamps each, a barrier before) added 2 and 15 barriers (1 against 3 and 16, internal_submissions +3 and +14), the pass's own staying 1. - The hang test's first scenario overlapped the check's making of its pipelines (compute_pipeline_create_nanos +833 ms, an 18.5 ms vkQueueSubmit, steps_aside 2 -> 8): the other queue's command buffer read Scheduled 103.2 ms after its commit, past the hang, with no cross-queue hold counted (heads_held_for_earlier_commits, batches_held_for_another_queue, heads_held_for_unshared_commits and heads_held_for_queue_turns 0 in every scenario). Both now wait for the view check's answer (Device::settle_view_check) right after making the device. Found with counter prints of every moved WorkCounts field (b5080 m3-max-38412, two runs beside the runtime_lane::p* tests). --- .../src/runtime_lane/pitched_surfaces.rs | 7 ++++++- .../src/runtime_lane/private_primitives/type_nine.rs | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/crates/metal2vulkan-validation/src/runtime_lane/pitched_surfaces.rs b/crates/metal2vulkan-validation/src/runtime_lane/pitched_surfaces.rs index 10afe5772..dba9b495a 100644 --- a/crates/metal2vulkan-validation/src/runtime_lane/pitched_surfaces.rs +++ b/crates/metal2vulkan-validation/src/runtime_lane/pitched_surfaces.rs @@ -1440,7 +1440,11 @@ fn a_shadowed_color_beside_a_memoryless_scratch_blends_over_part_of_it() { /// new resources' first work, which writes the command buffer's start stamp itself, and the second /// records the kept barrier command buffer that writes a start stamp, which each later command /// buffer with no first work takes again; `command_buffer/kept_barriers.rs`, -/// `WorkCounts::stamped_buffers_kept`). The buffer holds each +/// `WorkCounts::stamped_buffers_kept`), once the device's view check answered +/// (`Device::settle_view_check`): with no record of it in the scratch cache, the check runs from +/// the device's making, and each of its internal submissions records a barrier, which beside other +/// work landed in the counted passes (2 and 15 of them in the last, on the RTX 5080 Laptop GPU +/// beside the runtime lane). The buffer holds each /// texture's texels inside its rectangle, as the draws read them, and every other byte as it /// was. Printed: `SHADOW-RUN`. #[test] @@ -1453,6 +1457,7 @@ fn a_pass_s_copies_in_share_their_barriers() { let messages = Messages::default(); { let device = validated_device(TEST_DEVICE, &messages, cache.path()).unwrap(); + assert!(device.settle_view_check(WAIT), "the view check answers"); let queue = device.new_command_queue().unwrap(); let len = stride * (most + 1); let buffer = device.new_buffer(len, ResourceOptions::default()).unwrap(); diff --git a/crates/metal2vulkan-validation/src/runtime_lane/private_primitives/type_nine.rs b/crates/metal2vulkan-validation/src/runtime_lane/private_primitives/type_nine.rs index 11da1aa49..84369b2e2 100644 --- a/crates/metal2vulkan-validation/src/runtime_lane/private_primitives/type_nine.rs +++ b/crates/metal2vulkan-validation/src/runtime_lane/private_primitives/type_nine.rs @@ -440,12 +440,17 @@ fn scenario( /// Run each of `draws`'s scenarios on the test device and check it against `expected`. /// Its devices take their queue plan (`at_plan`): the work of the tests that call it -/// changes placements under the lane's queue limits. +/// changes placements under the lane's queue limits. The scenarios begin once the device's view +/// check answered (`Device::settle_view_check`): with no record of it in the scratch cache, the +/// check runs from the device's making, and beside other work its pipelines' making and rounds +/// ran into the first scenario, whose other queue's command buffer read `Scheduled` 103.2 ms +/// after its commit, past the hang (RTX 5080 Laptop GPU, beside the runtime lane). fn answers_as_metal_does(draws: &[Draw], expected: Expected) { let cache = ScratchCache::new().unwrap(); let messages = Messages::default(); { let device = validated_device_with(TEST_DEVICE, &messages, cache.path(), at_plan).unwrap(); + assert!(device.settle_view_check(WAIT), "the view check answers"); let name = device.name().to_owned(); let lane = Lane::new(device); let pipeline = lane.pipeline("pt_plain");