From f61fee8aacb49a6bd2ddf82fb468f64786788fcf Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Thu, 19 Nov 2026 18:18:45 -0800 Subject: [PATCH] replay: the new runtime's play reports its commits' waits for the work lock The executed counters take the runtime's commit_lock_wait_nanos, so a frame's line gives its commits' waits for the work lock, summed; the backend's lines give commit_lock_wait_max_nanos, the longest wait in the play, which is a maximum and no frame's counter. The runtime has no product metric of the other calls' waits for the lock (the surface make's included): only the device tests' per-thread total times those (crate::submit::waits). Read with it (player built at this change's first form, 307b1998f9, job m3-max-55631; no validation layer; the player commits from one thread, so these say only that the runtime's own threads, submit, completion and block maker, hold no caller long): - syncview-4k-780m, whole (1501 frames), Radeon 780M (RADV), job m3-max-55670: 0.609 ms of waits over 8066.2 ms of frames (0.008%), the mean frame's share 0.007%, the worst frame's 0.301% (0.022 of 7.436 ms), the longest wait 23.3 us, no frame's waits past 1 ms; - glbench-3090-r2 to frame 300 (301 frames), lavapipe, job m3-max-55669: 3.680 ms over 39383.2 ms (0.009%), the mean frame's share 0.007%, the worst frame's 0.431% (0.015 of 3.370 ms), the longest wait 1.367 ms, in the one frame whose waits passed 1 ms (1786.6 ms long). Verified: see the check job named in the landing. --- crates/metal2vulkan-validation/src/replay/new_runtime/mod.rs | 4 ++++ docs/REPLAY-STREAM.md | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/metal2vulkan-validation/src/replay/new_runtime/mod.rs b/crates/metal2vulkan-validation/src/replay/new_runtime/mod.rs index 924090fbc..22c5eb08c 100644 --- a/crates/metal2vulkan-validation/src/replay/new_runtime/mod.rs +++ b/crates/metal2vulkan-validation/src/replay/new_runtime/mod.rs @@ -2699,6 +2699,7 @@ impl Backend for NewRuntime { ("upload_waits", metrics.upload_waits), ("staging_sleeps", metrics.staging_sleeps), ("synchronizations", metrics.synchronizations), + ("commit_lock_wait_nanos", metrics.commit_lock_wait_nanos), ("managed_bytes_captured", metrics.managed_bytes_captured), ("stamps_not_available", metrics.stamps_not_available), ("waits_behind_counter", metrics.waits_behind_counter), @@ -2790,6 +2791,9 @@ impl Backend for NewRuntime { format!("pipeline {at} wall_nanos={} kernel={kernel}", made.nanos) }); let mut lines: Vec = lines.collect(); + // A maximum since the device was made: it does not sum, so it is not a frame's counter. + let longest = self.device.counters().metrics().commit_lock_wait_max_nanos; + lines.push(format!("commit lock wait longest {longest} ns")); if let Some(copies) = self.managed { let from = match self.identity { true => "the stream's device identity", diff --git a/docs/REPLAY-STREAM.md b/docs/REPLAY-STREAM.md index 1e8a151a6..c56adc900 100644 --- a/docs/REPLAY-STREAM.md +++ b/docs/REPLAY-STREAM.md @@ -1046,7 +1046,10 @@ calls played: where the play stopped, the stopping call is the next), the new runtime's backend's `pipeline I wall_nanos=N kernel=new|again` for each compute pipeline state it made, in order (the making's wall time, and whether no state of another specialization of the kernel, a library's -function by name, was made before), its `skipped render states GAP N, the first #ID: WHY` for each +function by name, was made before), its `commit lock wait longest N ns` (the runtime's +`commit_lock_wait_max_nanos`: the longest wait of a commit for the runtime's work lock in the play; +the executed counter `commit_lock_wait_nanos` gives the waits by frame, summed), its +`skipped render states GAP N, the first #ID: WHY` for each typed gap a render pipeline state met (`GAP` the runtime's gap as Rust prints it for debugging, such as `RenderPipeline { kind: DepthAttachment }`, or `Translation(KIND)` where the translator refused it: `Unsupported(FEATURE)` with the refused feature as Rust prints it for debugging, such as