rt tests: a command buffer's GPU start may equal its end, as Vulkan allows

Vulkan orders timestamps (a later one is never lower) and lets a device write one at any
logically later point; Metal documents gpuStartTime <= gpuEndTime. Mesa's Apple-GPU driver
(KosmicKrisp, Mesa 26.3.1) asks Metal for relaxed timestamp granularity on a compute encoder, so
the two timestamps around a command buffer with no render pass read one value: on an M3 Max,
tests::command's every_device_retires_a_group_in_commit_order_each_with_its_own_times and
every_device_takes_again_the_slot_of_a_command_buffer_that_never_ran failed on start == end
(job m3-max-47313). The two tests now hold 0 < start <= end; the order across the group stays
strict. Product code is unchanged. The README's known gaps name the driver's answer.
This commit is contained in:
Anees Iqbal committed 2026-11-18 10:07:27 -08:00
1 parent 263077505e
commit 0d20ded2fe
2 files changed
+8 -2

No files matched your search

+4
View File
@@ -702,6 +702,10 @@ that touch blocks first.
(15 ms at the 90th). The last command buffer's own report is not late: on the 2080 it came
97.2-97.5 ms after its commit, where the old runtime's came 94.9-96.4 ms after. The harness prints each command buffer's lateness, from
its `gpu_end_time` to its completed handler (`late_us`).
- GPU start and end times are the device's timestamps. On Mesa's Apple-GPU driver a command
buffer with no render pass reports `gpu_start_time` equal to its `gpu_end_time`: the driver
writes both timestamps with Metal's relaxed timestamp granularity, which gives two writes in one
compute pass one value. Vulkan allows it: a later timestamp is never lower.
- Values the runtime reads back from GPU-written memory decide nothing beyond the reading command
buffer's own results (`src/readback.rs`; a rule test holds every such read there). The sites:
the two timestamp queries of a command buffer, which decide only its `gpu_start_time`, through
+4 -2
View File
@@ -1263,7 +1263,9 @@ pub(crate) mod on_device {
.map(|cb| (cb.gpu_start_time(), cb.gpu_end_time()))
.collect();
for &(start, end) in &times {
assert!(0 < start && start < end, "{name}: {times:?}");
// A later timestamp is never lower; a device may give two one value (Mesa's
// Apple-GPU driver does, outside a render pass).
assert!(0 < start && start <= end, "{name}: {times:?}");
}
for pair in times.windows(2) {
assert!(
@@ -1310,7 +1312,7 @@ pub(crate) mod on_device {
assert_eq!(again.status(), CommandBufferStatus::Completed, "{name}");
assert_eq!(word(&buffer), 5, "{name}");
let (start, end) = (again.gpu_start_time(), again.gpu_end_time());
assert!(0 < start && start < end, "{name}: {start} {end}");
assert!(0 < start && start <= end, "{name}: {start} {end}");
checked
});
drop((buffer, arena, queue, device));