From a59bc7c4427d68b6fb23cc442bd61909fb16bbfb Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Mon, 9 Nov 2026 19:23:00 -0800 Subject: [PATCH] command-replay: what a run's pipelines took from the shader cache status.txt gains a cache line: functions translated, variant pipelines made, directory lookups hit and missed, driver records loaded, and the driver's pipeline cache hits and misses its creation feedback reported. With METAL2VULKAN_LOG_PIPELINES set, each render pipeline creation's line (metal2vulkan-pipeline-creation) goes there too, as pipeline . So two runs of one manifest over one shader cache directory show whether the second takes every pipeline from the cache, and where a making does not, which part missed: the replay of a warm boot's pipelines needs that. Tool only. (cherry picked from commit c6f67a91a8f2af22f16f4743f7836fce624bd41f) --- .../src/bin/command-replay.rs | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/crates/metal2vulkan-validation/src/bin/command-replay.rs b/crates/metal2vulkan-validation/src/bin/command-replay.rs index 5373fc748..8c11c755f 100644 --- a/crates/metal2vulkan-validation/src/bin/command-replay.rs +++ b/crates/metal2vulkan-validation/src/bin/command-replay.rs @@ -58,7 +58,11 @@ //! in turn, rows packed, through a blit into a shared buffer (a two-plane format's plane 0; a //! memoryless or multisampled texture is not read), a buffer's whole length. //! -//! `DIR/status.txt` says `leg runtime`, `device `, each degrade notice the run raised +//! `DIR/status.txt` says `leg runtime`, `device `, what the run's pipelines took from the +//! shader cache (`cache` and its counts: functions translated, variant pipelines made, directory +//! lookups hit and missed, driver records loaded, and the driver's pipeline cache hits and misses +//! its creation feedback reported), each pipeline creation's line where +//! `METAL2VULKAN_LOG_PIPELINES` is set (`pipeline `), each degrade notice the run raised //! (`notice `), and `ok` or `error : `: the first failure stops the run, //! and the readbacks done so far stay. The exit status is 0 for `ok`, 1 for a run that stopped, //! and 2 for a harness failure (a bad manifest or command line). @@ -193,7 +197,11 @@ fn run(options: &BTreeMap) -> i32 { device_options.messages = Some(MessageSink::new(move |m| { if m.id_name.starts_with("metal2vulkan-degrade") || m.id_name.starts_with("VUID") { if let Ok(mut n) = sink.lock() { - n.push(format!("{} {}", m.id_name, m.text)); + n.push(format!("notice {} {}", m.id_name, m.text)); + } + } else if m.id_name == "metal2vulkan-pipeline-creation" { + if let Ok(mut n) = sink.lock() { + n.push(format!("pipeline {}", m.text)); } } })); @@ -226,8 +234,23 @@ fn run(options: &BTreeMap) -> i32 { }; let result = replay.all(&manifest, &mut status); let read = replay.readback(&manifest, &mut status); - for notice in notices.lock().map(|n| n.clone()).unwrap_or_default() { - status.line(&format!("notice {notice}")); + let (stats, counts) = ( + replay.device.shader_cache_statistics(), + replay.device.work_counts(), + ); + status.line(&format!( + "cache translated {} variant-pipelines {} lookups-hit {} lookups-missed {} driver-loads {} \ + driver-pipeline-hits {} driver-pipeline-misses {}", + counts.functions_translated, + counts.variant_pipelines_made, + stats.hits, + stats.misses, + stats.driver_loads, + stats.driver_pipeline_hits, + stats.driver_pipeline_misses + )); + for line in notices.lock().map(|n| n.clone()).unwrap_or_default() { + status.line(&line); } match result.and(read) { Ok(()) => {