From 118bd0dff7185322e28b6d8c1602e822b1a18b7a Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Wed, 2 Dec 2026 06:14:30 -0800 Subject: [PATCH] Translator: a query-only argument buffer texture reads its element under the identity domains L215 (b). An argument buffer's texture that a function only queries has no texel class: nothing structural types it (the member's texture type is only its MSL type name, which decides nothing), so its group is declared Float and states RuntimeFact::HeapNumericType for the binder of the table domains. The identity domains source no such fact, so every function with such a member was refused, whatever its shape. Under the identity domains the group's element is the texture its resource ID names, as a texture slot's is, and a slot only queried already takes the Float class there with no fact. A query reads the element's extent and its level, layer and sample counts; Vulkan's image query instructions access no texel (13.4.4), so the texture's numeric type changes nothing a query returns. So under the identity domains a query-only group states no HeapNumericType; the table domains keep it. The runtime README's known gap for it goes; the golden table's tail_heap_cube_queries cells change from the refusal, a bless at the next pin. SEMANTICS_VERSION 2314. No refusal site was added or removed. Verified (job m3-max-78379, msi, at this tree before its rebase onto 0b71bdf72a): the interpreter test passes on every identity profile (2 passed with its neighbour), and on lavapipe (llvmpipe, LLVM 23.1.1) the runtime test passes under the validation layer, both dispatches at their addresses (M2V-FORM 0 bound, 2 at their addresses). --- crates/metal2vulkan-runtime/README.md | 7 +------ crates/metal2vulkan/src/cache/mod.rs | 2 +- crates/metal2vulkan/src/lower/texture/mod.rs | 4 +++- crates/metal2vulkan/src/lower/texture/slot.rs | 10 +++++++--- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/crates/metal2vulkan-runtime/README.md b/crates/metal2vulkan-runtime/README.md index d598f9647..6a615a277 100644 --- a/crates/metal2vulkan-runtime/README.md +++ b/crates/metal2vulkan-runtime/README.md @@ -3903,12 +3903,7 @@ cache is answered compile-required on both. argument whose minimum level or emulated filter the function specializes ("a sampler argument whose minimum level or emulated filter the function specializes"): no test yet; - other state of a bound texture or sampler beyond its resource ID ("state of a bound texture - or sampler beyond its resource ID (F)", `F` the `RuntimeFact`), among them an argument - buffer's texture that the function only queries (`HeapNumericType`): - `tests::engine_heap_groups`'s - `a_query_only_argument_buffer_texture_is_refused_naming_its_numeric_type` asserts the text - for a 2D texture and a cube array, and the golden table holds the refusal's class for - `engine/tail_cases`' `tail_heap_cube_queries`; + or sampler beyond its resource ID (F)", `F` the `RuntimeFact`): no test yet; - program-scope constant data past 64 KiB read through memory ("constant data of N bytes read through memory"): `tests::engine_identity`'s `a_constant_blob_past_the_modules_bound_is_refused_naming_its_size` asserts the text; diff --git a/crates/metal2vulkan/src/cache/mod.rs b/crates/metal2vulkan/src/cache/mod.rs index 1246ea65c..19f5d9552 100644 --- a/crates/metal2vulkan/src/cache/mod.rs +++ b/crates/metal2vulkan/src/cache/mod.rs @@ -60,7 +60,7 @@ mod tests; /// unchanged version, and its bless records the version. Independent of the crate's version and of /// [`ARTIFACT_FORMAT_VERSION`]. The commit that bumps it says what changed; this comment keeps no /// history. -pub const SEMANTICS_VERSION: u32 = 2313; +pub const SEMANTICS_VERSION: u32 = 2314; /// The byte-layout version of encoded artifacts (`CompiledFunction::to_bytes` and the /// [`PipelineArtifact`] encodings). Every encoded artifact carries it, and a decode under another diff --git a/crates/metal2vulkan/src/lower/texture/mod.rs b/crates/metal2vulkan/src/lower/texture/mod.rs index 66ae3982c..0ceac832e 100644 --- a/crates/metal2vulkan/src/lower/texture/mod.rs +++ b/crates/metal2vulkan/src/lower/texture/mod.rs @@ -12,7 +12,9 @@ //! once, from all of its uses, as one runtime array of the heap class its shape, texel class, and //! member access name, like a slot ([`ImageRef::Heap`]). A group that is only queried has no texel //! class and is declared `Float`, which its `RuntimeFact::HeapNumericType` states so the binder -//! reports a resident texture of another numeric type. An operation indexes that array with the +//! reports a resident texture of another numeric type; under the identity domains, where its +//! element is the texture its resource ID names, a query reads that element whatever its numeric +//! type (a query accesses no texel), and no fact is stated. An operation indexes that array with the //! handle, `NonUniform`, and behaves as the static null arm for the null handle (element 0, also //! every missed id): a read or query is 0, a write is dropped, `is_null` is `handle == 0`. The //! arrays need descriptor indexing (`runtimeDescriptorArray`, `descriptorBindingPartiallyBound`, diff --git a/crates/metal2vulkan/src/lower/texture/slot.rs b/crates/metal2vulkan/src/lower/texture/slot.rs index b75414dbb..2a59deb70 100644 --- a/crates/metal2vulkan/src/lower/texture/slot.rs +++ b/crates/metal2vulkan/src/lower/texture/slot.rs @@ -312,7 +312,7 @@ pub struct HeapPlan { /// The shape its operations spell (all agree). pub shape: Option, /// The texel class its reads and writes spell; `None` when only queries use it (declared - /// `Float`, with `RuntimeFact::HeapNumericType`). + /// `Float`, with `RuntimeFact::HeapNumericType` outside the identity domains). pub texel: Option, pub uses: Uses, /// The heap class and its declaration, set by [`finish`] for a group that is read, written, @@ -1318,8 +1318,12 @@ pub fn finish(cx: &mut SelectCx<'_>) -> Result<(), Error> { continue; }; let (class, decl) = declare_heap(cx, h, shape)?; - if h.texel.is_none() { - // Only queried: `Float` is a default, not the members' type. + // Only queried: `Float` is a default, not the members' type. Under the identity domains + // the group's element is the texture its resource ID names, whatever its numeric type, as + // a slot's is: a query reads the element's extent and its level, layer and sample counts, + // and accesses no texel (Vulkan's image query instructions), so no numeric type of the + // texture changes its answer. + if h.texel.is_none() && !crate::lower::access::identity(cx.profile) { facts.push(RuntimeFact::HeapNumericType { class }); } heap.push((*group, (class, decl)));