From 8933378831753c7a8f5f449ac610cc5bb826d4da Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Mon, 16 Nov 2026 07:51:36 -0800 Subject: [PATCH] SEMANTICS 2135 / RUNTIME 2458: No storage twins: a kernel's constant buffer on the Iris reads its uniform view alone What: the Iris Xe RPL-P profile (DriverWorkaround::PushReadsLengthenThreadPayload) declares no storage twin. A kernel's constant slot keeps its plain uniform view, read at its residual as on every device without ConstantOffsetUniformReadsPreloaded; its set-0 layout binds the uniform view alone. Deleted with it, everything only the twin used: - translator: DescriptorView::UniformWithStorageTwin, BufferForm::storage_twin, ResourceKind::StorageTwin, BindingSource::StorageTwin, AccessPlan/Declared twins and the census's twin count, storage_twins, views::declare_twin/twin_symbol, emit's TwinMem, the twin's NonWritable statement (unwritten_buffer keeps its unaliased-argument use), PlannedBuffer::twin, the second DescriptorRange, buffer_uses back to buffer_use, range_at_bind_offset's unbound twin arm, planned_range's twin exclusion, rebinds_into's twin arm, the interpreter's twin binding, the codec's variants, and BindingPlan::read_only_buffer (its only reason was the twin); - runtime: uniform_residual_form_of and reads_other_words (keyed_regions takes no flat_grid), the neutral zero buffer's STORAGE_BUFFER usage and plan-based read-only check (back to the descriptor type alone, binding::read_only_buffer); - validation: out_of_bounds's twin arms; - docs: API.md section 5's twin bullet, the workaround's profile doc, residual.rs, views.rs, ModuleBuilder::unwritten_buffer, non_writable.rs, neutral.rs, neutral_zeros_shared's docs; api_signatures.tsv drops the five items. Kept: storage views' RangeAtBindOffset at offset 0 on that profile and its creation of both forms (RUNTIME 2410), set-0 counting tests, the dispatch_chain example's arms. Why: the twins are the confirmed cause of the Iris regression. Walk A (the tip with no twins) took 137.4 s of GPU time against 145.8 to 150.2 s for three walks with twins; Face Tracking 13.50 s against 18.1 to 21.1, Super Resolution 25.78 against 28.2 to 28.4, Background Blur 4.93 against 5.7 to 6.4; Horizon Detection gives up about 1.3 s (17.78 against 16.2 to 16.8). No structural rule separates where a twin pays (ftreg's report to main). SEMANTICS and RUNTIME are bumped at landing; golden tables and the compile census are re-blessed on development. Test: engine_access::a_kernel_constant_slot_binds_its_uniform_view_alone. On intel-irisxe-rplp-anv, with and without uniformBufferStandardLayout, buffer_end_byte_load_constant's slot 0 is UniformWords/UniformVec4, its RangeAtBindOffset key is read, and set 0 links exactly slot 0 at (0,0) and slot 1 at (0,1). A plan of nothing bound writes those two alone in set 0 (UNIFORM_BUFFER, STORAGE_BUFFER), and only them on four other profiles. At development the slot is UniformWithStorageTwin and set 0 holds a third binding, so it fails. ARTIFACT_FORMAT_VERSION 524: the codec drops the twin variants. Verified: m3-max-36704 (msi) at 2b88dec3f1 clippy --all-targets --all-features 0; m3-max-36706 clippy --cfg m2v_gpu 0. Rustdoc, the translator suites, clippy --cfg m2v_cpu_icd with the lavapipe runtime tests, and the negative control (the new test at development fails) run after the merge; golden tables and the compile census are re-blessed on development. --- crates/metal2vulkan-runtime/src/binding.rs | 73 +++-- crates/metal2vulkan-runtime/src/neutral.rs | 21 +- .../metal2vulkan-runtime/src/pipeline/mod.rs | 13 +- .../src/pipeline/render.rs | 4 +- .../src/pipeline/render/residual.rs | 157 +--------- .../src/tests/general_form.rs | 176 +---------- .../src/tests/neutral_zeros_shared.rs | 11 +- .../src/tests/uniform_bind_offsets.rs | 92 ------ .../src/executor_contract/out_of_bounds.rs | 8 +- .../metal2vulkan/src/bind/dispatch/tests.rs | 1 - crates/metal2vulkan/src/bind/graphics.rs | 14 +- .../metal2vulkan/src/bind/graphics/tests.rs | 1 - crates/metal2vulkan/src/bind/instantiate.rs | 16 +- .../src/bind/instantiate/tests.rs | 54 ---- crates/metal2vulkan/src/bind/plan.rs | 24 -- crates/metal2vulkan/src/bind/plan/compute.rs | 7 +- crates/metal2vulkan/src/bind/plan/slots.rs | 67 ++-- .../metal2vulkan/src/bind/plan/slots/tests.rs | 92 ------ crates/metal2vulkan/src/cache/codec.rs | 4 +- crates/metal2vulkan/src/cache/mod.rs | 6 +- .../metal2vulkan/src/device/driver_facts.rs | 4 +- crates/metal2vulkan/src/device/profile.rs | 17 +- .../metal2vulkan/src/lower/access/atomic.rs | 5 +- crates/metal2vulkan/src/lower/access/emit.rs | 135 +------- crates/metal2vulkan/src/lower/access/mod.rs | 90 +----- crates/metal2vulkan/src/memory/views.rs | 57 +--- crates/metal2vulkan/src/pipeline/interface.rs | 22 +- crates/metal2vulkan/src/pipeline/layout.rs | 4 - crates/metal2vulkan/src/pipeline/link.rs | 1 - crates/metal2vulkan/src/pipeline/sym.rs | 5 - .../metal2vulkan/src/spirv/builder/module.rs | 11 +- crates/metal2vulkan/src/spirv/interp/mod.rs | 3 +- crates/metal2vulkan/src/spirv/interp/sched.rs | 18 +- .../src/spirv/serialize/non_writable.rs | 2 +- .../metal2vulkan/src/tests/engine_access.rs | 291 ++++-------------- .../src/tests/engine_device_replay.rs | 12 +- crates/metal2vulkan/tests/api_signatures.tsv | 5 - docs/API.md | 32 -- 38 files changed, 208 insertions(+), 1347 deletions(-) diff --git a/crates/metal2vulkan-runtime/src/binding.rs b/crates/metal2vulkan-runtime/src/binding.rs index 3a8af7258..6a8401b7c 100644 --- a/crates/metal2vulkan-runtime/src/binding.rs +++ b/crates/metal2vulkan-runtime/src/binding.rs @@ -1302,7 +1302,7 @@ pub(super) fn bind_into( call, device, state, - (plan, command, tables), + (command, tables), (write, element), kept, )?; @@ -1328,7 +1328,7 @@ pub(super) fn bind_into( call, device, state, - (plan, command, tables), + (command, tables), (write, element), kept, )?; @@ -1469,13 +1469,13 @@ fn written_at( } } -/// The write of `write`, one of `plan`'s descriptor writes, at `element`, for `command` over +/// The write of `write`, one of its plan's descriptor writes, at `element`, for `command` over /// `tables` ([`bind_into`]): its image descriptor's sampler kept in `samplers`, through `memo`. fn written( call: &'static str, device: &Device, state: &mut State, - (plan, command, tables): (&BindingPlan, &Command<'_>, &Tables<'_>), + (command, tables): (&Command<'_>, &Tables<'_>), (write, element): (&DescriptorWrite, u32), (samplers, mut memo): (&mut Vec>, Option<&mut BindMemo>), ) -> Result { @@ -1487,12 +1487,7 @@ fn written( (_, ty) => match ty { vk::DescriptorType::UNIFORM_BUFFER | vk::DescriptorType::STORAGE_BUFFER => { let spaces = memo.as_deref_mut().map(|memo| &mut memo.spaces); - Info::Buffer(descriptor( - device, - state, - (plan, command, tables), - (write, spaces), - )?) + Info::Buffer(descriptor(device, state, command, tables, (write, spaces))?) } vk::DescriptorType::UNIFORM_TEXEL_BUFFER | vk::DescriptorType::STORAGE_TEXEL_BUFFER => { let storage = ty == vk::DescriptorType::STORAGE_TEXEL_BUFFER; @@ -1548,7 +1543,7 @@ pub(super) fn make_neutrals(device: &Device, plan: &BindingPlan) -> Result<(), E // (the module docs' "no wait"), as it finds the images and samplers made. WriteSource::Neutral( NeutralResource::ZeroBuffer { min_bytes } | NeutralResource::Sink { min_bytes }, - ) if plan.read_only_buffer(write) => { + ) if read_only_buffer(ty) => { device.neutral_zero_buffer(padded(*min_bytes as usize))?; } WriteSource::Neutral(kind @ NeutralResource::Image { .. }) => { @@ -2779,15 +2774,29 @@ fn unexpected(source: &WriteSource) -> Error { } } +/// The buffer descriptor of `write`. +/// Whether a buffer descriptor of `ty` is read-only to every shader that binds it: a uniform +/// buffer, whose block Vulkan and SPIR-V make read-only, so no store can reach it. A storage +/// buffer is not, whatever a particular shader does with it. +/// +/// It decides which bindings may share the device's one neutral zero buffer (`neutral.rs`): a +/// writable binding keeps a region of its own, so nothing a shader stores is ever seen by another +/// command. Structural: the descriptor type alone, never a function or shader name. +fn read_only_buffer(ty: vk::DescriptorType) -> bool { + matches!( + ty, + vk::DescriptorType::UNIFORM_BUFFER | vk::DescriptorType::UNIFORM_BUFFER_DYNAMIC + ) +} + /// Whether `plan` binds a zero region of each command's own: at a writable buffer binding that -/// nothing is bound to (not `BindingPlan::read_only_buffer`), a fresh region of the command -/// buffer's upload arena at every draw (`write_info`). A draw drawn again as it was kept, or -/// rebound, keeps the kept draw's set-0 writes at every slot but those that changed -/// (`rebind_into`), so it would bind the kept draw's region, which that draw may have written: -/// such a draw is not kept (`render/draw_again.rs`), counted as one that may write -/// (`WorkCounts::draws_unkept_writing`). It walks every write of the plan, one for each resource -/// its heap reaches in each heap array, so a draw asks its plan's facts (`render/plan_facts.rs`), -/// which hold the answer. +/// nothing is bound to ([`read_only_buffer`]), a fresh region of the command buffer's upload +/// arena at every draw (`write_info`). A draw drawn again as it was kept, or rebound, keeps the +/// kept draw's set-0 writes at every slot but those that changed (`rebind_into`), so it would +/// bind the kept draw's region, which that draw may have written: such a draw is not kept +/// (`render/draw_again.rs`), counted as one that may write (`WorkCounts::draws_unkept_writing`). +/// It walks every write of the plan, one for each resource its heap reaches in each heap array, +/// so a draw asks its plan's facts (`render/plan_facts.rs`), which hold the answer. pub(super) fn binds_own_zeros(plan: &BindingPlan) -> bool { #[cfg(all(test, debug_assertions, any(m2v_gpu, m2v_cpu_icd)))] PLAN_WALKS.with(|walks| walks.set(walks.get() + plan.descriptors.len() as u64)); @@ -2796,7 +2805,7 @@ pub(super) fn binds_own_zeros(plan: &BindingPlan) -> bool { write.source, WriteSource::Neutral(NeutralResource::ZeroBuffer { .. } | NeutralResource::Sink { .. }) ); - neutral && !plan.read_only_buffer(write) + neutral && !read_only_buffer(write.ty.into()) }) } @@ -2861,15 +2870,15 @@ fn slot_descriptor( })) } -/// The buffer descriptor of `write`, one of `plan`'s descriptor writes, for `command` over -/// `tables`. fn descriptor( device: &Device, state: &mut State, - (plan, command, tables): (&BindingPlan, &Command<'_>, &Tables<'_>), + command: &Command<'_>, + tables: &Tables<'_>, (write, spaces): (&DescriptorWrite, Option<&mut KeptSpaces>), ) -> Result { let key = (write.set, write.binding); + let ty: vk::DescriptorType = write.ty.into(); let bytes = || { (command.descriptor_bytes.iter()) .chain(command.heap_tables) @@ -3007,20 +3016,18 @@ fn descriptor( // The command buffer's status words, the ones every command of it writes, on a device // that does not address buffers (`status_address` elsewhere). WriteSource::ExecutionStatus => whole(state.status_words(device)?), - // A read-only binding (a uniform buffer, or a uniform view's storage twin: - // `BindingPlan::read_only_buffer`) takes the device's kept zero buffer, made once for its - // lifetime (`neutral.rs`): zeros of a length the device's own limits fix cannot have - // changed since it was made, and before this every draw and dispatch that bound one took - // a fresh zero-filled region, each past half the upload arena's chunk and so a dedicated - // 64 KiB `VkBuffer` allocated and written to zero. A WRITABLE binding keeps its own - // region, as every binding did: the one buffer is shared by every command of the device, - // so a shader that could store through the binding would write zeros another command - // reads. + // A read-only binding takes the device's kept zero buffer, made once for its lifetime + // (`neutral.rs`): zeros of a length the device's own limits fix cannot have changed since + // it was made, and before this every draw and dispatch that bound one took a fresh + // zero-filled region, each past half the upload arena's chunk and so a dedicated 64 KiB + // `VkBuffer` allocated and written to zero. A WRITABLE binding keeps its own region, as + // every binding did: the one buffer is shared by every command of the device, so a + // shader that could store through the binding would write zeros another command reads. WriteSource::Neutral( NeutralResource::ZeroBuffer { min_bytes } | NeutralResource::Sink { min_bytes }, ) => { let bytes = padded(*min_bytes as usize); - match plan.read_only_buffer(write) { + match read_only_buffer(ty) { true => vk::DescriptorBufferInfo::default() .buffer(device.neutral_zero_buffer(bytes)?) .offset(0) diff --git a/crates/metal2vulkan-runtime/src/neutral.rs b/crates/metal2vulkan-runtime/src/neutral.rs index f2eaad495..526e32ebb 100644 --- a/crates/metal2vulkan-runtime/src/neutral.rs +++ b/crates/metal2vulkan-runtime/src/neutral.rs @@ -304,10 +304,8 @@ impl Device { /// Only a **read-only** binding may be served from it: every draw and dispatch of the device /// binds the one buffer, so a shader that could store through the binding would be writing /// zeros another command reads. A Vulkan uniform-buffer descriptor is read-only by - /// construction, and so is a uniform view's storage twin, a storage buffer its kernel only - /// loads from (`BindingPlan::read_only_buffer`): those are the bindings `binding::descriptor` - /// serves from here, so the buffer is a storage buffer too. A writable one keeps its own - /// region, as before. + /// construction, which is the binding `binding::descriptor` serves from here; a writable one + /// keeps its own region, as before. pub(super) fn neutral_zero_buffer(&self, bytes: u64) -> Result { let shared = self.shared(); let mut neutrals = lock(&shared.textures.neutrals); @@ -330,18 +328,15 @@ impl Device { /// A new zero buffer of `bytes` bytes: a `Private` buffer filled with zeros, as /// [`Device::new_neutral_texels`] makes its one texel of zeros, so the fill is the device's - /// next submission's first work and waits for nothing. A uniform and a storage buffer - /// ([`neutral_zero_buffer`](Device::neutral_zero_buffer)). + /// next submission's first work and waits for nothing. fn new_neutral_zeros(&self, bytes: u64) -> Result, Error> { let shared = self.shared(); let raw_device = shared.vk(); - let info = shared - .sharing() - .buffer(vk::BufferCreateInfo::default().size(bytes).usage( - vk::BufferUsageFlags::UNIFORM_BUFFER - | vk::BufferUsageFlags::STORAGE_BUFFER - | vk::BufferUsageFlags::TRANSFER_DST, - )); + let info = shared.sharing().buffer( + vk::BufferCreateInfo::default() + .size(bytes) + .usage(vk::BufferUsageFlags::UNIFORM_BUFFER | vk::BufferUsageFlags::TRANSFER_DST), + ); // SAFETY: the device is live and `info` valid. let buffer = unsafe { crate::creation::buffer(raw_device, &info) }.map_err(vulkan)?; // SAFETY: `buffer` is a live buffer of this device. diff --git a/crates/metal2vulkan-runtime/src/pipeline/mod.rs b/crates/metal2vulkan-runtime/src/pipeline/mod.rs index fc7b0f92e..a815a3932 100644 --- a/crates/metal2vulkan-runtime/src/pipeline/mod.rs +++ b/crates/metal2vulkan-runtime/src/pipeline/mod.rs @@ -103,9 +103,7 @@ pub(super) use render::RenderVariant; pub(super) use render::WeakRenderPipelineState; /// The general and residual forms of a key (`render/residual.rs`), for `tests::general_form`. #[cfg(test)] -pub(super) use render::{ - general_form, reads_other_words, residual_form_of, uniform_residual_form_of, -}; +pub(super) use render::{general_form, residual_form_of}; pub(super) use render::{reads_views_at_bind, residual_form, uniform_residual_form}; pub(super) use render::{GraphicsState, Kind as RenderStateKind, StateShared as RenderShared}; pub(super) use render::{ProgramName, Settled}; @@ -2327,22 +2325,17 @@ impl Variant { /// `commands`' regions, each specialization with its uniform views at their residuals where /// `device` reads no uniform view at its bind offset alone (`render/residual.rs`, /// `uniform_residual_form`): what every region of a dispatch or a tile dispatch of the variant - /// takes before its key is looked up. A storage view's key keeps its value, and a uniform - /// view's with a storage twin where no other view of the key reads its residual and the - /// region reads no other word the binder writes for the kernel, its `DispatchRegion` words - /// among them where the region's `MultiRegion` is set or the variant runs a flat grid - /// (`uniform_residual_form_of`, `reads_other_words`). + /// takes before its key is looked up. A storage view's key keeps its value. pub(crate) fn keyed_regions(&self, device: &Device, commands: &mut DispatchCommands) { if reads_views_at_bind(device) { return; } let constants = &self.pipeline.stage.specialization.constants; let interface = &self.pipeline.interface; - let flat_grid = self.key.flat_grid; for region in &mut commands.regions { let specialization = ®ion.specialization; if let Some(residual) = - uniform_residual_form(constants.iter(), interface, flat_grid, specialization) + uniform_residual_form(constants.iter(), interface, specialization) { region.specialization = residual; } diff --git a/crates/metal2vulkan-runtime/src/pipeline/render.rs b/crates/metal2vulkan-runtime/src/pipeline/render.rs index 35bbcb0bb..20a680b36 100644 --- a/crates/metal2vulkan-runtime/src/pipeline/render.rs +++ b/crates/metal2vulkan-runtime/src/pipeline/render.rs @@ -97,9 +97,7 @@ pub(crate) use residual::views_read_at_bind; /// The general and residual forms of a key, which `tests::general_form` reads from IDs and /// meanings alone. #[cfg(test)] -pub(crate) use residual::{ - general_form, reads_other_words, residual_form_of, uniform_residual_form_of, -}; +pub(crate) use residual::{general_form, residual_form_of}; pub(crate) use residual::{reads_views_at_bind, residual_form, uniform_residual_form}; /// A Metal render pipeline state (`MTLRenderPipelineState`): one that draws, or a tile pipeline's diff --git a/crates/metal2vulkan-runtime/src/pipeline/render/residual.rs b/crates/metal2vulkan-runtime/src/pipeline/render/residual.rs index c104293fe..494d8d662 100644 --- a/crates/metal2vulkan-runtime/src/pipeline/render/residual.rs +++ b/crates/metal2vulkan-runtime/src/pipeline/render/residual.rs @@ -62,16 +62,9 @@ //! specializations and the dispatches' regions take that form before any key is looked up //! (`RenderVariant::plan`, `Variant::keyed_regions`): off that profile a state's creation makes //! the one pipeline its draws at every bind offset take, and on it the two the module's -//! **Made at creation, both forms** names. A kernel's uniform view there has a storage twin -//! (`DescriptorView::UniformWithStorageTwin`), whose key the plan keeps where no other -//! `RangeAtBindOffset` constant of the key is 0 and the kernel reads no other word the binder -//! writes for it ([`reads_other_words`]: a root table's address, a multi-region or flat grid's -//! region): at 1 it reads the twin at its bind offset alone, not the uniform view, which pays -//! only where no such word is left to read ([`uniform_residual_form_of`]); beside a storage -//! view bound elsewhere, or such a word, it takes 0, and the uniform view at its residual. The -//! shapes and plans stay every device's (`argument_table::AtBindViews`): a bind offset the view -//! base alignment divides still makes a shape and a plan of its own, whose key's uniform views -//! alone take their residual form. +//! **Made at creation, both forms** names. The shapes and plans stay every device's +//! (`argument_table::AtBindViews`): a bind offset the view base alignment divides still makes a +//! shape and a plan of its own, whose key's uniform views alone take their residual form. //! - **Only GPU time moves.** Until the key's making lands, its draws' uniform reads take the //! residual: on ANV, loads where the key's form has pushed constants. `WorkCounts` counts the //! draws and dispatches recorded so (`residual_form_draws`) and the makings begun so @@ -126,10 +119,7 @@ use crate::pipeline::objects::RawPipeline; use crate::render_target::RenderPassObject; use metal2vulkan::cache::SpecializationKey; use metal2vulkan::device::DriverFact; -use metal2vulkan::pipeline::{ - PipelineInterface, PushField, SlotInterface, SlotRef, SpecConstant, SpecKey, Stage, -}; -use metal2vulkan::vk::SpecializationMapEntry; +use metal2vulkan::pipeline::{PipelineInterface, SlotInterface, SlotRef, SpecConstant, SpecKey}; use std::collections::BTreeSet; use std::sync::Arc; @@ -163,7 +153,7 @@ impl RenderVariant { .stages .iter() .flat_map(|module| &module.specialization.constants); - uniform_residual_form(constants, &self.pipeline.interface, false, specialization) + uniform_residual_form(constants, &self.pipeline.interface, specialization) } /// `key` with its specialization's general form ([`general_form`](Self::general_form)), where @@ -236,130 +226,20 @@ pub(crate) fn residual_form<'a>( /// stages') whose slot `interface` (the pipeline's) reads through a uniform view at 0, the key a /// plan takes where the device reads its uniform views at their residuals (the module docs); /// `None` where every one of them is 0 there already. A storage view's constant, which only a -/// profile taking `DriverWorkaround::PushReadsLengthenThreadPayload` declares, keeps its value: -/// at its bind offset alone it reads no residual word there. A uniform view's with a storage twin -/// (`DescriptorView::UniformWithStorageTwin`), declared there alone too, keeps its value where no -/// other `RangeAtBindOffset` constant of the key is 0 and its stage reads no other word the binder -/// writes for it ([`reads_other_words`], of the interface's push placements; `flat_grid`: the -/// pipeline is a kernel's flat-grid variant): at 1 it reads the twin, not the uniform view, which -/// pays only where it leaves no such word to read ([`uniform_residual_form_of`]). Where neither -/// declares the key this is [`residual_form`]. +/// profile taking `DriverWorkaround::PushReadsLengthenThreadPayload` declares, keeps its value: its +/// bind at offset 0 reads no residual word there. Where no storage view declares the key this is +/// [`residual_form`]. pub(crate) fn uniform_residual_form<'a>( constants: impl Iterator + Clone, interface: &PipelineInterface, - flat_grid: bool, specialization: &SpecializationKey, ) -> Option { - let form = |slot| match interface.slots.get(&slot) { - Some(SlotInterface::Buffer(b)) => Some(b.form), - _ => None, + let uniform = |slot| { + matches!(interface.slots.get(&slot), + Some(SlotInterface::Buffer(b)) if b.form.uniform_view()) }; - let uniform = |slot| form(slot).is_some_and(|f| f.uniform_view() && !f.storage_twin()); - let twin = |slot| form(slot).is_some_and(|f| f.storage_twin()); let constants = constants.map(|constant| (constant.id, constant.key)); - let placed = || { - (interface.push.iter()) - .flat_map(|placement| (placement.fields.iter()).map(|f| (placement.stage, f.field))) - }; - let other_words = |stage, key: &SpecializationKey| { - reads_other_words(placed(), constants.clone(), (stage, flat_grid), key) - }; - uniform_residual_form_of( - constants.clone(), - uniform, - twin, - other_words, - specialization, - ) -} - -/// `specialization` with each `SpecKey::RangeAtBindOffset` constant of `constants` (a pipeline's -/// stages', each its ID and its meaning) whose slot `uniform` holds at 0, and each whose slot -/// `twin` holds (a uniform view with a storage twin) at 0 too where a `RangeAtBindOffset` -/// constant of that key is 0 (a view that reads its pushed residual word), or where `other_words` -/// holds of a twin's stage at 1 under that key (the stage reads another word the binder writes -/// for it, [`reads_other_words`]); `None` where every one of them is 0 there already. A constant -/// `specialization` gives no entry takes the module's default, 0. -/// -/// A twin's key at 1 reads the twin, a storage view, at its bind offset, and pays where it leaves -/// no residual word to read: on ANV, Mesa 26.2.6 on the Iris Xe of RPL-P -/// (`DriverWorkaround::PushReadsLengthenThreadPayload`), `dispatch_chain`'s kernel of three -/// storage views and the word of 1 (4480 threadgroups of 256, 200 dispatches a command buffer, -/// medians of 7 interleaved rounds, job m3-max-34864) ran in 102.1 us a dispatch with its storage -/// views at offset 0 and the word inline (`--binds 4`) through the twin, against 142.8 us through -/// the uniform view at its residual; with two storage views and the word at offsets that move -/// every dispatch (`--binds moved`), which keeps the storage views' residual words, it ran in -/// 154.0 us through the twin against 143.1 us through the uniform view. The payload is the -/// stage's push reads' (job m3-max-34063: the runtime's module of a storage view ran in 120.24 us -/// a dispatch, and 55.69 us with its one push read replaced by a constant), so any other word the -/// stage reads keeps it long as a residual word does. -pub(crate) fn uniform_residual_form_of( - constants: impl Iterator + Clone, - uniform: impl Fn(SlotRef) -> bool, - twin: impl Fn(SlotRef) -> bool, - other_words: impl Fn(Stage, &SpecializationKey) -> bool, - specialization: &SpecializationKey, -) -> Option { - let plan = residual_form_of(constants.clone(), &uniform, specialization); - let key = plan.as_ref().unwrap_or(specialization); - let reads_residual = constants - .clone() - .any(|(id, key_of)| matches!(key_of, SpecKey::RangeAtBindOffset(_)) && !is_set(key, id)); - let reads_other = constants.clone().any(|(id, key_of)| { - matches!(key_of, SpecKey::RangeAtBindOffset(slot) - if twin(slot) && is_set(key, id) && other_words(slot.stage, key)) - }); - match reads_residual || reads_other { - true => residual_form_of( - constants, - |slot| uniform(slot) || twin(slot), - specialization, - ), - false => plan, - } -} - -/// Whether `stage`, of a pipeline whose placed push fields are `fields` (each with its stage, the -/// interface's `PushPlacement`s) and whose stages' constants are `constants`, reads under -/// `specialization` a word the binder writes for it other than a residual the key's -/// `RangeAtBindOffset` constants leave unread (`flat_grid`: the pipeline is a kernel's flat-grid -/// variant). Each field placed for the stage, in its push window or its `ArgumentTable` (a -/// uniform buffer read at constant offsets, which ANV pushes too, the module docs), is read but: -/// a slot's `SlotBindOffset` residual where the key sets the slot's `RangeAtBindOffset`; and the -/// `DispatchRegion` words where the key leaves the stage's -/// `MultiRegion` 0 (a single-region threadgroup dispatch, `lower::dispatch`'s regions), but on a -/// flat-grid variant, whose one region reads them whatever that constant says -/// (`bind::dispatch`'s ragged grids). A root table's or the execution status's address, a replay's -/// region record, a slot's guest base, a texture's levels and every other field are read wherever -/// placed. -pub(crate) fn reads_other_words( - mut fields: impl Iterator, - constants: impl Iterator + Clone, - (stage, flat_grid): (Stage, bool), - specialization: &SpecializationKey, -) -> bool { - let set = |wanted: SpecKey| { - (constants.clone()).any(|(id, key)| key == wanted && is_set(specialization, id)) - }; - let multi_region = match stage { - Stage::Object => SpecKey::ObjectMultiRegion, - _ => SpecKey::MultiRegion, - }; - fields.any(|(of, field)| { - of == stage - && match field { - PushField::SlotBindOffset(slot) => !set(SpecKey::RangeAtBindOffset(slot)), - PushField::DispatchRegion => flat_grid || set(multi_region), - _ => true, - } - }) -} - -/// Whether constant `id` of `specialization` is not 0; one it gives no entry takes the module's -/// default, 0. -fn is_set(specialization: &SpecializationKey, id: u32) -> bool { - (specialization.entries.iter()) - .any(|entry| entry.constant_id == id && entry_set(specialization, entry)) + residual_form_of(constants, uniform, specialization) } /// `specialization` with each `SpecKey::RangeAtBindOffset` constant of `constants` (a pipeline's @@ -411,7 +291,11 @@ fn zeroed( for entry in &specialization.entries { let at = entry.offset as usize; let range = at..at + entry.size as usize; - if entry_set(specialization, entry) && chosen(entry.constant_id) { + let set = specialization + .data + .get(range.clone()) + .is_some_and(|bytes| bytes.iter().any(|&byte| byte != 0)); + if set && chosen(entry.constant_id) { let zeroed = zeroed.get_or_insert_with(|| specialization.clone()); zeroed.data[range].fill(0); } @@ -419,13 +303,6 @@ fn zeroed( zeroed } -/// Whether `entry` of `specialization` holds a value other than 0. -fn entry_set(specialization: &SpecializationKey, entry: &SpecializationMapEntry) -> bool { - let at = entry.offset as usize; - (specialization.data.get(at..at + entry.size as usize)) - .is_some_and(|bytes| bytes.iter().any(|&byte| byte != 0)) -} - /// Whether `device` reads a uniform view at its bind offset alone where the view's range starts /// there (`SpecKey::RangeAtBindOffset` 1), a `VkPipeline` of its own beside the residual form's /// (the module docs); where not, every key's uniform views take their residual form diff --git a/crates/metal2vulkan-runtime/src/tests/general_form.rs b/crates/metal2vulkan-runtime/src/tests/general_form.rs index 4b90d6cde..2e0dc4baa 100644 --- a/crates/metal2vulkan-runtime/src/tests/general_form.rs +++ b/crates/metal2vulkan-runtime/src/tests/general_form.rs @@ -4,11 +4,9 @@ //! plan takes where the device reads its uniform views at their residuals: those views' constants //! alone at 0. -use crate::pipeline::{ - general_form, reads_other_words, residual_form_of, uniform_residual_form_of, -}; +use crate::pipeline::{general_form, residual_form_of}; use metal2vulkan::cache::SpecializationKey; -use metal2vulkan::pipeline::{PushField, SlotClass, SlotRef, SpecKey, Stage}; +use metal2vulkan::pipeline::{SlotClass, SlotRef, SpecKey, Stage}; use metal2vulkan::vk::SpecializationMapEntry; /// Fragment slot `index` of `class`. @@ -117,173 +115,3 @@ fn a_plans_key_zeroes_its_uniform_views_and_keeps_its_storage_views() { let kept = key([0, 1, 1, 1, 3]); assert_eq!(residual_form_of(constants(), uniform_views, &kept), None); } - -/// A kernel slot's uniform view with a storage twin (`DescriptorView::UniformWithStorageTwin`) -/// keeps its plan's `RangeAtBindOffset` where every other one of the key holds, its twin read at -/// its bind offset then leaving no residual word to read; where one is 0, as a storage view bound -/// past offset 0 is, the twin's takes 0 too, and the kernel reads the uniform view at its residual -/// (`uniform_residual_form_of`). A uniform view of no twin takes 0 in either, and a constant of no -/// slot keeps its value. -#[test] -fn a_twin_keeps_its_key_only_where_no_other_view_reads_its_residual() { - let kernel = |index| SlotRef { - stage: Stage::Kernel, - class: SlotClass::Buffer, - index, - }; - let (storage, moved, twin, other_twin) = (kernel(0), kernel(1), kernel(2), kernel(3)); - let constants = || { - vec![ - (0, SpecKey::RangeAtBindOffset(storage)), - (1, SpecKey::RangeAtBindOffset(moved)), - (2, SpecKey::RangeAtBindOffset(twin)), - (3, SpecKey::RangeAtBindOffset(other_twin)), - (4, SpecKey::BicubicTexels(slot(SlotClass::Texture, 0))), - ] - .into_iter() - }; - let no_uniform = |_: SlotRef| false; - let twins = |at: SlotRef| at == twin || at == other_twin; - let nothing_else = |_: Stage, _: &SpecializationKey| false; - // Every storage view at offset 0 and the constants inline or aligned: the plan's own key. - let at_bind = key([1, 1, 1, 1, 3]); - assert_eq!( - uniform_residual_form_of(constants(), no_uniform, twins, nothing_else, &at_bind), - None - ); - // A storage view bound past offset 0 reads its residual: both twins read their uniform views. - let moved_off = key([1, 0, 1, 1, 3]); - assert_eq!( - uniform_residual_form_of(constants(), no_uniform, twins, nothing_else, &moved_off), - Some(key([1, 0, 0, 0, 3])) - ); - // A twin bound at an offset no alignment divides reads its uniform view's residual, and so - // does the other. - let unaligned = key([1, 1, 0, 1, 3]); - assert_eq!( - uniform_residual_form_of(constants(), no_uniform, twins, nothing_else, &unaligned), - Some(key([1, 1, 0, 0, 3])) - ); - // A uniform view of no twin takes its residual form, which reads its residual word. - let uniform = |at: SlotRef| at == moved; - assert_eq!( - uniform_residual_form_of(constants(), uniform, twins, nothing_else, &at_bind), - Some(key([1, 0, 0, 0, 3])) - ); - // Off the profile that declares twins this is the uniform views' residual form alone. - let none = |_: SlotRef| false; - assert_eq!( - uniform_residual_form_of(constants(), uniform, none, nothing_else, &at_bind), - residual_form_of(constants(), uniform, &at_bind) - ); -} - -/// Kernel buffer slot `index`. -fn kernel(index: u32) -> SlotRef { - SlotRef { - stage: Stage::Kernel, - class: SlotClass::Buffer, - index, - } -} - -/// A key giving IDs from 0 `values`, each four bytes, packed in order. -fn key_of(values: &[u32]) -> SpecializationKey { - let mut key = SpecializationKey::new(); - for (id, &value) in (0..).zip(values) { - key.entries.push(SpecializationMapEntry { - constant_id: id, - offset: key.data.len() as u32, - size: 4, - }); - key.data.extend_from_slice(&value.to_le_bytes()); - } - key -} - -/// A twin's key at 1 pays only where the kernel reads no word the binder writes for it beside the -/// views it reads at their bind offsets: where it reads one, which keeps the thread payload long -/// as a residual word does, the twin's key takes 0, and the kernel reads its uniform view at its -/// residual (`uniform_residual_form_of`'s `other_words`). The kernel here has a storage view and a -/// twin, both held; where it reads no other word the plan's own key stands. -#[test] -fn a_twin_takes_0_where_its_stage_reads_another_word() { - let (storage, twin) = (kernel(0), kernel(1)); - let constants = || { - vec![ - (0, SpecKey::RangeAtBindOffset(storage)), - (1, SpecKey::RangeAtBindOffset(twin)), - ] - .into_iter() - }; - let no_uniform = |_: SlotRef| false; - let twins = |at: SlotRef| at == twin; - let at_bind = key_of(&[1, 1]); - let kernel_reads = |stage: Stage, _: &SpecializationKey| stage == Stage::Kernel; - assert_eq!( - uniform_residual_form_of(constants(), no_uniform, twins, kernel_reads, &at_bind), - Some(key_of(&[1, 0])), - "a kernel that reads another word reads its twin's uniform view at its residual" - ); - let none = |_: Stage, _: &SpecializationKey| false; - assert_eq!( - uniform_residual_form_of(constants(), no_uniform, twins, none, &at_bind), - None, - "a kernel that reads no other word keeps its twin's key" - ); - // Another stage's word is not the kernel's. - let fragment_reads = |stage: Stage, _: &SpecializationKey| stage == Stage::Fragment; - assert_eq!( - uniform_residual_form_of(constants(), no_uniform, twins, fragment_reads, &at_bind), - None - ); -} - -/// The words a stage reads under a key beside its views' residuals (`reads_other_words`): a -/// `SlotBindOffset` residual only where the key leaves its slot's `RangeAtBindOffset` 0, or the -/// slot declares none; the `DispatchRegion` words only where the key sets the stage's -/// `MultiRegion`, or on a flat-grid variant whatever it says; every other field wherever it is -/// placed (a root table's address here). Fields of another stage are not the stage's. -#[test] -fn a_stage_reads_its_region_under_multi_region_and_every_other_word_it_places() { - let (storage, twin, undeclared) = (kernel(0), kernel(1), kernel(2)); - let constants = || { - vec![ - (0, SpecKey::RangeAtBindOffset(storage)), - (1, SpecKey::RangeAtBindOffset(twin)), - (2, SpecKey::MultiRegion), - ] - .into_iter() - }; - // The kernel's region words and its two views' residuals, and `extra`. - let fields = |extra: &[(Stage, PushField)]| { - let mut fields = vec![ - (Stage::Kernel, PushField::DispatchRegion), - (Stage::Kernel, PushField::SlotBindOffset(storage)), - (Stage::Kernel, PushField::SlotBindOffset(twin)), - ]; - fields.extend_from_slice(extra); - fields - }; - let reads = |fields: Vec<(Stage, PushField)>, flat_grid, values: [u32; 3]| { - let at = (Stage::Kernel, flat_grid); - reads_other_words(fields.into_iter(), constants(), at, &key_of(&values)) - }; - // A single-region dispatch with both views held reads none. - assert!(!reads(fields(&[]), false, [1, 1, 0])); - // A multi-region one reads its region. - assert!(reads(fields(&[]), false, [1, 1, 1])); - // A flat grid reads its region whatever `MultiRegion` says. - assert!(reads(fields(&[]), true, [1, 1, 0])); - // A storage view off its bind offset reads its residual. - assert!(reads(fields(&[]), false, [0, 1, 0])); - // A residual of a slot that declares no `RangeAtBindOffset` is read whatever the key says. - let unkeyed = [(Stage::Kernel, PushField::SlotBindOffset(undeclared))]; - assert!(reads(fields(&unkeyed), false, [1, 1, 0])); - // A root table's address is read wherever it is placed. - let root = [(Stage::Kernel, PushField::RootTableAddress)]; - assert!(reads(fields(&root), false, [1, 1, 0])); - // Another stage's fields are not the kernel's. - let fragment = [(Stage::Fragment, PushField::RootTableAddress)]; - assert!(!reads(fields(&fragment), false, [1, 1, 0])); -} diff --git a/crates/metal2vulkan-runtime/src/tests/neutral_zeros_shared.rs b/crates/metal2vulkan-runtime/src/tests/neutral_zeros_shared.rs index 76b46a159..e9897c685 100644 --- a/crates/metal2vulkan-runtime/src/tests/neutral_zeros_shared.rs +++ b/crates/metal2vulkan-runtime/src/tests/neutral_zeros_shared.rs @@ -19,13 +19,10 @@ //! # Why only a read-only binding //! //! One buffer shared by every command of the device is sound only where no shader can store -//! through the binding. A Vulkan uniform-buffer descriptor is read-only by construction, and so is -//! a uniform view's storage twin, a storage buffer its kernel only loads from (a kernel's -//! `constant` slot on a profile that takes `DriverWorkaround::PushReadsLengthenThreadPayload`, -//! where the unbound slot below binds both): those are the bindings served from it -//! (`BindingPlan::read_only_buffer`, decided from the plan's layout alone, never a function or -//! shader name). A writable binding keeps a region of its own, exactly as every binding did, so -//! nothing a shader stores is ever read by another command. +//! through the binding. A Vulkan uniform-buffer descriptor is read-only by construction, so that +//! is the binding served from it (`binding::read_only_buffer`, decided from the descriptor type +//! alone). A writable binding keeps a region of its own, exactly as every binding did, so nothing +//! a shader stores is ever read by another command. //! //! # Counts, not times //! diff --git a/crates/metal2vulkan-runtime/src/tests/uniform_bind_offsets.rs b/crates/metal2vulkan-runtime/src/tests/uniform_bind_offsets.rs index d84901a60..a59816756 100644 --- a/crates/metal2vulkan-runtime/src/tests/uniform_bind_offsets.rs +++ b/crates/metal2vulkan-runtime/src/tests/uniform_bind_offsets.rs @@ -17,8 +17,6 @@ //! bound to nothing as one bound at offset 0, and makes that key and its residual form both //! ([`storage_views_keyed`]): `ubo_offsets_kernel`'s output, bound at offset 0, takes the //! creation's key, and a draw binding a storage view elsewhere takes the residual form at once. -//! There a kernel's constants also have a storage twin, read where their key holds, which a -//! dispatch at an aligned offset or of inline bytes takes, the creation's key. //! //! A device test: compiled only under the validation crate's GPU safety cfgs (`m2v_gpu`, //! `m2v_cpu_icd`), on the kind of device the cfg selects. The functions are those of the owned @@ -962,96 +960,6 @@ fn kernel_constants_read_at_every_bind_offset() { } } -/// A kernel's constants bound at offsets the view base alignment divides (0 and 128, a multiple -/// of every device's) and as inline bytes take the key its creation predicted and made, and make -/// nothing; on a profile that takes `DriverWorkaround::PushReadsLengthenThreadPayload` that key -/// reads them through their storage twin (`DescriptorView::UniformWithStorageTwin`) at their bind -/// offset. Bound then at offset 4, which no alignment divides, they are read through the uniform -/// view at their residual: there a key of its own (the output still read at its bind offset 0), -/// taken through the creation's residual form at once while it is made on the pool, one -/// pipeline; elsewhere the creation's. With the device's pool held, each dispatch reads its bytes. -#[test] -fn kernel_constants_at_aligned_offsets_take_the_creations_key() { - let scratch = Scratch::new("uniform-twin-kernel"); - let device = device(&scratch.0); - let queue = device.new_command_queue().unwrap(); - let function = library(&device) - .new_function_with_name("ubo_offsets_kernel") - .unwrap(); - let keyed = u64::from(storage_views_keyed(&device)); - let state = kernel_state(&device, &function); - let created = idle(&device); - let [width, height, depth] = PREDICTED_THREADS; - let threads = Size::new(u64::from(width), u64::from(height), u64::from(depth)); - let data = constants(); - let constants = device - .new_buffer_with_bytes(&data, ResourceOptions::shared()) - .unwrap(); - // `None`: inline bytes from offset 8. - let offsets = [Some(0), Some(128), None, Some(4)]; - let outputs: Vec = offsets - .iter() - .map(|_| device.new_buffer(16, ResourceOptions::shared()).unwrap()) - .collect(); - let took = |from: &crate::WorkCounts, to: &crate::WorkCounts| { - ( - to.residual_form_draws - from.residual_form_draws, - to.dispatch_pipelines_pooled - from.dispatch_pipelines_pooled, - to.variant_pipelines_made - from.variant_pipelines_made, - ) - }; - let hold = crate::pipeline::pool::held::hold(); - let command_buffer = queue.command_buffer().unwrap(); - let mut encoder = command_buffer.compute_command_encoder().unwrap(); - encoder.set_compute_pipeline_state(&state).unwrap(); - let mut counts = vec![device.work_counts()]; - for (offset, output) in offsets.iter().zip(&outputs) { - match offset { - Some(at) => encoder.set_buffer(Some(&constants), *at, 0).unwrap(), - None => encoder.set_bytes(&data[8..24], 0).unwrap(), - } - encoder.set_buffer(Some(output), 0, 1).unwrap(); - encoder - .dispatch_threadgroups(Size::new(1, 1, 1), threads) - .unwrap(); - counts.push(device.work_counts()); - } - encoder.end_encoding().unwrap(); - command_buffer.commit().unwrap(); - command_buffer - .wait_until_completed_for(WAIT) - .expect("the dispatches' command buffer waits for no making"); - assert_eq!(command_buffer.error(), None); - drop(hold); - assert_eq!( - took(&counts[0], &counts[3]), - (0, 0, 0), - "dispatches at 0 and 128 and of inline bytes: residual-form dispatches, regions pooled, \ - pipelines made" - ); - assert_eq!( - took(&counts[3], &counts[4]), - (keyed, keyed, 0), - "a dispatch at 4: residual-form dispatches, regions pooled, pipelines made" - ); - assert_eq!( - idle(&device).variant_pipelines_made - created.variant_pipelines_made, - keyed, - "pipelines made once the pool ran" - ); - for (offset, output) in offsets.iter().zip(&outputs) { - let at = offset.unwrap_or(8) as usize / 4; - let words = bytes_of(output); - let read = |w: usize| f32::from_le_bytes(words[w * 4..w * 4 + 4].try_into().unwrap()); - let want = |i: usize| i as f32 / 255.0; - assert_eq!( - [read(0), read(1)], - [want(at), want(at + 2)], - "offset {offset:?}" - ); - } -} - /// A kernel reads a `device` buffer through a storage view at bind offset 0, then at offsets past /// it and at 0 again (`engine/buffer_end_byte_load.ll`: `out[0] = in[5]`), and each dispatch reads /// the bound bytes, whichever form its key takes. On a device whose profile takes diff --git a/crates/metal2vulkan-validation/src/executor_contract/out_of_bounds.rs b/crates/metal2vulkan-validation/src/executor_contract/out_of_bounds.rs index c3a7bae3b..bc5278c25 100644 --- a/crates/metal2vulkan-validation/src/executor_contract/out_of_bounds.rs +++ b/crates/metal2vulkan-validation/src/executor_contract/out_of_bounds.rs @@ -556,10 +556,7 @@ pub fn containment( (ContainmentForm::BufferAtomic, atomic_check) } DescriptorView::Storage => (ContainmentForm::StorageBuffer, robust), - // A storage twin reads the same range under the same robustness. - DescriptorView::UniformWords - | DescriptorView::UniformVec4 - | DescriptorView::UniformWithStorageTwin => { + DescriptorView::UniformWords | DescriptorView::UniformVec4 => { (ContainmentForm::UniformBuffer, robust) } _ => return unknown(), @@ -653,8 +650,7 @@ pub fn containment( BufferForm::Descriptor( DescriptorView::Storage | DescriptorView::UniformWords - | DescriptorView::UniformVec4 - | DescriptorView::UniformWithStorageTwin, + | DescriptorView::UniformVec4, ) => made(target.form, Medium::DescriptorView, robust, false), _ => unknown(), }, diff --git a/crates/metal2vulkan/src/bind/dispatch/tests.rs b/crates/metal2vulkan/src/bind/dispatch/tests.rs index f3c8410d2..56995592d 100644 --- a/crates/metal2vulkan/src/bind/dispatch/tests.rs +++ b/crates/metal2vulkan/src/bind/dispatch/tests.rs @@ -84,7 +84,6 @@ fn template() -> ComputeTemplate { length_class: crate::bind::state::length_class(4096), }, disjoint: false, - twin: None, }], spec: vec![ spec(0, SpecKey::LocalSize(Axis::X)), diff --git a/crates/metal2vulkan/src/bind/graphics.rs b/crates/metal2vulkan/src/bind/graphics.rs index 9c87f399a..d1124c227 100644 --- a/crates/metal2vulkan/src/bind/graphics.rs +++ b/crates/metal2vulkan/src/bind/graphics.rs @@ -331,7 +331,7 @@ use crate::bind::neutral::{zero_buffer_bytes, NeutralResource}; use crate::bind::plan::compute::{internal, not_implemented, spec_key, tile_memory}; use crate::bind::plan::resources::{separate_samplers, ResourcePlanner}; use crate::bind::plan::slots::{ - address_map_variant, anisotropic_variant, bindings, bound_value, buffer_uses, check_slots, + address_map_variant, anisotropic_variant, bindings, bound_value, buffer_use, check_slots, check_sparse_textures, cross_variant, cubic_variant, heap_raw, heap_ycbcr_writes, large_view_candidates, mark_disjoint, plan_buffer, psb_variant, range_variant, record_noted, record_specialized, snapshot_forms, srgb_variant, storage_view_variant, @@ -2018,8 +2018,7 @@ fn plan(p: &RenderPipeline, device: &Device, shape: &BindShape) -> Result { + BindingSource::Buffer(slot) => { let pb = planned(slot).ok_or_else(|| { internal(format!("binding of {slot:?} without an interface slot")) })?; @@ -2503,7 +2502,7 @@ fn plan(p: &RenderPipeline, device: &Device, shape: &BindShape) -> Result = buffers .iter() .filter(|b| matches!(b.bound, BoundKind::Buffer { .. })) - .flat_map(|b| buffer_uses(b, stage_flags(b.slot.stage))) + .map(|b| buffer_use(b, stage_flags(b.slot.stage))) .collect(); // The factors: the control stage's, or an emulated pipeline's scan's. if factor_binding.is_some() @@ -5144,8 +5143,8 @@ fn rebinds_into(t: &GraphicsTemplate, slots: &[SlotRef], into: &mut SlotRebinds) into.vertex.clear(); let changed = |slot: SlotRef| slot.class == SlotClass::Buffer && slots.contains(&slot); // What the slots decide some other way than below: a stage's argument or root table, a mesh - // or patch draw's own reads, a de-indexed draw's layout, a uniform view a written slot may - // alias, and a uniform view's storage twin, a second range of its slot. + // or patch draw's own reads, a de-indexed draw's layout, and a uniform view a written slot + // may alias. let other_reads = t .stages .iter() @@ -5153,8 +5152,7 @@ fn rebinds_into(t: &GraphicsTemplate, slots: &[SlotRef], into: &mut SlotRebinds) || t.mesh.is_some() || t.tessellation.is_some() || t.deindexed.is_some() - || (t.buffers.iter().any(|b| b.disjoint) && t.buffers.iter().any(|b| b.access.write)) - || t.buffers.iter().any(|b| b.twin.is_some()); + || (t.buffers.iter().any(|b| b.disjoint) && t.buffers.iter().any(|b| b.access.write)); // A texture slot's texels a texture buffer's range bounds, which the commands hold. let texel_range = |slot: &SlotRef| t.resources.texel_buffers.iter().any(|pt| pt.slot == *slot); let texels = slots diff --git a/crates/metal2vulkan/src/bind/graphics/tests.rs b/crates/metal2vulkan/src/bind/graphics/tests.rs index c6611cba2..1a9758878 100644 --- a/crates/metal2vulkan/src/bind/graphics/tests.rs +++ b/crates/metal2vulkan/src/bind/graphics/tests.rs @@ -821,7 +821,6 @@ fn draws_bind_vertex_buffers_at_aligned_offsets_with_their_windows() { length_class: length_class(4096), }, disjoint: false, - twin: None, }], stages: Vec::new(), vertex_buffers: vertex_buffers(), diff --git a/crates/metal2vulkan/src/bind/instantiate.rs b/crates/metal2vulkan/src/bind/instantiate.rs index 92673ab6b..87c67941f 100644 --- a/crates/metal2vulkan/src/bind/instantiate.rs +++ b/crates/metal2vulkan/src/bind/instantiate.rs @@ -615,9 +615,7 @@ pub(crate) fn shared_range( /// offset 0 (`SpecKey::RangeAtBindOffset`, where its profile declares the key, set only where /// [`starts_at_bind`] holds there, which leaves that range's residual 0), and a uniform view of /// one where `views_at_residual` (no function reads it at its bind offset alone), take -/// [`shared_range`]'s, where it holds the window; not a uniform view with a storage twin -/// (`DescriptorView::UniformWithStorageTwin`), whose key reads the twin at its bind offset alone -/// whatever `views_at_residual` says; +/// [`shared_range`]'s, where it holds the window; /// - every other slot takes [`descriptor_range`]'s, which starts at the bind offset aligned down /// to the descriptor base alignment: a uniform view's key may read it at its bind offset alone, /// where its residual is 0. @@ -635,8 +633,7 @@ pub(crate) fn planned_range( && end <= pb.max_range && end <= 1 << 32; if !from_start { - let at_residual = views_at_residual && !pb.form.storage_twin(); - let shared = (storage || (at_residual && pb.form.uniform_view())) + let shared = (storage || (views_at_residual && pb.form.uniform_view())) .then(|| shared_range(bind_offset, length, pb.window, pb.alignment, pb.max_range)) .flatten(); return match shared { @@ -816,15 +813,6 @@ pub(crate) fn bind_buffers( element: 0, range, }); - // A uniform view's storage twin binds the same range. - if let Some((set, binding)) = pb.twin { - descriptor_ranges.push(DescriptorRange { - set, - binding, - element: 0, - range, - }); - } out.residuals.push(pb.slot, residual); } (BufferForm::Psb, _) => { diff --git a/crates/metal2vulkan/src/bind/instantiate/tests.rs b/crates/metal2vulkan/src/bind/instantiate/tests.rs index 8f2d6051a..c2183c5d8 100644 --- a/crates/metal2vulkan/src/bind/instantiate/tests.rs +++ b/crates/metal2vulkan/src/bind/instantiate/tests.rs @@ -208,7 +208,6 @@ fn planned(window: Window, view: DescriptorView, alignment: u64, max_range: u64) length_class: crate::bind::state::length_class(1 << 12), }, disjoint: false, - twin: None, } } @@ -485,59 +484,6 @@ fn bounded_slots_read_at_their_residual_share_one_range_along_a_buffer() { } } -/// A uniform view with a storage twin binds its range from its bind offset, its residual 0, also -/// where the consumer reads every uniform view at its residual: its key reads the twin at its -/// bind offset alone. A plain uniform view there shares one range from the buffer's start, the -/// negative control. `bind_buffers` writes the twin's binding with the uniform binding's range. -#[test] -fn a_uniform_view_with_a_storage_twin_binds_its_range_from_its_bind_offset() { - use crate::bind::state::{BindState, BoundBuffer, StageTable}; - const CHUNK: u64 = 64 * 1024; - let bounded = Window::Bounded { start: 0, len: 16 }; - let mut twin = planned(bounded, DescriptorView::UniformWithStorageTwin, 64, CHUNK); - let plain = planned(bounded, DescriptorView::UniformWords, 64, CHUNK); - for bind_offset in (0..CHUNK).step_by(256) { - for at_residual in [false, true] { - let (range, residual) = planned_range(&twin, bind_offset, CHUNK, at_residual).unwrap(); - assert_eq!( - (range.offset, residual), - (bind_offset, 0), - "{bind_offset} {at_residual}" - ); - } - let (range, residual) = planned_range(&plain, bind_offset, CHUNK, true).unwrap(); - assert_eq!( - (range.offset, u64::from(residual)), - (0, bind_offset), - "{bind_offset}" - ); - } - twin.twin = Some((0, 3)); - let mut table = StageTable::default(); - table.buffers.insert( - twin.slot.index, - BoundBuffer::Buffer { - gpu_address: 0x1_0000, - // `planned`'s length class. - length: 1 << 12, - offset: 256, - device_address: None, - attribute_stride: None, - }, - ); - let mut state = BindState::default(); - state.stages.insert(twin.slot.stage, table); - state.uniform_views_at_residual = true; - let slot = twin.slot; - let (mut ranges, mut extents) = (Vec::new(), Vec::new()); - let bound = bind_buffers(&[twin], &state, &mut ranges, &mut extents).unwrap(); - let keys: Vec<_> = ranges.iter().map(|r| (r.set, r.binding)).collect(); - assert_eq!(keys, [(0, 0), (0, 3)]); - assert_eq!(ranges[0].range, ranges[1].range); - assert_eq!(ranges[0].range.offset, 256); - assert_eq!(bound.residuals.of(slot), Some(0)); -} - fn entry(host: u64, guest: u64, size: u64) -> RootEntry { RootEntry { host, diff --git a/crates/metal2vulkan/src/bind/plan.rs b/crates/metal2vulkan/src/bind/plan.rs index d84380f6f..06adac2bf 100644 --- a/crates/metal2vulkan/src/bind/plan.rs +++ b/crates/metal2vulkan/src/bind/plan.rs @@ -78,26 +78,6 @@ impl BindingPlan { .find(|(k, _)| *k == key) .map(|(_, v)| u64::from(*v)) } - - /// Whether no function of the plan's pipeline can store through the buffer binding `write` - /// (one of [`descriptors`](Self::descriptors)) writes: a uniform buffer, whose block Vulkan - /// makes read-only, or a uniform view's storage twin (`DescriptorView::UniformWithStorageTwin`), - /// a storage buffer the function only loads from. A consumer may bind there one buffer that - /// every command shares, such as the zeros of a `NeutralResource::ZeroBuffer` it keeps for the - /// device's lifetime; through any other storage buffer a function may store, so such a binding - /// takes a buffer of its command's own. - pub fn read_only_buffer(&self, write: &DescriptorWrite) -> bool { - let at = (write.set, write.binding); - let twin = |buffers: &[PlannedBuffer]| buffers.iter().any(|b| b.twin == Some(at)); - match write.ty { - vk::DescriptorType::UNIFORM_BUFFER | vk::DescriptorType::UNIFORM_BUFFER_DYNAMIC => true, - vk::DescriptorType::STORAGE_BUFFER => { - (self.compute.as_ref()).is_some_and(|c| twin(&c.buffers)) - || (self.graphics.as_ref()).is_some_and(|g| twin(&g.buffers)) - } - _ => false, - } - } } // Adding a field to a plan type: a plan's content digest omits a field whose value is zero (`0`, @@ -581,10 +561,6 @@ pub(crate) struct PlannedBuffer { /// its window (`RuntimeFact::UniformViewAliasing`). #[cfg_attr(feature = "serde", serde(default))] pub disjoint: bool, - /// `(set, binding)` of the slot's storage twin (`DescriptorView::UniformWithStorageTwin`), - /// written with the slot's own buffer and range. - #[cfg_attr(feature = "serde", serde(default))] - pub twin: Option<(u32, u32)>, } /// What a shape binds at a buffer slot. diff --git a/crates/metal2vulkan/src/bind/plan/compute.rs b/crates/metal2vulkan/src/bind/plan/compute.rs index 3f53f23e1..0b5d5043e 100644 --- a/crates/metal2vulkan/src/bind/plan/compute.rs +++ b/crates/metal2vulkan/src/bind/plan/compute.rs @@ -61,7 +61,7 @@ use super::resources::{separate_samplers, ResourcePlanner}; use super::slots::{ - address_map_variant, anisotropic_variant, bindings, bound_value, buffer_uses, check_slots, + address_map_variant, anisotropic_variant, bindings, bound_value, buffer_use, check_slots, check_sparse_textures, cross_variant, cubic_variant, heap_raw, heap_ycbcr_writes, mark_disjoint, open_cl_line_variant, plan_buffer, psb_variant, record_noted, record_specialized, srgb_variant, storage_view_variant, texel_buffer_parts_variant, used_uses, @@ -574,8 +574,7 @@ fn plan(p: &ComputePipeline, device: &Device, shape: &BindShape) -> Result { + BindingSource::Buffer(slot) => { let pb = planned(slot).ok_or_else(|| { internal(format!("binding of {slot:?} without an interface slot")) })?; @@ -829,7 +828,7 @@ fn plan(p: &ComputePipeline, device: &Device, shape: &BindShape) -> Result = buffers .iter() .filter(|b| matches!(b.bound, BoundKind::Buffer { .. })) - .flat_map(|b| buffer_uses(b, compute_stage)) + .map(|b| buffer_use(b, compute_stage)) .collect(); uses.extend(used_uses( &shape.used, diff --git a/crates/metal2vulkan/src/bind/plan/slots.rs b/crates/metal2vulkan/src/bind/plan/slots.rs index 490229224..1cf4ad3ab 100644 --- a/crates/metal2vulkan/src/bind/plan/slots.rs +++ b/crates/metal2vulkan/src/bind/plan/slots.rs @@ -155,15 +155,6 @@ pub(crate) fn plan_buffer( None } }; - let twin = match b.form.storage_twin() { - true => Some( - bindings - .get(&BindingSource::StorageTwin(slot)) - .copied() - .ok_or_else(|| internal(format!("slot {slot:?} has no storage twin binding")))?, - ), - false => None, - }; Ok(PlannedBuffer { slot, window: b.window, @@ -174,7 +165,6 @@ pub(crate) fn plan_buffer( max_range, bound, disjoint: false, - twin, }) } @@ -192,9 +182,8 @@ pub(crate) fn plan_buffer( /// nothing has the residual 0 (`instantiate::slot_field`), so either form reads the Metal offset /// alone of the same descriptor: a uniform view's takes false, the form that reads at the /// residual, which keeps the key of a draw that leaves the slot unbound the key that reads every -/// such slot at its residual; a storage view's, and a uniform view's with a storage twin -/// (`DescriptorView::UniformWithStorageTwin`), whose key reads the twin, take what a bind at -/// offset 0 takes, the commonest bind, so that a plan of nothing bound, which a consumer makes before any draw binds +/// such slot at its residual; a storage view's takes what a bind at offset 0 takes, the +/// commonest bind, so that a plan of nothing bound, which a consumer makes before any draw binds /// the slot (the runtime's creation, `pipeline/predicted.rs` and `pipeline/dispatch_making.rs`, /// and a warm pass's replay of a dispatch, `pipeline/dispatch_record.rs`), names the key of the /// draw that binds it there. @@ -218,7 +207,7 @@ pub(crate) fn range_at_bind_offset( offset_alignment, .. }) => u64::from(offset_alignment), Some(BufferShape::Bytes { .. }) => 0, - None if !b.form.uniform_view() || b.form.storage_twin() => 0, + None if !b.form.uniform_view() => 0, None => return false, }; let alignment = crate::memory::views::base_alignment(min); @@ -1042,37 +1031,27 @@ pub(crate) fn range_variant(slot: SlotRef, bound: BoundKind, profile: &DevicePro && matches!(bound, BoundKind::Buffer { length_class, .. } if !class_fits(length_class, storage)) } -/// The `uses` entries of a bound buffer slot: its proven access, `Uniform` for a uniform view and +/// The `uses` entry of a bound buffer slot: its proven access, `Uniform` for a uniform view and /// `Storage` otherwise, `stages`, and the window as a range when it starts at or after the bind -/// offset; a uniform view's storage twin (`DescriptorView::UniformWithStorageTwin`) reads the -/// same bytes as a storage buffer, a `Storage` use of them beside the `Uniform` one. -pub(crate) fn buffer_uses( - b: &PlannedBuffer, - stages: vk::PipelineStageFlags2, -) -> impl Iterator { - let class = if b.form.uniform_view() { - AccessClass::Uniform - } else { - AccessClass::Storage - }; - let twin = b.form.storage_twin().then_some(AccessClass::Storage); - let (slot, access) = (b.slot, b.access); - let range = match b.window { - Window::Bounded { start, len } if start >= 0 => Some(ByteRange { - offset: start as u64, - len, - }), - _ => None, - }; - std::iter::once(class) - .chain(twin) - .map(move |class| ResourceUse { - resource: UseTarget::Slot(slot), - access, - class, - stages, - range, - }) +/// offset. +pub(crate) fn buffer_use(b: &PlannedBuffer, stages: vk::PipelineStageFlags2) -> ResourceUse { + ResourceUse { + resource: UseTarget::Slot(b.slot), + access: b.access, + class: if b.form.uniform_view() { + AccessClass::Uniform + } else { + AccessClass::Storage + }, + stages, + range: match b.window { + Window::Bounded { start, len } if start >= 0 => Some(ByteRange { + offset: start as u64, + len, + }), + _ => None, + }, + } } /// The `uses` of the used resources a pipeline can reach (the handback): buffers and heaps when a diff --git a/crates/metal2vulkan/src/bind/plan/slots/tests.rs b/crates/metal2vulkan/src/bind/plan/slots/tests.rs index acd58170c..13c788770 100644 --- a/crates/metal2vulkan/src/bind/plan/slots/tests.rs +++ b/crates/metal2vulkan/src/bind/plan/slots/tests.rs @@ -66,7 +66,6 @@ fn planned(index: u32, bound: BoundKind, form: BufferForm) -> PlannedBuffer { max_range: 0, bound, disjoint: false, - twin: None, } } @@ -709,97 +708,6 @@ fn a_storage_range_starts_at_the_bind_offset_only_at_offset_0() { } } -/// A uniform view with a storage twin (`DescriptorView::UniformWithStorageTwin`) takes a uniform -/// view's `RangeAtBindOffset` wherever its slot is bound (a buffer at each offset class, inline -/// bytes), on every committed profile and under each window, and bound to nothing what a bind at -/// offset 0 takes, where a plain uniform view takes false. Its plan names the twin's binding, and -/// a plan of the layout without one is refused. -#[test] -fn a_storage_twin_takes_a_uniform_views_key_and_offset_0_s_unbound() { - for (stem, p) in committed_profiles().expect("profiles") { - let limits = &p.fields().limits; - let alignment = - crate::memory::views::base_alignment(limits.min_uniform_buffer_offset_alignment); - for window in [ - Window::Bounded { start: 0, len: 64 }, - Window::Bounded { start: 4, len: 28 }, - Window::Bounded { start: -8, len: 40 }, - ] { - let slot_of = |view| BufferSlot { - access: AccessSet::READ, - window, - form: BufferForm::Descriptor(view), - kind: BufferKind::Buffer, - }; - let (twin, plain) = ( - slot_of(DescriptorView::UniformWithStorageTwin), - slot_of(DescriptorView::UniformWords), - ); - let what = format!("{stem} {window:?}"); - for bind_offset in [0, 4, 16, 20, 64, 260, 1024] { - let shape = BoundBuffer::Buffer { - gpu_address: 0x1_0000, - length: 4096, - offset: bind_offset, - device_address: None, - attribute_stride: None, - } - .shape(alignment as u32, BufferRanges::default()); - assert_eq!( - range_at_bind_offset(&twin, Some(&shape), limits), - range_at_bind_offset(&plain, Some(&shape), limits), - "{what} {bind_offset}" - ); - } - let bytes = BufferShape::Bytes { - attribute_stride: None, - }; - assert_eq!( - range_at_bind_offset(&twin, Some(&bytes), limits), - range_at_bind_offset(&plain, Some(&bytes), limits), - "{what} bytes" - ); - let at_0 = BoundBuffer::Buffer { - gpu_address: 0x1_0000, - length: 4096, - offset: 0, - device_address: None, - attribute_stride: None, - } - .shape(alignment as u32, BufferRanges::default()); - assert_eq!( - range_at_bind_offset(&twin, None, limits), - range_at_bind_offset(&twin, Some(&at_0), limits), - "{what} unbound" - ); - assert!( - !range_at_bind_offset(&plain, None, limits), - "{what} unbound" - ); - let both = [ - (BindingSource::Buffer(slot(0)), (0, 0)), - (BindingSource::StorageTwin(slot(0)), (0, 3)), - ] - .into(); - let pb = plan_buffer((slot(0), &twin, Some(&at_0)), false, limits, &both) - .unwrap_or_else(|e| panic!("{what}: {e:?}")); - assert_eq!( - (pb.binding, pb.twin), - (Some((0, 0)), Some((0, 3))), - "{what}" - ); - let pb = plan_buffer((slot(0), &plain, Some(&at_0)), false, limits, &both) - .unwrap_or_else(|e| panic!("{what}: {e:?}")); - assert_eq!(pb.twin, None, "{what}"); - let alone = [(BindingSource::Buffer(slot(0)), (0, 0))].into(); - assert!( - plan_buffer((slot(0), &twin, Some(&at_0)), false, limits, &alone).is_err(), - "{what}: no twin binding" - ); - } - } -} - /// A slot whose function observes residency (`RuntimeFact::SparseTexture`) binds a texture that is /// not sparse (or nothing) on every profile, and a sparse one where the module has the sparse arm /// or the tile-map arm; without either a sparse texture is refused, naming diff --git a/crates/metal2vulkan/src/cache/codec.rs b/crates/metal2vulkan/src/cache/codec.rs index 5a50027de..3167e2f5e 100644 --- a/crates/metal2vulkan/src/cache/codec.rs +++ b/crates/metal2vulkan/src/cache/codec.rs @@ -873,7 +873,6 @@ codec_enum! { SnapshotTexels(f0), YCbCrPlanes(f0), SamplerArray { compare, integer }, - StorageTwin, } AccelerationStructureLevel { Primitive, Instance } SamplerRef { Slot(f0), Constexpr(f0) } @@ -1202,7 +1201,7 @@ codec_enum! { Window { Bounded { start, len }, Whole } BufferForm { Descriptor(f0), Psb } BufferKind { Buffer, VisibleFunctionTable, IntersectionFunctionTable } - DescriptorView { Storage, UniformWords, UniformVec4, UniformWithStorageTwin } + DescriptorView { Storage, UniformWords, UniformVec4 } PushLoc { Push { offset }, ArgumentTable { offset } } IoRole { Attribute { index }, Varying { user, interpolation }, @@ -1536,7 +1535,6 @@ codec_enum! { SnapshotTexels(f0), YCbCrPlanes(f0), SamplerArray { stage, compare, integer }, - StorageTwin(f0), } VertexStride { Static(f0), PerBind } } diff --git a/crates/metal2vulkan/src/cache/mod.rs b/crates/metal2vulkan/src/cache/mod.rs index bbb7c4131..cd39d025f 100644 --- a/crates/metal2vulkan/src/cache/mod.rs +++ b/crates/metal2vulkan/src/cache/mod.rs @@ -61,7 +61,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 = 2134; +pub const SEMANTICS_VERSION: u32 = 2135; /// The byte-layout version of encoded artifacts (`CompiledFunction::to_bytes` and the /// [`PipelineArtifact`] encodings). Every encoded artifact carries it, and a decode under another @@ -71,7 +71,7 @@ pub const SEMANTICS_VERSION: u32 = 2134; /// re-typed in an encoded type, its `codec` body or its `envelope`. A variant removed while its tag /// stays unused needs no bump: an entry holding it fails to decode, which is a miss. The commit that /// bumps it says what changed; this comment keeps no history. -pub const ARTIFACT_FORMAT_VERSION: u32 = 523; +pub const ARTIFACT_FORMAT_VERSION: u32 = 524; /// The version of what this crate's runtime does with a compiled pipeline: instantiating a binding /// plan (`BindingPlan::instantiate_*`: descriptor ranges, push bytes, root, argument, and handle @@ -94,7 +94,7 @@ pub const ARTIFACT_FORMAT_VERSION: u32 = 523; /// changes no behaviour, and then updates that hash alone with the commit saying why, or changes /// behaviour and also bumps this version. The commit that bumps it says what changed; this comment /// keeps no history. -pub const RUNTIME_VERSION: u32 = 2457; +pub const RUNTIME_VERSION: u32 = 2458; /// The digest of the sources this build of the crate was compiled from: SHA-256, as lowercase hex, /// of the manifest, the build script, and exactly the files the crate roots' module tree compiles diff --git a/crates/metal2vulkan/src/device/driver_facts.rs b/crates/metal2vulkan/src/device/driver_facts.rs index fe13369b2..17b8cae86 100644 --- a/crates/metal2vulkan/src/device/driver_facts.rs +++ b/crates/metal2vulkan/src/device/driver_facts.rs @@ -894,9 +894,7 @@ const fn moltenvk_on_apple(fact: F) -> Measured { /// reads its storage views at their bind offsets, which a command binding them at offset 0, the /// commonest bind, takes, and its general form, which one binding a storage view elsewhere takes /// at once; with the general form alone, every state's first command at offset 0 made a second -/// pipeline. There a kernel's uniform view also binds a storage twin of its range, which it -/// reads at its bind offset alone where its key holds (`DescriptorView::UniformWithStorageTwin`; -/// the workaround's own documentation holds the figures). +/// pipeline. pub(crate) const DEFECTS: &[Measured] = &[ Measured { fact: DriverWorkaround::BothBarycentricFormsRejected, diff --git a/crates/metal2vulkan/src/device/profile.rs b/crates/metal2vulkan/src/device/profile.rs index deef7d6f5..a70d92f3f 100644 --- a/crates/metal2vulkan/src/device/profile.rs +++ b/crates/metal2vulkan/src/device/profile.rs @@ -1589,17 +1589,12 @@ pub enum DriverWorkaround { /// alone is no faster there: a kernel of three storage views at offset 0 and inline bytes ran /// in 161.8 us a dispatch with the bytes' uniform view read so and in 142.8 us with it read at /// its residual, and in 102.1 us with the bytes read through a storage view at their bind - /// offset (job m3-max-34275). So a kernel's uniform view there also has a storage twin - /// (`DescriptorView::UniformWithStorageTwin`, `lower::access`): a storage - /// buffer of the uniform view's own range, decorated `NonWritable` as the uniform buffer is - /// read-only, which the kernel reads instead where the slot's - /// key holds (a bind offset the view base alignment divides, inline bytes, nothing bound), and - /// elsewhere the uniform view at its residual, as on every device without - /// `DriverFact::ConstantOffsetUniformReadsPreloaded`. The runtime keeps a twin's key only - /// where no other view of the key reads its residual and the kernel reads no other word the - /// binder writes for it (a root table's address, a multi-region or flat grid's region): beside - /// a storage view bound past offset 0 the kernel ran in 154.0 us a dispatch through the twin - /// and 143.1 us through the uniform view (job m3-max-34864). It changes no answer. + /// offset (job m3-max-34275). A kernel's uniform view there is read at its residual, as on + /// every device without `DriverFact::ConstantOffsetUniformReadsPreloaded`, and nothing else + /// binds its range: a second binding of that range as a storage buffer, read at its bind + /// offset where the slot's key held, took 145.8 to 150.2 s of GPU time over a walk of guest + /// compute workloads that took 137.4 s without it (three walks against one, Mesa 26.2.6). It + /// changes no answer. PushReadsLengthenThreadPayload, } diff --git a/crates/metal2vulkan/src/lower/access/atomic.rs b/crates/metal2vulkan/src/lower/access/atomic.rs index 8b6490dc7..3476033c1 100644 --- a/crates/metal2vulkan/src/lower/access/atomic.rs +++ b/crates/metal2vulkan/src/lower/access/atomic.rs @@ -1120,9 +1120,8 @@ fn on_target(fb: &mut FunctionBuilder<'_>, p: Prepared, o: Op) -> BResult