From 328da5cc5eade3ce87f7a12b752d550036174076 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Wed, 18 Nov 2026 03:32:11 -0800 Subject: [PATCH] Deep threadgroups: positive() matches its operands by slice pattern; the old render key's pin under 2172 What: Consts::positive reads a product's and a select's operands through slice patterns, not indexing (clippy::indexing_slicing, denied in spirv outside tests); an operand list of another length is not known positive. the_old_render_descriptor_key_keeps_its_value pins the test descriptor's key under SEMANTICS_VERSION 2172, which the old runtime's render descriptor key hashes: its cache entries under 2171 are misses, as every semantics bump makes them. Verified: check m3-max-45573 at a604f82f82 failed clippy at exactly these four indexes in all three configurations, and the pinned-key test with this value on the left; the API tables, the runtime guard and the rt lavapipe tests passed there. --- crates/metal2vulkan/src/pipeline/compile/tests.rs | 2 +- crates/metal2vulkan/src/spirv/ir/constant.rs | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/crates/metal2vulkan/src/pipeline/compile/tests.rs b/crates/metal2vulkan/src/pipeline/compile/tests.rs index d2991e180..72a128f73 100644 --- a/crates/metal2vulkan/src/pipeline/compile/tests.rs +++ b/crates/metal2vulkan/src/pipeline/compile/tests.rs @@ -1266,7 +1266,7 @@ fn the_old_render_descriptor_key_keeps_its_value() { let key = device("moltenvk-m3").render_descriptor_key(&d); let hex: String = key.digest().iter().map(|b| format!("{b:02x}")).collect(); assert_eq!( - hex, "b0b8846d063ddd3f7860a19cd828e282f7dc439f03202ea6f5a63ca5f0097393", + hex, "de6480915472d44f206b8ff387592e96717602ad393e9562d4fa2a4dbd1aa216", "the old runtime's key of the descriptor" ); } diff --git a/crates/metal2vulkan/src/spirv/ir/constant.rs b/crates/metal2vulkan/src/spirv/ir/constant.rs index 070417a37..85b5b8c0a 100644 --- a/crates/metal2vulkan/src/spirv/ir/constant.rs +++ b/crates/metal2vulkan/src/spirv/ir/constant.rs @@ -441,11 +441,17 @@ impl Consts { ConstKind::SpecOp { op: SpecOp::IMul, operands, - } => self.positive(operands[0])? && self.positive(operands[1])?, + } => match **operands { + [a, b] => self.positive(a)? && self.positive(b)?, + _ => false, + }, ConstKind::SpecOp { op: SpecOp::Select, operands, - } => self.positive(operands[1])? && self.positive(operands[2])?, + } => match **operands { + [_, a, b] => self.positive(a)? && self.positive(b)?, + _ => false, + }, _ => false, }) }