From daaccb7bb0f49ab1ca10634b6b44718ce4c0f892 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Sun, 22 Nov 2026 15:18:47 -0800 Subject: [PATCH] Tests: the later-sharer test prints the device's counts once all completed too What: every_device_copies_an_idle_queues_copy_of_a_long_write_into_a_later_sharer prints the device's metrics a second time, once every command buffer has completed and before its assertion. Why: the planner's reading of the (h3) job needs proof that the second copy's submission went before the writer's last piece. That proof is Metrics::pieces_passed: a submission of a queue that went to the VkQueue while another queue's cut command buffer still had pieces not submitted (WorkState::close counts it while that command buffer is still its queue's head, and the head leaves its FIFO once its last piece is staged). The first copy is held until the writer's last piece is staged, so in this test only the second copy can make that count. The first print comes before the gate opens, before any of that happens. Verified: not run when committed. --- crates/metal2vulkan-runtime/src/tests/command.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/metal2vulkan-runtime/src/tests/command.rs b/crates/metal2vulkan-runtime/src/tests/command.rs index b4788c692..0fc88218c 100644 --- a/crates/metal2vulkan-runtime/src/tests/command.rs +++ b/crates/metal2vulkan-runtime/src/tests/command.rs @@ -2046,8 +2046,10 @@ pub(crate) mod on_device { /// looked past the second copy (an empty command buffer committed after it is scheduled) the /// gate opens. Metal submits the first copy at its commit, its queue having nothing ahead of /// it, so its hazard tracking orders that copy after the writer and the second copy after it: - /// both read every step. The device's counts once the copies were seen are printed, so a run - /// shows the shape it held (the cuts and the copies held behind the writer, where counted). + /// both read every step. The device's counts are printed once the copies were seen and once + /// all completed, so a run shows the shape it held, where its tree counts it: the cuts, the + /// copies held behind the writer, and the submissions that went before a cut command buffer's + /// pieces not yet submitted. #[test] fn every_device_copies_an_idle_queues_copy_of_a_long_write_into_a_later_sharer() { each_device("command_sharer_behind_held", |name, _, device| { @@ -2097,6 +2099,8 @@ pub(crate) mod on_device { finished(name, command_buffer); assert_eq!(command_buffer.error(), None, "{name}"); } + let counts = device.counters().metrics(); + println!("{name}: the device's counts once all completed: {counts:?}"); assert_eq!( (word(&written), word(&copied), word(&read)), (63, 63, 63),