Translator: a coherent access beside a storage image compiles, its texels non-private

lower/sync/memory_model.rs's finish refused a function with a coherent access, or anything else
that selects the Vulkan memory model, beside a storage image outside an interlocked body
(NotImplemented{Lowering(MemoryModel)}), its module doc saying the image's NonPrivateTexel
accesses were not measured. The accesses were already right: a storage image's read and write
take the function's coherence (texture::emit::texel_memory), NonPrivateTexel under the Vulkan
model, so a barrier orders them with other invocations' accesses as GLSL450 does; under GLSL450
the module decorates every storage image Coherent beside the coherent accesses. Under the identity
domains, the runtime's route, the refusal never fired for a texture slot.

Now the refusal is gone, and with it texture::TexturePlan::heap_storage_images, which only it
called. The module doc says what a storage-image access takes and names the runtime test that
measures it.

SEMANTICS_VERSION moves above development's: a refusal becomes a module.

Verified on the CPU (job m3-max-83707): the two translator tests pass; the golden table differs from
development's (semantics 2342) in 72 cells here, as at 011540217d and at the tip, so the change
moves no existing cell by count; the refusal surface check passes.

Landed with SEMANTICS_VERSION 2348 (renumbered above development's 2347: written 2346 on its base 011540217d).
This commit is contained in:
Anees Iqbal committed 2026-12-03 06:46:59 -08:00
1 parent 1ba2517654
commit d0665778b7
3 files changed
+5 -32

No files matched your search

+1 -1
View File
@@ -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 = 2347;
pub const SEMANTICS_VERSION: u32 = 2348;
/// The byte-layout version of encoded artifacts (`CompiledFunction::to_bytes` and the
/// [`PipelineArtifact`] encodings). Every encoded artifact carries it, and a decode under another
@@ -36,10 +36,10 @@
//! device addresses, the threadgroup arena) carries it, keeping the ordering barriers give it
//! under `GLSL450`; a coherent access adds `MakePointerAvailable` (a store) or
//! `MakePointerVisible` (a load) at `Device` scope, which is why the model also needs the device
//! scope. A storage-image access takes the texel operands of the same coherence
//! ([`Coherence::texel`]). Outside an interlocked body, a function with a storage image (a
//! storage slot's, a staged attachment's, or a heap storage class's) and a coherent access is not
//! implemented: its `NonPrivateTexel` accesses are not measured.
//! scope. A storage-image read or write (a storage slot's, a staged attachment's, or a heap
//! storage class's) takes the texel operands of the same coherence ([`Coherence::texel`]):
//! `NonPrivateTexel`, which a barrier orders with other invocations' accesses as under
//! `GLSL450`; the runtime's `coherent_texels` test measures one such handoff on each device.
//! - **An interlocked body**: every access of memory another invocation may write is made available
//! and visible at `Device` scope, which is what a fragment-interlock critical section orders
//! (`VK_EXT_fragment_shader_interlock`: only coherent accesses inside it are ordered with the
@@ -232,19 +232,6 @@ pub fn finish(cx: &mut SelectCx<'_>) -> Result<(), Error> {
{
note_device_scope(cx);
}
// Outside an interlocked body, storage-image accesses under the Vulkan model are not
// implemented (module docs), nor beside coherent accesses in their `GLSL450` form, so that a
// function's outcome does not hang on which form the profile takes. A heap storage class is
// no per-stage descriptor, so it is asked of the texture family.
let storage_images =
cx.descriptors.storage_images > 0 || cx.families.texture.heap_storage_images();
let model = &cx.families.memory_model;
if (model.model == BarrierModel::Vulkan || model.coherent_resources)
&& storage_images
&& !interlocked(&cx.families)
{
return Err(not_implemented());
}
check(&cx.families.memory_model, cx.profile)
}
@@ -265,10 +252,6 @@ pub fn finish_interlock(cx: &mut SelectCx<'_>, slots: &[Option<SlotChoice>]) ->
check(&cx.families.memory_model, cx.profile)
}
fn not_implemented() -> Error {
Unsupported::not_implemented(Feature::Lowering(LowerFamily::MemoryModel)).into()
}
/// The memory-model family's module-scope objects (none: the serializer derives the
/// `OpMemoryModel` operand from the semantics the module contains).
#[derive(Clone, Debug, Default)]
@@ -1024,16 +1024,6 @@ pub struct TexturePlan {
}
impl TexturePlan {
/// Some heap group is declared as a storage-image class, once [`finish`] has run: its reads,
/// writes, and atomics are storage-image accesses, as a storage slot's are, which the Vulkan
/// memory model orders only with `NonPrivateTexel` (`sync::memory_model`).
pub fn heap_storage_images(&self) -> bool {
self.heap.values().any(|h| {
h.decl
.is_some_and(|d| d.usage == crate::spirv::ir::ImageUsage::Storage)
})
}
/// Whether `image` is volatile, once [`finish`] has run: its slot's, or its heap group's
/// class's.
fn volatile(&self, image: &ImageRef) -> bool {