What:
- A Metal command buffer's end timestamp is now the last command of its last segment, written
after close()'s tail: the copies back of the images its commands wrote and the end barrier,
with the present moves (record::end takes the stamp). Before, finish() wrote it ahead of
close(), so the tail ran outside the command buffer's GPU span. gpu_end_time's doc, the type's
doc, times.rs's module doc and the runtime README say where it sits now.
- The runtime's own command buffers take a stamp pair each from the same pools: every upload
(leading a submission or going alone) and every Managed copy-in. The start is written as the
buffer begins (times::begin_own) and the end as its last command (times::end_own). The pairs
are read on the completion thread as the buffers retire (times::retire_own), as a Metal command
buffer's are.
- Two new Metrics:
- runtime_command_buffers: those buffers passed to vkQueueSubmit2, counted before the calls;
- runtime_command_buffer_gpu_nanos: the sum of their spans.
A pair read as not available counts in stamps_not_available, and a buffer that found no pair
counts in untimed_command_buffers; neither adds time. A buffer that never went gives back its
pair unreset; one in flight at a loss has its pair reset and not read (a new lost flag on the
completion thread's retiree).
- The api_signatures table holds the two fields.
Tests (device cfg):
- layouts.rs's intercept now keeps each submitted command buffer's barriers, copies to a buffer
and timestamp writes in order. a_command_buffer_s_end_timestamp_follows_its_tail writes a
texture over a Shared buffer in an image of its own by a blit and checks the command buffer's
tail: the copy back between its barriers, the end barrier, then the end stamp, last. In every
submitted command buffer, uploads included, an end stamp is the last command.
- every_device_counts_and_times_its_own_command_buffers: the first commit carries one upload and,
where Managed buffers keep a device copy, one copy-in, so it counts 2 (1 on unified memory).
A get_bytes flush counts 1 more. On lavapipe both add GPU time and every pair is read.
Why: the planner's order. On the RTX 2080 the driver reports the GPU busy 97% of a benchmark
while rt's spans cover 51-53%. This puts the tail inside the Metal span and measures the rest
apart.
How verified: the lane's runtime gate (fmt, clippy plain, m2v_gpu, m2v_cpu_icd and Windows,
Rustdoc, signatures, the runtime suite on lavapipe under the validation layer).