From 38c5f2e96a662f490779bdf8fe59b474f3f6260d Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Mon, 23 Nov 2026 06:23:17 -0800 Subject: [PATCH] rt: decide's lifetime is elided, and the cache-directory test reads the observer's two modules again Fixes forward e59c621e48, whose compile job m3-max-71176 failed two ways: - clippy (plain, --cfg m2v_gpu, --cfg m2v_cpu_icd): needless_lifetimes at encoder.rs decide(). Its one reference input since the restore is `compiled`, so the returned kernel's lifetime is elided. - every_device_takes_the_kernels_a_device_before_it_lowered_from_the_cache_directory on lavapipe: `left: (3, 0)`, `right: (2, 0)`. The restore makes an observing kernel's state lower its plain module and its partial-threadgroups variant again, so the first device translates three modules (the tiling kernel's and the observer's two) and the second loads three from the directory. The test's counts, its comment and its doc go back to their values before d8eb5ea024 (the test of a103b4dc5a), which had moved them to two when the variant became the state's only module. The code is right; the expectation was the series'. The other 684 rt tests on lavapipe passed in m3-max-71176, among them the 10 observer and ragged-grid tests. --- crates/metal2vulkan-runtime/src/encoder.rs | 6 +++--- crates/metal2vulkan-runtime/src/tests/translate.rs | 11 +++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/crates/metal2vulkan-runtime/src/encoder.rs b/crates/metal2vulkan-runtime/src/encoder.rs index f26d8ff82..cbe734a3f 100644 --- a/crates/metal2vulkan-runtime/src/encoder.rs +++ b/crates/metal2vulkan-runtime/src/encoder.rs @@ -1401,12 +1401,12 @@ pub(crate) fn size_checked(interface: &Interface, size: [u32; 3]) -> Result<(), /// for a threadgroup that is not whole groups of a module that runs only whole ones (the /// partial-threadgroups variant has none), each lowered with the state. An observer's whole grids, /// threadgroup dispatches and indirect dispatches run its plain module. -pub(crate) fn decide<'a>( - compiled: &'a Compiled, +pub(crate) fn decide( + compiled: &Compiled, direct: Option, size: [u32; 3], max: u32, -) -> Result<(Choice, Module, &'a Kernel), Error> { +) -> Result<(Choice, Module, &Kernel), Error> { let choice = choose(&compiled.form, direct, size); let partial_threadgroups = |site: PartialThreadgroupsSite| { Error::Unsupported(Gap::PartialThreadgroups { diff --git a/crates/metal2vulkan-runtime/src/tests/translate.rs b/crates/metal2vulkan-runtime/src/tests/translate.rs index 2b597d109..129c94f40 100644 --- a/crates/metal2vulkan-runtime/src/tests/translate.rs +++ b/crates/metal2vulkan-runtime/src/tests/translate.rs @@ -2025,9 +2025,8 @@ mod on_device { } /// A device on a cache directory a device before it used lowers nothing at creation, and asks - /// the translator nothing: the tiling kernel's lowering and the observing kernel's - /// partial-threadgroups variant, its state's only module, are read from the directory, each - /// once, so no stage entry + /// the translator nothing: the tiling kernel's lowering and the observing kernel's plain one + /// and partial-threadgroups variant are read from the directory, each once, so no stage entry /// is decoded, and the tile's `VkPipeline` is made through a pipeline cache started from the /// device's blob. /// The first device's writes (`Metrics::cache_bytes_written`) are at least the files' bytes, @@ -2059,8 +2058,8 @@ mod on_device { ]; let metrics = counters.metrics(); let counted = (metrics.translations, metrics.translations_loaded); - // The tiling kernel's lowering and the observing kernel's variant. - let want = [(2, 0), (0, 2)][round]; + // The tiling kernel's lowering, the observing kernel's plain one and its variant. + let want = [(3, 0), (0, 3)][round]; assert_eq!(counted, want, "{name}: device {round} on the directory"); if round == 1 { let decoded = device.core().entries.held(); @@ -2091,7 +2090,7 @@ mod on_device { } } let _ = std::fs::remove_dir_all(&dir); - println!("{name}: 2 lowerings and the blob written, nothing by a second device"); + println!("{name}: 3 lowerings and the blob written, nothing by a second device"); } }