diff --git a/crates/metal2vulkan-runtime/src/tests/compute.rs b/crates/metal2vulkan-runtime/src/tests/compute.rs index 41ea68da7..f791261e4 100644 --- a/crates/metal2vulkan-runtime/src/tests/compute.rs +++ b/crates/metal2vulkan-runtime/src/tests/compute.rs @@ -191,8 +191,11 @@ pub(crate) mod on_device { size: [4, 5, 6], }; let mut per_dispatch = Vec::new(); - // No region, a region set before each dispatch, and the setter with no dispatch. + // No region, a region set before each dispatch, and the setter with no dispatch. The + // kernel's rate 1 ps a threadgroup, the test's own input, so each arm's dispatches + // share one piece (`crate::piece`): no arm pays for a cut the others do not. for (set, dispatched) in [(false, true), (true, true), (true, false)] { + state.inner.compiled.rate.set_for_test(1); let command_buffer = queue.command_buffer().expect("a command buffer"); let mut encoder = command_buffer .compute_command_encoder(DispatchType::Serial) @@ -361,11 +364,14 @@ pub(crate) mod on_device { let expected: Vec = (0..WORDS as u32).map(chained).collect(); assert_eq!(words(&x), expected, "{name}: dependent"); - // Independent: each dispatch has a buffer of its own. + // Independent: each dispatch has a buffer of its own. The kernel's rate 1 ps a + // threadgroup, the test's own input, so the dispatches share one piece + // (`crate::piece`) and the barriers counted are the hazards' alone; so too below. let buffers: Vec = (0..count).map(|_| arena.buffer()).collect(); for buffer in &buffers { write_words(buffer, |index| index); } + state.inner.compiled.rate.set_for_test(1); let before = device.counters().metrics(); let command_buffer = queue.command_buffer().expect("a command buffer"); let mut encoder = command_buffer @@ -389,6 +395,7 @@ pub(crate) mod on_device { // Concurrent: barriers where asked for, and none at the hazards. write_words(&x, |index| index); + state.inner.compiled.rate.set_for_test(1); let before = device.counters().metrics(); let command_buffer = queue.command_buffer().expect("a command buffer"); let mut encoder = command_buffer diff --git a/crates/metal2vulkan-runtime/src/tests/surface.rs b/crates/metal2vulkan-runtime/src/tests/surface.rs index e30555459..dbf3ea7e0 100644 --- a/crates/metal2vulkan-runtime/src/tests/surface.rs +++ b/crates/metal2vulkan-runtime/src/tests/surface.rs @@ -1106,6 +1106,11 @@ mod on_device { let out = (device.new_texture(&d, Some(first + 1))) .unwrap_or_else(|error| panic!("{label}: the output: {error}")); let pair = |target: &crate::Buffer| -> u64 { + // Each kernel's rate 1 ps a threadgroup, the test's own input, so the two dispatches + // share one piece (`crate::piece`) and the barriers counted are the pair's own. + for state in [add, invert] { + state.inner.compiled.rate.set_for_test(1); + } let before = counters.metrics().barriers; let command_buffer = queue.command_buffer().expect("a command buffer"); let mut encoder =