diff --git a/crates/metal2vulkan-runtime/README.md b/crates/metal2vulkan-runtime/README.md index 837b1a2fe..516e614e1 100644 --- a/crates/metal2vulkan-runtime/README.md +++ b/crates/metal2vulkan-runtime/README.md @@ -2972,9 +2972,10 @@ cache is answered compile-required on both. - A 64-bit texture atomic (`atomic_min` or `atomic_max` on a `ulong` texture), which Metal's feature set tables give the Apple8 family and later ("GPU devices in the Apple8 family support 64-bit atomic minimum and maximum using ulong, on both buffers and textures, only on macOS"), - is lowered to a 64-bit image atomic, which needs `shaderImageInt64Atomics`. Device creation - enables no 64-bit image atomic, so a state over a function that calls one is - `Error::Translation` of `Unsupported{ImageAtomics}`, needing that feature, on every device. + is refused on every device: a state over a function that calls one is `Error::Translation` of + `Unsupported{ImageAtomics}`, not implemented. Its one exact form is a 64-bit image atomic + (`shaderImageInt64Atomics`), which device creation does not enable; no form over 32-bit + atomics is exact. - Every `VkPipeline` is made through the device's `VkPipelineCache` (The cache directory, above), which is empty on a host's first run. Cold, the driver's time for a recorded session's render pipelines made through it, against the same pipelines made past any cache (states-only plays): @@ -4752,7 +4753,6 @@ enables that the translator names. |---|---|---| | `rasterizationOrderColorAttachmentAccess` | `VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesEXT` | a blend into an extended-range attachment, which the function would compute over its own read of the attachment, is refused (`FramebufferFetch`) | | `robustBufferAccess` | `VkPhysicalDeviceFeatures` | a buffer is reached by its device address, and an access through a descriptor view is checked in the shader | -| `shaderImageInt64Atomics` | `VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT` | an atomic on a `ulong` texture is refused (`ImageAtomics`) | | `computeDerivativeGroupLinear` | `VkPhysicalDeviceComputeShaderDerivativesFeaturesKHR` | a derivative in a kernel is refused (`ComputeDerivatives`) | | `descriptorBindingStorageBufferUpdateAfterBind` | `VkPhysicalDeviceVulkan12Features` | the translator's function table is a directory and a snapshot, never a heap array of storage buffers; the runtime supplies no function table (Known gaps of pipeline states) | | `shaderStorageBufferArrayNonUniformIndexing` | `VkPhysicalDeviceVulkan12Features` | as `descriptorBindingStorageBufferUpdateAfterBind` | diff --git a/crates/metal2vulkan-validation/src/requirement.rs b/crates/metal2vulkan-validation/src/requirement.rs index cd45cf9cb..11a1588cf 100644 --- a/crates/metal2vulkan-validation/src/requirement.rs +++ b/crates/metal2vulkan-validation/src/requirement.rs @@ -182,11 +182,10 @@ pub enum ToolingRequirement { /// A 64-bit texture atomic its module calls (`executor_contract::unsupported_air_requirements`): /// an `atomic_min` or `atomic_max` on a Metal `ulong` texture, an Apple8-family feature (Metal's /// feature set tables: "GPU devices in the Apple8 family support 64-bit atomic minimum and - /// maximum using ulong, on both buffers and textures, only on macOS"). The translator lowers it - /// to a 64-bit image atomic, which needs `shaderImageInt64Atomics`, and the runtime enables no - /// 64-bit image atomic on any device (its floor's features), so it refuses the pipeline on - /// every device as `Unsupported{ImageAtomics}` needing that feature - /// (`device_capability_missing`), a known gap its README states, which is its guard: the limit + /// maximum using ulong, on both buffers and textures, only on macOS"). The translator refuses + /// it on every device as `Unsupported{ImageAtomics}`, not implemented (its one exact form is a + /// 64-bit image atomic, `shaderImageInt64Atomics`, which the runtime enables on no device), a + /// known gap the runtime's README states, which is its guard: the limit /// is the runtime's ([`Limit::Runtime`]) and the engine's candidate does not run the case. The /// Metal oracle runs it, so a case of it stays Metal-qualified ([`Self::qualifies_on_metal`]). UlongTextureAtomic, diff --git a/crates/metal2vulkan/src/bind/neutral.rs b/crates/metal2vulkan/src/bind/neutral.rs index bf40e9e5d..8588b7bad 100644 --- a/crates/metal2vulkan/src/bind/neutral.rs +++ b/crates/metal2vulkan/src/bind/neutral.rs @@ -147,11 +147,10 @@ pub(crate) fn storage_neutral(ty: SampledType) -> vk::Format { } /// Whether a storage image of `format` serves a declaration of numeric type `ty`: the format's -/// own numeric type, or, for `ulong`, `RG32_UINT`, and `R64_UINT` where a `ulong` atomic updates -/// the slot. +/// own numeric type, or, for `ulong`, `RG32_UINT`. fn serves(format: vk::Format, ty: SampledType) -> bool { match ty { - SampledType::Uint64 => matches!(format, vk::Format::R32G32_UINT | vk::Format::R64_UINT), + SampledType::Uint64 => format == vk::Format::R32G32_UINT, _ => numeric_type(format) == Some(ty), } } diff --git a/crates/metal2vulkan/src/bind/plan/resources.rs b/crates/metal2vulkan/src/bind/plan/resources.rs index 1b4f4237b..877a73139 100644 --- a/crates/metal2vulkan/src/bind/plan/resources.rs +++ b/crates/metal2vulkan/src/bind/plan/resources.rs @@ -7,13 +7,10 @@ //! texture type and sampled type), the binding's descriptor type (sampled or storage, image or //! texel buffer), and the pipeline's facts: a cube with `ImageViewShape` is the 2D-array view //! the function declared, a combined binding's depth comparison is its symbol's, and a storage -//! binding's format is the variant's storage-image choice, `Unknown` without one, except a -//! `ulong` slot with `UlongAtomicView`, which is `R64_UINT`. +//! binding's format is the variant's storage-image choice, `Unknown` without one. //! - **Bound and compatible:** a texture view of the bound format through `metal::format` //! (sampled: `vk_format` for `SampledImage`, with the emulation's component mapping; storage: -//! the `StorageImageChoice`'s view format; `R64_UINT` for a `ulong` slot with -//! `UlongAtomicView`, an alias of the `MUTABLE_FORMAT` image's `RG32_UINT` texels), a -//! texel-buffer view format, or the runtime sampler slot, whose `VkSampler` instantiation makes +//! the `StorageImageChoice`'s view format), a texel-buffer view format, or the runtime sampler slot, whose `VkSampler` instantiation makes //! from the bound descriptor for the binding's use. //! - **Unbound, or bound but incompatible** with the declared type (another texture type, sample //! count, or numeric type, a texture buffer for an image, a color texture under a depth @@ -1089,9 +1086,6 @@ impl ResourcePlanner<'_> { ty, vk::DescriptorType::STORAGE_IMAGE | vk::DescriptorType::STORAGE_TEXEL_BUFFER ); - // A slot a `ulong` atomic updates is declared `R64ui`: its texture is viewed as - // `R64_UINT`, whatever choice its format would otherwise make. - let ulong_atomic = storage && self.has_fact(RuntimeFact::UlongAtomicView { slot }); let base = declared(&t, ty, cube_as_array, false, StorageFormatClass::Unknown)?; let compat = shape.filter(|s| compatible(s, &t, &base)); // A texture whose writes Metal drops (a 4:2:2 texture, and a YCbCr one; @@ -1144,7 +1138,7 @@ impl ResourcePlanner<'_> { } else { StorageUse::texture(t.access.read, t.access.write) }; - let accessed = storage && (t.access.read || t.access.write) && !ulong_atomic; + let accessed = storage && (t.access.read || t.access.write); let choice = match compat { Some( TextureShape::Texture { pixel_format, .. } @@ -1201,9 +1195,7 @@ impl ResourcePlanner<'_> { } } let class = ImageHandleClass { - format: if ulong_atomic { - StorageFormatClass::Format(vk::Format::R64_UINT) - } else if storage { + format: if storage { storage_class(variant.as_ref()) } else { StorageFormatClass::NotStorage @@ -1257,8 +1249,6 @@ impl ResourcePlanner<'_> { FormatUsage::UniformTexelBuffer }; let view = match choice { - // The `R64_UINT` view of a `ulong` slot's bytes. - _ if ulong_atomic => Some(vk::Format::R64_UINT), // The storage texel view reads the choice's view format (an alias of the // bound format's bytes, or an `A8Unorm` texture buffer's bytes as `R8_UNORM`, // Metal's alpha in red), which must itself support the usage. @@ -1340,8 +1330,7 @@ impl ResourcePlanner<'_> { // and plain Metal reads a swizzled texture's texels swizzled through a storage // binding and writes them with the swizzle undone: the function does both under // the variant, which takes the swizzle as the slot's `SpecKey::TextureSwizzle`, - // and the view takes none. A `ulong` atomic's slot reads and writes no texel, and - // keeps the consumer's refusal of the swizzled view. An extended-range texture's + // and the view takes none. An extended-range texture's // sampled view holds its raw codes, which a swizzle in the view's component mapping // would move before the function decodes them (a `One` reading the code 1, a border // texel unswizzled), where plain Metal swizzles the decoded texel, border texels @@ -1378,7 +1367,6 @@ impl ResourcePlanner<'_> { let queried = storage && !t.access.read && !t.access.write && !swizzle.is_default(); let view = if storage { let format = match choice { - _ if ulong_atomic => vk::Format::R64_UINT, Some(c) if c.alias.is_some() => c.vk_format, // The `R8_UNORM` image an `A8Unorm` texture holds its alpha in. Some(c) if c.class == StorageImageClass::AlphaInRed => c.vk_format, diff --git a/crates/metal2vulkan/src/cache/codec.rs b/crates/metal2vulkan/src/cache/codec.rs index 50c674a9f..68a6df323 100644 --- a/crates/metal2vulkan/src/cache/codec.rs +++ b/crates/metal2vulkan/src/cache/codec.rs @@ -1232,7 +1232,6 @@ codec_enum! { SparseTexture { slot, sparse_arm, tile_map }, AccelerationStructureInstanceCount { slot }, PredicationVote, SrgbTexture { slot }, - UlongAtomicView { slot }, ViewportCount, AliasedImageblock { data_size }, CallStackDepth { depth }, diff --git a/crates/metal2vulkan/src/cache/tests.rs b/crates/metal2vulkan/src/cache/tests.rs index 65fffba13..c95bc084a 100644 --- a/crates/metal2vulkan/src/cache/tests.rs +++ b/crates/metal2vulkan/src/cache/tests.rs @@ -400,58 +400,6 @@ fn the_anisotropic_sampler_fact_round_trips() { assert_eq!(decode::(&encode(&fact)), Ok(fact)); } -/// The fact format version 157 added encodes and decodes, and the artifact of a function whose -/// `ulong` slots a `ulong` atomic updates carries it through its bytes: a compiled function of the -/// owned fixture `unk_ulong_atomics` on a device with 64-bit image atomics, and its pipeline, -/// decode to themselves with the fact for the atomic slot and none for the slot only read and -/// written. -#[test] -fn the_ulong_atomic_view_fact_round_trips() { - use crate::pipeline::facts::RuntimeFact; - let slot = |index| SlotRef { - stage: Stage::Kernel, - class: SlotClass::Texture, - index, - }; - let fact = RuntimeFact::UlongAtomicView { slot: slot(5) }; - assert_eq!(decode::(&encode(&fact)), Ok(fact)); - let Some(bc) = fixture("unk_ulong_atomics") else { - return; - }; - let dev = device("amd-780m-radv"); - let f = Library::from_air(&bc) - .expect("library") - .function("unk_ulong_atomic_rw") - .expect("function"); - let compiled = dev - .compile_function( - &FunctionDescriptor::new(f), - &LoweringInputs::new(), - &Budget::standard(), - ) - .expect("compile"); - let facts = &compiled.artifact().facts; - assert!(facts.contains(&RuntimeFact::UlongAtomicView { slot: slot(0) })); - assert!(!facts.contains(&RuntimeFact::UlongAtomicView { slot: slot(1) })); - let bytes = compiled.to_bytes(); - let back = CompiledFunction::from_bytes(&bytes, &dev).expect("decode"); - assert_eq!(back.artifact(), compiled.artifact()); - assert_eq!(back.to_bytes(), bytes); - let pipe = dev - .compile_compute_pipeline( - &ComputePipelineDescriptor::new(StageSource::Compiled(compiled)), - &Budget::standard(), - ) - .expect("pipeline"); - let bytes = pipe.to_bytes(); - let back = ComputePipeline::from_bytes(&bytes, &dev).expect("decode"); - assert_eq!(back.to_bytes(), bytes); - assert!(back - .dependencies - .iter() - .any(|d| d.fact == RuntimeFact::UlongAtomicView { slot: slot(0) })); -} - /// The members format version 178 appends encode and decode, and each decodes as itself: /// `VkFeature::Maintenance5` and the three framebuffer `VkLimit`s. #[test] @@ -763,8 +711,8 @@ fn the_version_535_member_round_trips() { /// `SrgbTexture`, and `PrecisionNote::HalfTexelConversion`, /// `HalfSampleFilter`, `SrgbTexelDecode`, and `FloatSampleFilter`, /// `HandleClass::Sampler { compare, integer }` and -/// `SyntheticBinding::SamplerTable`, and `RuntimeFact::UlongAtomicView`, each beside the others -/// rather than only on its own side's fixtures. +/// `SyntheticBinding::SamplerTable`, each beside the others rather than only on its own side's +/// fixtures. #[test] fn the_merged_members_round_trip_in_one_render_pipeline() { use crate::pipeline::artifact::{PrecisionNote, RuntimeDependency, SpecConstant}; @@ -879,11 +827,6 @@ fn the_merged_members_round_trip_in_one_render_pipeline() { fact: RuntimeFact::SrgbTexture { slot: texture }, mechanism: Mechanism::Variant, }); - let ulong_view = RuntimeFact::UlongAtomicView { slot: texture }; - p.dependencies.push(RuntimeDependency { - fact: ulong_view, - mechanism: Mechanism::BinderView, - }); let bytes = encode(&p); let back = decode::(&bytes).expect("decoded"); assert_eq!(back, p); diff --git a/crates/metal2vulkan/src/device/check.rs b/crates/metal2vulkan/src/device/check.rs index 3d4b39ae2..ad76c9e20 100644 --- a/crates/metal2vulkan/src/device/check.rs +++ b/crates/metal2vulkan/src/device/check.rs @@ -129,36 +129,6 @@ impl DeviceProfile { .is_some_and(|usages| usages.contains(&usage)) } - /// What this profile lacks for a `ulong` texture slot that a `ulong` atomic updates (`buffer`: - /// a texture buffer), in a fixed order: the 64-bit image atomics (`shaderImageInt64Atomics`), - /// the 64-bit integers its `R64ui` texels are (`shaderInt64`), and the `R64_UINT` format's - /// storage-atomic feature for the slot's view (`STORAGE_IMAGE_ATOMIC`, a texture buffer's - /// `STORAGE_TEXEL_BUFFER_ATOMIC`). Empty where it has them all. The lowering refuses such a - /// slot naming these, the binder lists an `R64_UINT` storage neutral on the same condition, and - /// the runtime answers a `RG32Uint` texture's atomics by it. - pub fn ulong_atomic_gaps(&self, buffer: bool) -> Vec { - let leaf = &self.fields().leaf; - let mut gaps = Vec::new(); - if !leaf.image_int64_atomics { - gaps.push(Capability::Feature(VkFeature::ShaderImageInt64Atomics)); - } - if !leaf.int64 { - gaps.push(Capability::Feature(VkFeature::ShaderInt64)); - } - let usage = if buffer { - FormatUsage::StorageTexelBufferAtomic - } else { - FormatUsage::StorageImageAtomic - }; - if !self.supports_format(vk::Format::R64_UINT, usage) { - gaps.push(Capability::Format { - format: vk::Format::R64_UINT, - usage, - }); - } - gaps - } - /// A limit's value, in the unit [`Requirements::limits`] uses, and how requirements compare /// with it. Signed offset minima are reported as magnitudes (a requirement of 8 means /// "offsets down to -8"); float limits are reported rounded down to an integer. diff --git a/crates/metal2vulkan/src/device/derive.rs b/crates/metal2vulkan/src/device/derive.rs index a4eb4c53c..df6d32521 100644 --- a/crates/metal2vulkan/src/device/derive.rs +++ b/crates/metal2vulkan/src/device/derive.rs @@ -205,7 +205,6 @@ fn derive_fields(desc: &DeviceDescription, policy: &DevicePolicy) -> ProfileFiel storage_buffer_16bit: has(VkFeature::StorageBuffer16BitAccess), buffer_int64_atomics: has(VkFeature::ShaderBufferInt64Atomics), shared_int64_atomics: has(VkFeature::ShaderSharedInt64Atomics), - image_int64_atomics: has(VkFeature::ShaderImageInt64Atomics), vertex_stores_and_atomics: has(VkFeature::VertexPipelineStoresAndAtomics), fragment_stores_and_atomics: has(VkFeature::FragmentStoresAndAtomics), zero_initialize_workgroup_memory: has(VkFeature::ShaderZeroInitializeWorkgroupMemory), diff --git a/crates/metal2vulkan/src/device/enables.rs b/crates/metal2vulkan/src/device/enables.rs index 44f49d18d..fd6b1f989 100644 --- a/crates/metal2vulkan/src/device/enables.rs +++ b/crates/metal2vulkan/src/device/enables.rs @@ -336,7 +336,6 @@ fn facts(ext: VkExtension) -> ExtensionFacts { &[(E::KhrSynchronization2, Some(v(3)))]; match ext { E::ExtRobustness2 - | E::ExtShaderImageAtomicInt64 | E::ExtShaderStencilExport | E::ExtFragmentShaderInterlock | E::ExtRasterizationOrderAttachmentAccess @@ -401,6 +400,9 @@ fn facts(ext: VkExtension) -> ExtensionFacts { // Described, never enabled: the coverage after the depth and stencil tests is refused on // every device (`Feature::PostDepthCoverage`), so the core reads none of it. E::ExtPostDepthCoverage => fact(false, None, &[]), + // Described, never enabled: a `ulong` texture's atomics are refused on every device + // (`lower::texture::atomic`), so the core reads none of it. + E::ExtShaderImageAtomicInt64 => fact(false, None, &[]), // Described, never enabled: the core reads none of its properties. E::ExtSampleLocations => fact(false, None, &[]), E::KhrDynamicRendering => fact(false, Some(3), &[]), diff --git a/crates/metal2vulkan/src/device/mechanism.rs b/crates/metal2vulkan/src/device/mechanism.rs index 249e69204..809d0781f 100644 --- a/crates/metal2vulkan/src/device/mechanism.rs +++ b/crates/metal2vulkan/src/device/mechanism.rs @@ -29,8 +29,6 @@ pub fn mechanism(fact: &RuntimeFact, profile: &DeviceProfile) -> Mechanism { RuntimeFact::SamplerCoordinates { .. } => Mechanism::Specialization, RuntimeFact::SamplerReduction { .. } => Mechanism::PlanTimeCheck, RuntimeFact::ImageViewShape { .. } => Mechanism::BinderView, - // The binder views the slot's `RG32Uint` texture as `R64_UINT`. - RuntimeFact::UlongAtomicView { .. } => Mechanism::BinderView, RuntimeFact::VertexFetch { .. } => Mechanism::KeyProjection, RuntimeFact::VertexBufferStride { .. } => { if f.dynamic_vertex_stride { diff --git a/crates/metal2vulkan/src/device/profile.rs b/crates/metal2vulkan/src/device/profile.rs index 8b49642aa..bb7f0165c 100644 --- a/crates/metal2vulkan/src/device/profile.rs +++ b/crates/metal2vulkan/src/device/profile.rs @@ -504,7 +504,6 @@ pub struct LeafCaps { pub storage_buffer_16bit: bool, pub buffer_int64_atomics: bool, pub shared_int64_atomics: bool, - pub image_int64_atomics: bool, pub vertex_stores_and_atomics: bool, pub fragment_stores_and_atomics: bool, pub zero_initialize_workgroup_memory: bool, diff --git a/crates/metal2vulkan/src/device/tests/enables.rs b/crates/metal2vulkan/src/device/tests/enables.rs index 15bdf8d54..92397deb4 100644 --- a/crates/metal2vulkan/src/device/tests/enables.rs +++ b/crates/metal2vulkan/src/device/tests/enables.rs @@ -73,7 +73,7 @@ fn recommendations_are_closed_fixed_points_on_every_committed_profile() { // exposed features whose extensions' requirements are listed), except the buffer // update-after-bind features VUID 10247 forbids beside `robustBufferAccess`, and the // features of the extensions the core reads nothing of: `VK_EXT_depth_bias_control`, - // `VK_KHR_shader_fma` and `VK_EXT_shader_float8`. + // `VK_KHR_shader_fma`, `VK_EXT_shader_float8` and `VK_EXT_shader_image_atomic_int64`. let forbidden = |f: VkFeature| { !desc.robust_buffer_access_update_after_bind && desc.has(VkFeature::RobustBufferAccess) @@ -86,11 +86,13 @@ fn recommendations_are_closed_fixed_points_on_every_committed_profile() { VkFeature::ShaderFmaFloat16, VkFeature::ShaderFmaFloat32, VkFeature::ShaderFloat8, + VkFeature::ShaderImageInt64Atomics, ]; for e in [ VkExtension::ExtDepthBiasControl, VkExtension::KhrShaderFma, VkExtension::ExtShaderFloat8, + VkExtension::ExtShaderImageAtomicInt64, ] { assert!(!rec.extensions.contains(&e), "{stem}: {e:?}"); } diff --git a/crates/metal2vulkan/src/device/tests/mechanism.rs b/crates/metal2vulkan/src/device/tests/mechanism.rs index 1ecfe05d4..d502ad828 100644 --- a/crates/metal2vulkan/src/device/tests/mechanism.rs +++ b/crates/metal2vulkan/src/device/tests/mechanism.rs @@ -104,7 +104,6 @@ fn every_fact() -> Vec { RuntimeFact::AccelerationStructureInstanceCount { slot }, RuntimeFact::PredicationVote, RuntimeFact::SrgbTexture { slot }, - RuntimeFact::UlongAtomicView { slot }, RuntimeFact::ViewportCount, RuntimeFact::AliasedImageblock { data_size: 24 }, RuntimeFact::CallStackDepth { depth: 8 }, @@ -296,59 +295,58 @@ fn variant(f: &RuntimeFact) -> usize { RuntimeFact::PredicationVote => 39, RuntimeFact::HeapStorageReads { .. } => 40, RuntimeFact::SrgbTexture { .. } => 41, - RuntimeFact::UlongAtomicView { .. } => 42, - RuntimeFact::ViewportCount => 43, - RuntimeFact::AliasedImageblock { .. } => 44, - RuntimeFact::CallStackDepth { .. } => 45, - RuntimeFact::FlatGrid => 46, - RuntimeFact::SparseTextureWrites { .. } => 47, - RuntimeFact::TileThreadgroupMemory { .. } => 48, - RuntimeFact::TextureSwizzle { .. } => 49, - RuntimeFact::TileImageblock { .. } => 50, - RuntimeFact::AmplificationDraws { .. } => 51, - RuntimeFact::FoldedGroups => 53, - RuntimeFact::ZeroedColor { .. } => 56, - RuntimeFact::DroppedColor { .. } => 57, - RuntimeFact::DepthClampRange => 58, - RuntimeFact::ConstantLanes { .. } => 59, - RuntimeFact::FunctionTableRange { .. } => 60, - RuntimeFact::TileThreadgroup { .. } => 62, - RuntimeFact::ConstexprSampled { .. } => 63, - RuntimeFact::CubicSampler { .. } => 64, - RuntimeFact::CubicArgumentSampler { .. } => 65, - RuntimeFact::HeapRawSamples { .. } => 69, - RuntimeFact::ExtendedRangeInputBlend { .. } => 71, - RuntimeFact::CrossClassReads { .. } => 72, - RuntimeFact::StorageTextureWriteRounding { .. } => 73, - RuntimeFact::HeapWriteRounding { .. } => 74, - RuntimeFact::HeapCrossClassNeutral { .. } => 75, - RuntimeFact::AnisotropicSampler { .. } => 76, - RuntimeFact::StorageTextureIntegerChannels { .. } => 77, - RuntimeFact::ObjectThreadgroupArena { .. } => 80, - RuntimeFact::WordInputMerge { .. } => 82, - RuntimeFact::ReplayBindings => 83, - RuntimeFact::MergedDraws => 68, - RuntimeFact::QuadPrimitiveIds => 55, - RuntimeFact::RotatedWeights => 78, - RuntimeFact::PrivateList => 81, - RuntimeFact::YCbCrInPlace { .. } => 61, - RuntimeFact::PartialObjectThreadgroups => 84, - RuntimeFact::RotatedInputBlend { .. } => 85, - RuntimeFact::OpenClMode => 86, - RuntimeFact::RowLockstep => 87, - RuntimeFact::BorderTexels { .. } => 88, - RuntimeFact::HeapResidency { .. } => 89, - RuntimeFact::OneRow => 90, - RuntimeFact::RegionViewports => 91, - RuntimeFact::CallThreadgroups => 92, - RuntimeFact::PartialThreadgroups => 93, - RuntimeFact::TexelRows { .. } => 79, - RuntimeFact::UnitAxes { .. } => 54, - RuntimeFact::TexelBufferParts { .. } => 66, - RuntimeFact::OpenClLineTexture { .. } => 70, - RuntimeFact::AddressAlignment { .. } => 67, - RuntimeFact::GridTiles => 52, - RuntimeFact::PrivateArena { .. } => 94, + RuntimeFact::ViewportCount => 42, + RuntimeFact::AliasedImageblock { .. } => 43, + RuntimeFact::CallStackDepth { .. } => 44, + RuntimeFact::FlatGrid => 45, + RuntimeFact::SparseTextureWrites { .. } => 46, + RuntimeFact::TileThreadgroupMemory { .. } => 47, + RuntimeFact::TextureSwizzle { .. } => 48, + RuntimeFact::TileImageblock { .. } => 49, + RuntimeFact::AmplificationDraws { .. } => 50, + RuntimeFact::FoldedGroups => 52, + RuntimeFact::ZeroedColor { .. } => 55, + RuntimeFact::DroppedColor { .. } => 56, + RuntimeFact::DepthClampRange => 57, + RuntimeFact::ConstantLanes { .. } => 58, + RuntimeFact::FunctionTableRange { .. } => 59, + RuntimeFact::TileThreadgroup { .. } => 61, + RuntimeFact::ConstexprSampled { .. } => 62, + RuntimeFact::CubicSampler { .. } => 63, + RuntimeFact::CubicArgumentSampler { .. } => 64, + RuntimeFact::HeapRawSamples { .. } => 68, + RuntimeFact::ExtendedRangeInputBlend { .. } => 70, + RuntimeFact::CrossClassReads { .. } => 71, + RuntimeFact::StorageTextureWriteRounding { .. } => 72, + RuntimeFact::HeapWriteRounding { .. } => 73, + RuntimeFact::HeapCrossClassNeutral { .. } => 74, + RuntimeFact::AnisotropicSampler { .. } => 75, + RuntimeFact::StorageTextureIntegerChannels { .. } => 76, + RuntimeFact::ObjectThreadgroupArena { .. } => 79, + RuntimeFact::WordInputMerge { .. } => 81, + RuntimeFact::ReplayBindings => 82, + RuntimeFact::MergedDraws => 67, + RuntimeFact::QuadPrimitiveIds => 54, + RuntimeFact::RotatedWeights => 77, + RuntimeFact::PrivateList => 80, + RuntimeFact::YCbCrInPlace { .. } => 60, + RuntimeFact::PartialObjectThreadgroups => 83, + RuntimeFact::RotatedInputBlend { .. } => 84, + RuntimeFact::OpenClMode => 85, + RuntimeFact::RowLockstep => 86, + RuntimeFact::BorderTexels { .. } => 87, + RuntimeFact::HeapResidency { .. } => 88, + RuntimeFact::OneRow => 89, + RuntimeFact::RegionViewports => 90, + RuntimeFact::CallThreadgroups => 91, + RuntimeFact::PartialThreadgroups => 92, + RuntimeFact::TexelRows { .. } => 78, + RuntimeFact::UnitAxes { .. } => 53, + RuntimeFact::TexelBufferParts { .. } => 65, + RuntimeFact::OpenClLineTexture { .. } => 69, + RuntimeFact::AddressAlignment { .. } => 66, + RuntimeFact::GridTiles => 51, + RuntimeFact::PrivateArena { .. } => 93, } } @@ -356,7 +354,7 @@ fn variant(f: &RuntimeFact) -> usize { fn mechanism_is_total_over_every_fact_and_profile() { let facts = every_fact(); let covered: std::collections::BTreeSet = facts.iter().map(variant).collect(); - assert_eq!(covered, (0..95).collect(), "every_fact misses a variant"); + assert_eq!(covered, (0..94).collect(), "every_fact misses a variant"); for (stem, _) in super::committed_profiles() { let dev = device(&stem); let p = dev.profile(); @@ -445,8 +443,7 @@ fn mechanism_is_total_over_every_fact_and_profile() { | RuntimeFact::CubicSampler { .. } | RuntimeFact::AnisotropicSampler { .. } => Mechanism::Variant, RuntimeFact::ImageViewShape { .. } - | RuntimeFact::StorageTextureLevelViews { .. } - | RuntimeFact::UlongAtomicView { .. } => Mechanism::BinderView, + | RuntimeFact::StorageTextureLevelViews { .. } => Mechanism::BinderView, RuntimeFact::VertexFetch { .. } | RuntimeFact::TileAttachmentFormat { .. } => { Mechanism::KeyProjection } diff --git a/crates/metal2vulkan/src/lower/select.rs b/crates/metal2vulkan/src/lower/select.rs index 0e8f9c6ee..36f1405cf 100644 --- a/crates/metal2vulkan/src/lower/select.rs +++ b/crates/metal2vulkan/src/lower/select.rs @@ -1814,7 +1814,6 @@ fn identity_unsourced(f: &RuntimeFact) -> bool { | RuntimeFact::StorageTextureLevelViews { .. } | RuntimeFact::SparseTexture { .. } | RuntimeFact::SrgbTexture { .. } - | RuntimeFact::UlongAtomicView { .. } | RuntimeFact::OpenClLineTexture { .. } | RuntimeFact::SparseTextureWrites { .. } | RuntimeFact::TextureSwizzle { .. } diff --git a/crates/metal2vulkan/src/lower/texture/atomic.rs b/crates/metal2vulkan/src/lower/texture/atomic.rs index e51c804b7..ce6787658 100644 --- a/crates/metal2vulkan/src/lower/texture/atomic.rs +++ b/crates/metal2vulkan/src/lower/texture/atomic.rs @@ -28,11 +28,8 @@ //! **`ulong`**. Metal's `atomic_{min,max}` of a `ulong` texture compare the texel's unsigned 64-bit //! value, the low word in R and the high word in G of the `RG32Uint` texture Metal binds, with lane //! 0 of the operand, and return nothing (measured on Apple M3 Max, 4096 contending threads exact). -//! Each is `OpAtomicUMin` / `OpAtomicUMax` on the texel pointer of the slot declared `R64ui` -//! (`slot::atomic_format`), which the binder views as `R64_UINT` (`RuntimeFact::UlongAtomicView`): -//! the two words are one little-endian 64-bit integer. It needs `shaderImageInt64Atomics`, -//! `shaderInt64`, and the `R64_UINT` format's storage-atomic feature; a profile without them -//! refuses the slot (`Unsupported{ImageAtomics}`). No exact form exists there: a 64-bit +//! Each is refused on every device (`Unsupported{ImageAtomics}`, not implemented): its one exact +//! form is a 64-bit image atomic (`shaderImageInt64Atomics`), which no runtime enables. A 64-bit //! compare-and-update of an image texel is one atomic, which neither two 32-bit word atomics nor a //! lock (Vulkan promises no forward progress to a spinning invocation) can make, and an optimally //! tiled image has no memory a buffer atomic could reach. @@ -79,13 +76,10 @@ pub struct TexAtomic { pub expected: Option, /// The texel is signed (`OpAtomicS{Min,Max}` on an `R32i` image). pub signed: bool, - /// Metal's `ulong` `atomic_{min,max}`: a 64-bit atomic on the slot's `R64ui` image, with no - /// result. - pub ulong: bool, /// Leave a texel outside the image alone (no robustness discards the access). pub guard: bool, /// The result's lowered type: a texel, of which only lane 0 is observed, or a - /// compare-exchange's `bool`; `None` for a store and a `ulong` atomic. + /// compare-exchange's `bool`; `None` for a store. pub result: Option, /// A load an exit of a loop holding it depends on (`access::atomic::spin`): it acquires image /// memory. @@ -93,7 +87,7 @@ pub struct TexAtomic { } impl TexAtomic { - /// The census name: `texture.atomic_[_ulong][_guarded]`, the operation as MSL spells it. + /// The census name: `texture.atomic_[_guarded]`, the operation as MSL spells it. pub fn name(&self) -> String { let op = match self.op { AirOp::Add => "add", @@ -109,9 +103,8 @@ impl TexAtomic { AirOp::Store => "store", AirOp::CmpXchgWeak => "compare_exchange", }; - let wide = if self.ulong { "_ulong" } else { "" }; let guarded = if self.guard { "_guarded" } else { "" }; - format!("texture.atomic_{op}{wide}{guarded}") + format!("texture.atomic_{op}{guarded}") } /// The estimated words: the texel pointer, the atomic, the operand and result conversions, and @@ -139,12 +132,15 @@ pub(super) fn select( // A heap storage class is formatless; an atomic needs an `R32` one. return Err(Unsupported::not_implemented(Feature::ArgumentBufferTextures).into()); }; - // Metal's texture atomics take 32-bit integer texels, and a `ulong` texel's `min` and `max`. - let ulong = match texel.0.conv { - TexelConv::I32 => false, - TexelConv::U64Words { .. } if matches!(op, AirOp::Min | AirOp::Max) => true, + // Metal's texture atomics take 32-bit integer texels, and a `ulong` texel's `min` and `max`, + // which no form is built for (the module's docs). + match texel.0.conv { + TexelConv::I32 => {} + TexelConv::U64Words { .. } if matches!(op, AirOp::Min | AirOp::Max) => { + return Err(Unsupported::not_implemented(Feature::ImageAtomics).into()); + } _ => return Err(refuse()), - }; + } let signed = texel.1 == TexelClass::Sint; // The positions whose only established value is zero. let zero_offset = ops.get(TexRole::Offset).is_none_or(|v| is_zero(cx, v)); @@ -174,7 +170,7 @@ pub(super) fn select( }; let at_ = coord(cx, ops, shape)?; let guard = slot::write_guard(cx, shape.dim == ImageDim::Buffer); - let result = if op == AirOp::Store || ulong { + let result = if op == AirOp::Store { None } else { Some(cx.lowered_repr(Value::Inst(at), inst.ty)?) @@ -192,7 +188,6 @@ pub(super) fn select( value, expected, signed, - ulong, guard, result, spin, @@ -290,7 +285,7 @@ pub(super) fn emit( }; let op = a.op; let signed = a.signed; - // Whether the operation has a result: a `ulong` one, like a store, has none. + // Whether the operation has a result: a store has none. let returns = a.result.is_some(); // A volatile image's atomic under the Vulkan model is `Volatile`. A spin read acquires image // memory. diff --git a/crates/metal2vulkan/src/lower/texture/emit.rs b/crates/metal2vulkan/src/lower/texture/emit.rs index 3ec0cabf4..f9f2ca544 100644 --- a/crates/metal2vulkan/src/lower/texture/emit.rs +++ b/crates/metal2vulkan/src/lower/texture/emit.rs @@ -326,23 +326,6 @@ fn split_words(fb: &mut FunctionBuilder<'_>, v: SValue, wide: bool) -> BResult bool { - decl.texel == TexelClass::Uint64 && decl.format == crate::spv::ImageFormat::R64ui -} - -/// Metal's `ulong` texel `(R, 0, 0, 1)` of `R64` image texel `x`: the device's lanes past the -/// first, inside the image and outside it, are never read. -fn ulong_texel(fb: &mut FunctionBuilder<'_>, x: SValue) -> BResult { - let v = fb.composite_extract(x, &[0])?; - let u64_ = u64_ty(fb)?; - let zero = splat(fb, u64_, 1, 0)?; - let one = splat(fb, u64_, 1, 1)?; - let ty = vec(fb, u64_, 4)?; - fb.composite_construct(ty, &[v, zero, zero, one]) -} - /// A vector of `n` elements of `elem`, or `elem` itself for `n = 1`. fn vec(fb: &mut FunctionBuilder<'_>, elem: TypeId, n: u8) -> BResult { if n == 1 { @@ -1112,9 +1095,6 @@ fn from_image( form: TexelForm, x: SValue, ) -> BResult { - if r64(decl) { - return ulong_texel(fb, x); - } let x = match decl.class { StorageImageClass::Identity => x, StorageImageClass::SwizzleBgra => swizzle_bgra(fb, x)?, @@ -1498,8 +1478,6 @@ pub fn to_image( fb.binary(BinOp::ShiftRightArithmetic, s, sixteen)? } TexelConv::I16 { .. } => v, - // An `R64` image stores lane 0 of the held `ulong` texel as it is. - TexelConv::U64Words { .. } if r64(decl) => v, TexelConv::U64Words { wide } => split_words(fb, v, wide)?, }; let x = match decl.class { @@ -1967,8 +1945,7 @@ pub(super) fn out_of_bounds_texel( })?, 1, ), - // A `ulong` slot's image is `RG32` unsigned, or `R64` unsigned. - TexelClass::Uint64 if r64(decl) => (u64_ty(fb)?, 1), + // A `ulong` slot's image is `RG32` unsigned. TexelClass::Uint | TexelClass::Uint64 => (u32_ty(fb)?, 1), }; let ty = vec(fb, elem, 4)?; diff --git a/crates/metal2vulkan/src/lower/texture/slot.rs b/crates/metal2vulkan/src/lower/texture/slot.rs index 232065957..f2b7731a1 100644 --- a/crates/metal2vulkan/src/lower/texture/slot.rs +++ b/crates/metal2vulkan/src/lower/texture/slot.rs @@ -31,8 +31,7 @@ pub enum TexelClass { Sint, Uint, /// `ulong`: an `RG32Uint` texture, declared as an `RG32` unsigned image whose two words the - /// shader joins and splits, or, where a `ulong` atomic updates it, as the `R64ui` image the - /// binder views it as. + /// shader joins and splits. Uint64, } @@ -179,13 +178,7 @@ impl ImageDecl { width: 32, signed: true, })?, - // A `ulong` slot is an `RG32` unsigned image, or one of 64-bit texels. - TexelClass::Uint64 if self.format == crate::spv::ImageFormat::R64ui => { - mb.ty(SType::Int { - width: 64, - signed: false, - })? - } + // A `ulong` slot is an `RG32` unsigned image. TexelClass::Uint | TexelClass::Uint64 => mb.ty(SType::Int { width: 32, signed: false, @@ -977,12 +970,7 @@ fn ulong_format( /// storage-atomic feature (a texel buffer's storage-texel-buffer-atomic one). The slot's choice, /// when there is one, must be that format; without one, Metal's rule gives it (the binder's view of /// an `R32` texture, and the `R32` neutral of an unbound storage slot of that numeric type, have -/// it). -/// -/// A `ulong` slot is declared `R64ui`, which the binder views its `RG32Uint` texture as -/// (`RuntimeFact::UlongAtomicView`), where the profile has what that needs -/// (`DeviceProfile::ulong_atomic_gaps`); elsewhere it is `Unsupported{ImageAtomics}` naming every -/// missing capability, never an `RG32` declaration, which no image atomic takes. +/// it). A `ulong` texture's atomics are refused before (`atomic::select`). fn atomic_format( cx: &SelectCx<'_>, s: &SlotPlan, @@ -992,14 +980,7 @@ fn atomic_format( let (format, vk_format) = match texel { TexelClass::Uint => (crate::spv::ImageFormat::R32ui, vk::Format::R32_UINT), TexelClass::Sint => (crate::spv::ImageFormat::R32i, vk::Format::R32_SINT), - TexelClass::Uint64 => { - let gaps = cx.profile.ulong_atomic_gaps(buffer); - if !gaps.is_empty() { - return Err(Unsupported::needs_any_of(Feature::ImageAtomics, vec![gaps]).into()); - } - (crate::spv::ImageFormat::R64ui, vk::Format::R64_UINT) - } - TexelClass::Float => return Err(refuse()), + TexelClass::Uint64 | TexelClass::Float => return Err(refuse()), }; if let Some(choice) = cx.inputs.storage_images.get(&s.slot) { if choice.vk_format != vk_format || choice.class != StorageImageClass::Identity { @@ -1302,10 +1283,6 @@ fn declare_slot( .storage_images .get(&s.slot) .is_some_and(|c| c.x_channel); - if texel == TexelClass::Uint64 && format == crate::spv::ImageFormat::R64ui { - // The binder views the slot's `RG32Uint` texture as `R64_UINT`. - facts.push(RuntimeFact::UlongAtomicView { slot: s.slot }); - } if cube_as_array { facts.push(RuntimeFact::ImageViewShape { slot: s.slot }); } @@ -1771,8 +1748,8 @@ impl SlotPlan { /// buffer's is a texel buffer's, uniform where the slot reads and storage where it writes, the /// element its resource ID holds in the texel-buffer arrays. `None` for a declaration the identity /// arrays hold no element of yet: a cube viewed as an array, level views, a texture buffer's parts -/// or rows, planes, an extended-range or RGBX form, a `ulong` slot a `ulong` atomic updates (an -/// `R64ui` image), or a storage image with another format or a conversion. +/// or rows, planes, an extended-range or RGBX form, or a storage image with another format or a +/// conversion. pub(crate) fn identity_class(decl: &ImageDecl) -> Option { let plain = !decl.cube_as_array && decl.level_views.is_none() diff --git a/crates/metal2vulkan/src/metal/format/mod.rs b/crates/metal2vulkan/src/metal/format/mod.rs index d97226d7e..3a51bf6c2 100644 --- a/crates/metal2vulkan/src/metal/format/mod.rs +++ b/crates/metal2vulkan/src/metal/format/mod.rs @@ -2907,8 +2907,7 @@ pub(crate) fn spirv_image_format(format: vk::Format) -> Option Vec { @@ -2921,7 +2920,6 @@ pub(crate) fn queried_formats() -> Vec { .flatten() .map(|c| c.format) .chain(crate::metal::vertex::vertex_formats_queried()) - .chain([vk::Format::R64_UINT]) .collect(); set.into_iter().collect() } diff --git a/crates/metal2vulkan/src/metal/format/tests.rs b/crates/metal2vulkan/src/metal/format/tests.rs index 402e25427..a45d13182 100644 --- a/crates/metal2vulkan/src/metal/format/tests.rs +++ b/crates/metal2vulkan/src/metal/format/tests.rs @@ -1922,8 +1922,8 @@ fn queries_cover_candidates_and_neutrals() { assert!(c.iter().all(|c| set.contains(&c.format)), "{pf:?}"); } } - // The view of a `ulong` slot a `ulong` atomic updates, which no Metal format maps to. - assert!(set.contains(&vk::Format::R64_UINT)); + // No Metal format maps to `R64_UINT`, and nothing else queries it. + assert!(!set.contains(&vk::Format::R64_UINT)); } #[test] diff --git a/crates/metal2vulkan/src/pipeline/facts.rs b/crates/metal2vulkan/src/pipeline/facts.rs index 98be8ba3d..24070cc19 100644 --- a/crates/metal2vulkan/src/pipeline/facts.rs +++ b/crates/metal2vulkan/src/pipeline/facts.rs @@ -227,13 +227,6 @@ pub enum RuntimeFact { /// Bound in any other format, or unbound, the slot leaves the variant, and the function reads /// the device's decode through the texture's own view. SrgbTexture { slot: SlotRef }, - /// A `ulong` atomic (`atomic_{min,max}`) updates the `ulong` texture bound to the slot, so the - /// slot is declared as an `R64ui` storage image: the binder views the bound `RG32Uint` texture - /// as `R64_UINT`, each texel's low word in R and high word in G one little-endian 64-bit - /// integer. A texture is that view of an image the consumer created with `MUTABLE_FORMAT`, and - /// a texture buffer an `R64_UINT` texel view of its bytes; an unbound slot takes the `R64_UINT` - /// neutral. A `ulong` slot without the fact is an `RG32` image. - UlongAtomicView { slot: SlotRef }, /// The vertex function writes `[[viewport_array_index]]`, which selects a viewport only below /// the render encoder's viewport count (`setViewports:count:`): Metal draws a primitive whose /// index is at or past the count through viewport 0, so the function stores `ViewportIndex` @@ -767,7 +760,6 @@ impl RuntimeFact { } RuntimeFact::PredicationVote => "PredicationVote", RuntimeFact::SrgbTexture { .. } => "SrgbTexture", - RuntimeFact::UlongAtomicView { .. } => "UlongAtomicView", RuntimeFact::ViewportCount => "ViewportCount", RuntimeFact::AliasedImageblock { .. } => "AliasedImageblock", RuntimeFact::CallStackDepth { .. } => "CallStackDepth", diff --git a/crates/metal2vulkan/src/pipeline/interface.rs b/crates/metal2vulkan/src/pipeline/interface.rs index f6d63506b..06a5cf25d 100644 --- a/crates/metal2vulkan/src/pipeline/interface.rs +++ b/crates/metal2vulkan/src/pipeline/interface.rs @@ -143,7 +143,7 @@ pub struct TextureSlot { #[cfg_attr(feature = "serde", serde(default))] pub storage: bool, /// The slot's storage image is declared with a format: a slot a texture atomic updates - /// (`R32ui`, `R32i` or `R64ui`), or one declared in its bound texture's format. Its reads and + /// (`R32ui` or `R32i`), or one declared in its bound texture's format. Its reads and /// writes then take neither `VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT` nor /// `…_WRITE_WITHOUT_FORMAT_BIT` of the bound view's format, which Vulkan asks only of an access /// declared without one (`VUID-vkCmdDispatch-OpTypeImage-07027` to `-07030`). `false` for a diff --git a/crates/metal2vulkan/src/tests/engine_texture_atomic_unk.rs b/crates/metal2vulkan/src/tests/engine_texture_atomic_unk.rs index 1c7c4f2ee..b4e855e40 100644 --- a/crates/metal2vulkan/src/tests/engine_texture_atomic_unk.rs +++ b/crates/metal2vulkan/src/tests/engine_texture_atomic_unk.rs @@ -29,7 +29,7 @@ use std::sync::atomic::{AtomicU64, Ordering}; use crate::device::profile::DeviceProfile; use crate::device::requirements::VkFeature; use crate::device::{Device, DeviceDescription, DevicePolicy}; -use crate::error::{Error, Needs}; +use crate::error::{Error, Feature, Needs, Unsupported}; use crate::library::FunctionArtifact; use crate::pipeline::testing::{ compile, engine_dir, link_and_validate, llvm_assemble, AssembleError, @@ -128,7 +128,8 @@ fn profiles() -> Vec<(String, DeviceProfile)> { } /// The artifact of `entry` on `p`, linked and past L3; `None` when `p` lacks a capability it -/// needs (a typed device gap). Any other refusal fails the test. +/// needs (a typed device gap), and for a `ulong` texture's atomics, which every device refuses. +/// Any other refusal fails the test. fn artifact( bc: &[u8], entry: &str, @@ -141,6 +142,10 @@ fn artifact( Some(a) } Err(Error::Unsupported(u)) if matches!(u.needs, Needs::AnyOf(_)) => None, + // A `ulong` texture's atomics, on every device. + Err(Error::Unsupported(u)) if u == Unsupported::not_implemented(Feature::ImageAtomics) => { + None + } Err(e) => panic!("{stem}: {entry}: {e}"), } } @@ -481,8 +486,9 @@ fn legacy_atomics(text: &str) -> (String, usize, usize) { /// A 2D, 2D array or 3D texture atomic in the legacy form, without the offset position (the AIR /// macOS 26.6's Metal on x86-64 hands its device), compiles as the same atomic with a zero /// offset: the owned atomic fixtures (every operation, `uint` and `int`, 16-bit coordinates, -/// compare-exchange, store, `ulong` `min` and `max`) with every offset dropped compile on the same -/// profiles, with the same strategies and the same image atomics. Without the legacy form such a +/// compare-exchange, store, and `ulong` `min` and `max`, which every profile refuses) with every +/// offset dropped compile on the same profiles, with the same strategies and the same image +/// atomics. Without the legacy form such a /// declaration matches no layout of its name and is refused `UnknownIntrinsic`. #[test] fn legacy_texture_atomics_without_the_offset_compile_alike() { diff --git a/crates/metal2vulkan/src/tests/engine_texture_ulong.rs b/crates/metal2vulkan/src/tests/engine_texture_ulong.rs index 3dab5cb5f..3c2b17d79 100644 --- a/crates/metal2vulkan/src/tests/engine_texture_ulong.rs +++ b/crates/metal2vulkan/src/tests/engine_texture_ulong.rs @@ -20,34 +20,26 @@ //! storage format) refuses it with the typed device gap, which the tests accept and count. //! //! Metal's `ulong` `atomic_{min,max}` (the owned fixture `unk_ulong_atomics`) compare the texel's -//! unsigned 64-bit value and return nothing. A slot they update is declared `R64ui` and carries -//! `RuntimeFact::UlongAtomicView`, which the binder answers with an `R64_UINT` view of the -//! `RG32Uint` texture (a texel view for a texture buffer); a `ulong` slot only read or written in -//! the same function stays a plain `RG32` image. The CPU interpreter does not model image texel -//! pointers, so those tests check the emitted instructions, the facts, the device gaps (a profile -//! without `shaderImageInt64Atomics`, `shaderInt64`, or the `R64_UINT` storage-atomic format bit -//! refuses with exactly what it lacks, never an `RG32` declaration), and the plan. +//! unsigned 64-bit value and return nothing. Their one exact form is a 64-bit image atomic, which +//! no runtime enables, so they are refused on every profile (`Unsupported{ImageAtomics}`, not +//! implemented). //! //! `llvm-as` assembles the fixtures; without them the tests skip visibly. use std::collections::BTreeMap; -use crate::bind::{ - BindState, BoundBuffer, BoundTexture, NeutralResource, StageTable, TextureFacts, WriteSource, -}; +use crate::bind::{BindState, BoundBuffer, BoundTexture, StageTable, TextureFacts}; use crate::budget::Budget; use crate::device::profile::{DeviceProfile, Robustness}; -use crate::device::requirements::{FormatUsage, VkFeature}; +use crate::device::requirements::VkFeature; use crate::device::{Device, DeviceDescription, DevicePolicy}; -use crate::error::{Capability, Error, Feature, Needs}; +use crate::error::{Error, Feature, Needs, Unsupported}; use crate::library::Library; use crate::lower::select::Plan; use crate::metal::{PixelFormat, TextureType, TextureUsage}; -use crate::pipeline::facts::RuntimeFact; use crate::pipeline::interface::{PushLoc, SlotInterface}; -use crate::pipeline::layout::BindingSource; use crate::pipeline::sym::{ - Axis, PushField, ResourceKind, ResourceSlot, SampledType, SlotClass, SlotRef, SpecKey, Stage, + Axis, PushField, ResourceKind, ResourceSlot, SampledType, SlotClass, SpecKey, Stage, }; use crate::pipeline::testing::{ compile, engine_dir, link_and_validate, llvm_assemble, typed_module, AssembleError, @@ -61,18 +53,10 @@ use crate::spirv::testing::committed_profiles; use crate::vk; const OP_TYPE_INT: u16 = 21; -const OP_TYPE_VECTOR: u16 = 23; const OP_TYPE_IMAGE: u16 = 25; const OP_CAPABILITY: u16 = 17; -const OP_IMAGE_TEXEL_POINTER: u16 = 60; -const OP_IMAGE_READ: u16 = 98; -const OP_ATOMIC_U_MIN: u16 = 237; -const OP_ATOMIC_U_MAX: u16 = 239; const FORMAT_UNKNOWN: u32 = 0; const FORMAT_RG32UI: u32 = 35; -const FORMAT_R64UI: u32 = 40; -/// `Int64Atomics`. -const CAPABILITY_INT64_ATOMICS: u32 = 12; /// `Int64ImageEXT`. const CAPABILITY_INT64_IMAGE: u32 = 5016; @@ -498,255 +482,29 @@ fn ulong_slots_are_rg32_images_of_ulong_texels() { assert!(compiled > 0); } -/// What `p` lacks for a `ulong` slot a `ulong` atomic updates (`buffer`: a texture buffer), in -/// the order the refusal names them: 64-bit image atomics, 64-bit integers, and the `R64_UINT` -/// storage-atomic format bit. -fn ulong_atomic_gaps(p: &DeviceProfile, buffer: bool) -> Vec { - let leaf = &p.fields().leaf; - let mut gaps = Vec::new(); - if !leaf.image_int64_atomics { - gaps.push(Capability::Feature(VkFeature::ShaderImageInt64Atomics)); - } - if !leaf.int64 { - gaps.push(Capability::Feature(VkFeature::ShaderInt64)); - } - let usage = if buffer { - FormatUsage::StorageTexelBufferAtomic - } else { - FormatUsage::StorageImageAtomic - }; - if !p.supports_format(vk::Format::R64_UINT, usage) { - gaps.push(Capability::Format { - format: vk::Format::R64_UINT, - usage, - }); - } - gaps -} - -fn tslot(index: u32) -> SlotRef { - SlotRef { - stage: Stage::Kernel, - class: SlotClass::Texture, - index, - } -} - -/// The result type of every instruction of `opcode` whose result type is word 1. -fn result_types(words: &[u32], opcode: u16) -> Vec { - insts(words) - .into_iter() - .filter(|(o, _)| *o == opcode) - .map(|(_, w)| w[1]) - .collect() -} - -/// `unk_ulong_atomics`: every `ulong` `atomic_max` and `atomic_min` (1D, 1D array, 2D at 16-bit -/// coordinates, 2D array, 3D, buffer) is one `OpAtomicUMax` / `OpAtomicUMin` of a 64-bit unsigned -/// integer on an `OpImageTexelPointer` of an `R64ui` image, whose slot carries -/// `UlongAtomicView`, and the module needs `Int64ImageEXT`, `Int64Atomics`, and -/// `shaderImageInt64Atomics`. A profile without what the slots need refuses with exactly what it -/// lacks, `Unsupported{ImageAtomics}`: MoltenVK among them, which has no 64-bit image atomics and -/// no `R64_UINT` atomic format. +/// `unk_ulong_atomics`: a `ulong` texture's `atomic_max` and `atomic_min` (1D, 1D array, 2D at +/// 16-bit coordinates, 2D array, 3D, buffer) are refused on every profile, +/// `Unsupported{ImageAtomics}` not implemented, as is `unk_ulong_atomic_rw`, which also reads and +/// writes another `ulong` slot, where no device gap of that slot comes first. #[test] -fn ulong_atomics_are_64_bit_unsigned_min_and_max_on_r64_images() { +fn ulong_atomics_are_refused_on_every_device() { let Some(bc) = fixture("unk_ulong_atomics") else { return; }; - let (mut compiled, mut refused) = (Vec::new(), Vec::new()); - for (stem, p) in profiles() { - // The first slot the plan declares is the 1D image; the texture buffer is the last. - let gaps = ulong_atomic_gaps(&p, false); - let buffer_gaps = ulong_atomic_gaps(&p, true); - let a = match compile(&bc, "unk_ulong_atomics", &p) { - Ok(a) => a, - Err(Error::Unsupported(u)) if u.feature == Feature::ImageAtomics => { - let want = if gaps.is_empty() { buffer_gaps } else { gaps }; - assert!(!want.is_empty(), "{stem}: refused {u:?}"); - assert_eq!(u.needs, Needs::AnyOf(vec![want]), "{stem}"); - refused.push(stem); - continue; + let refusal = Unsupported::not_implemented(Feature::ImageAtomics); + let profiles = profiles(); + let mut refused = 0; + for (stem, p) in &profiles { + for entry in ["unk_ulong_atomics", "unk_ulong_atomic_rw"] { + match compile(&bc, entry, p) { + Err(Error::Unsupported(u)) if u == refusal => refused += 1, + Err(Error::Unsupported(u)) + if entry == "unk_ulong_atomic_rw" && matches!(u.needs, Needs::AnyOf(_)) => {} + other => panic!("{stem}: {entry}: {:?}", other.map(|_| ())), } - Err(e) => panic!("{stem}: {e}"), - }; - assert!( - gaps.is_empty() && buffer_gaps.is_empty(), - "{stem}: compiled" - ); - link_and_validate(&a, &p).unwrap_or_else(|e| panic!("{stem}: L3: {e}")); - let words = &a.module.words; - let ints: BTreeMap = insts(words) - .into_iter() - .filter(|(o, _)| *o == OP_TYPE_INT) - .map(|(_, w)| (w[1], (w[2], w[3]))) - .collect(); - let images: Vec<&[u32]> = insts(words) - .into_iter() - .filter(|(o, _)| *o == OP_TYPE_IMAGE) - .map(|(_, w)| w) - .collect(); - assert_eq!(images.len(), 6, "{stem}: {images:?}"); - for w in &images { - assert_eq!(ints.get(&w[2]), Some(&(64, 0)), "{stem}: {w:?}"); - assert_eq!((w[7], w[8]), (2, FORMAT_R64UI), "{stem}: {w:?}"); - } - for op in [OP_ATOMIC_U_MAX, OP_ATOMIC_U_MIN] { - let tys = result_types(words, op); - assert_eq!(tys.len(), 6, "{stem}: opcode {op}"); - assert!( - tys.iter().all(|t| ints.get(t) == Some(&(64, 0))), - "{stem}: opcode {op}" - ); - } - assert_eq!( - result_types(words, OP_IMAGE_TEXEL_POINTER).len(), - 12, - "{stem}" - ); - let caps: Vec = insts(words) - .into_iter() - .filter(|(o, _)| *o == OP_CAPABILITY) - .map(|(_, w)| w[1]) - .collect(); - assert!(caps.contains(&CAPABILITY_INT64_IMAGE), "{stem}: {caps:?}"); - assert!(caps.contains(&CAPABILITY_INT64_ATOMICS), "{stem}: {caps:?}"); - assert!( - a.requirements - .features - .contains(&VkFeature::ShaderImageInt64Atomics), - "{stem}" - ); - for index in 0..6 { - assert!( - a.facts - .contains(&RuntimeFact::UlongAtomicView { slot: tslot(index) }), - "{stem}: slot {index}" - ); - } - compiled.push(stem); - } - assert!(!compiled.is_empty(), "refused everywhere: {refused:?}"); - assert!(refused.iter().any(|s| s == "moltenvk-m3"), "{refused:?}"); -} - -/// A device with 64-bit image atomics but without the `R64_UINT` format's storage-atomic bit (an -/// image's, or a texel buffer's) refuses the slot naming that bit alone: no guessed `RG32` -/// declaration stands in, since no image atomic takes one. -#[test] -fn a_device_lacking_only_the_r64_atomic_format_bit_refuses_typed() { - let Some(bc) = fixture("unk_ulong_atomics") else { - return; - }; - let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")) - .join("../metal2vulkan-validation/profiles/amd-780m-radv.json"); - let text = std::fs::read_to_string(path).expect("profile"); - for (usage, buffer) in [ - (FormatUsage::StorageImageAtomic, false), - (FormatUsage::StorageTexelBufferAtomic, true), - ] { - let mut desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - let props = desc - .formats - .formats - .get_mut(&vk::Format::R64_UINT) - .expect("R64_UINT"); - let flags = if buffer { - &mut props.buffer - } else { - &mut props.optimal_tiling - }; - let bit = if buffer { - vk::FormatFeatureFlags2::STORAGE_TEXEL_BUFFER_ATOMIC - } else { - vk::FormatFeatureFlags2::STORAGE_IMAGE_ATOMIC - }; - *flags = vk::FormatFeatureFlags2::from_raw(flags.as_raw() & !bit.as_raw()); - let p = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) - .expect("device") - .profile() - .clone(); - assert!(p.fields().leaf.image_int64_atomics && p.fields().leaf.int64); - match compile(&bc, "unk_ulong_atomics", &p) { - Err(Error::Unsupported(u)) => { - assert_eq!(u.feature, Feature::ImageAtomics, "{usage:?}"); - assert_eq!( - u.needs, - Needs::AnyOf(vec![vec![Capability::Format { - format: vk::Format::R64_UINT, - usage, - }]]), - "{usage:?}" - ); - } - other => panic!("{usage:?}: {:?}", other.map(|_| ())), } } -} - -/// `unk_ulong_atomic_rw`: the slot a `ulong` atomic updates is declared `R64ui`, carries -/// `UlongAtomicView`, and is read with a 64-bit `OpImageRead`; the slot the function only reads -/// and writes stays an `RG32` unsigned image (`Rg32ui`, or formatless) without the fact. On a -/// profile without 64-bit image atomics the function is refused for the atomic slot alone. -#[test] -fn only_the_atomic_ulong_slot_is_an_r64_image() { - let Some(bc) = fixture("unk_ulong_atomics") else { - return; - }; - let mut compiled = 0; - for (stem, p) in profiles() { - let a = match compile(&bc, "unk_ulong_atomic_rw", &p) { - Ok(a) => a, - Err(Error::Unsupported(u)) if u.feature == Feature::ImageAtomics => { - assert!(!ulong_atomic_gaps(&p, false).is_empty(), "{stem}"); - continue; - } - Err(Error::Unsupported(u)) if matches!(u.needs, Needs::AnyOf(_)) => continue, - Err(e) => panic!("{stem}: {e}"), - }; - link_and_validate(&a, &p).unwrap_or_else(|e| panic!("{stem}: L3: {e}")); - assert!( - a.facts - .contains(&RuntimeFact::UlongAtomicView { slot: tslot(0) }), - "{stem}" - ); - assert!( - !a.facts - .contains(&RuntimeFact::UlongAtomicView { slot: tslot(1) }), - "{stem}" - ); - let words = &a.module.words; - let ints: BTreeMap = insts(words) - .into_iter() - .filter(|(o, _)| *o == OP_TYPE_INT) - .map(|(_, w)| (w[1], (w[2], w[3]))) - .collect(); - let vectors: BTreeMap = insts(words) - .into_iter() - .filter(|(o, _)| *o == OP_TYPE_VECTOR) - .map(|(_, w)| (w[1], w[2])) - .collect(); - let mut images: Vec<(u32, u32)> = insts(words) - .into_iter() - .filter(|(o, _)| *o == OP_TYPE_IMAGE) - .map(|(_, w)| (ints[&w[2]].0, w[8])) - .collect(); - images.sort_unstable(); - let plain = if p.fields().images.storage_extended_formats { - FORMAT_RG32UI - } else { - FORMAT_UNKNOWN - }; - assert_eq!(images, vec![(32, plain), (64, FORMAT_R64UI)], "{stem}"); - // One read of each slot: a 64-bit texel from the `R64` image, a 32-bit one from `RG32`. - let mut reads: Vec = result_types(words, OP_IMAGE_READ) - .iter() - .map(|t| ints[&vectors[t]].0) - .collect(); - reads.sort_unstable(); - assert_eq!(reads, vec![32, 64], "{stem}"); - compiled += 1; - } - assert!(compiled > 0); + assert!(refused >= profiles.len(), "{refused}"); } fn device(stem: &str) -> Device { @@ -795,29 +553,6 @@ fn ulong_state(types: &[Option]) -> BindState { s } -/// The plan's write of texture slot `index` of `pipe`. -fn texture_write( - pipe: &ComputePipeline, - plan: &crate::bind::BindingPlan, - index: u32, -) -> WriteSource { - let (set, binding) = pipe - .layout - .sets - .iter() - .flat_map(|s| s.bindings.iter().map(move |b| (s.set, b))) - .find(|(_, b)| b.source == BindingSource::Texture(tslot(index))) - .map(|(set, b)| (set, b.binding)) - .expect("the texture binding"); - let writes: Vec<_> = plan - .descriptors - .iter() - .filter(|w| (w.set, w.binding) == (set, binding)) - .collect(); - assert_eq!(writes.len(), 1); - writes[0].source.clone() -} - /// A texture buffer made with a swizzle at a slot the function reads as `ulong` texels is refused /// (`Unsupported { feature: TextureSwizzle }`): the read applies no swizzle, and Metal's swizzled /// `ulong` texel is not measured. Unswizzled, it binds. @@ -859,84 +594,3 @@ fn a_swizzled_texture_buffer_read_as_ulong_is_refused() { other => panic!("{other:?}"), } } - -/// The binder answers `UlongAtomicView`: on a device with 64-bit image atomics the slot a `ulong` -/// atomic updates binds an `R64_UINT` view of its `RG32Uint` texture (an `R64_UINT` texel view -/// of a texture buffer's), and its neutral is an `R64_UINT` storage image, while the slot only -/// read and written binds its texture's own `RG32_UINT` view; no slot asks for a variant. -#[test] -fn the_binder_views_an_atomically_updated_ulong_texture_as_r64() { - let Some(bc) = fixture("unk_ulong_atomics") else { - return; - }; - let dev = device("amd-780m-radv"); - let rw = pipeline(&dev, &bc, "unk_ulong_atomic_rw"); - let plan = rw - .plan( - &dev, - &ulong_state(&[Some(TextureType::Type2D), Some(TextureType::Type2D)]).shape(), - ) - .expect("plan"); - assert!(plan.variant.is_empty(), "{:?}", plan.variant); - match texture_write(&rw, &plan, 0) { - WriteSource::Texture { view, .. } => assert_eq!(view.format, vk::Format::R64_UINT), - other => panic!("{other:?}"), - } - match texture_write(&rw, &plan, 1) { - WriteSource::Texture { view, .. } => assert_eq!(view.format, vk::Format::R32G32_UINT), - other => panic!("{other:?}"), - } - let unbound = rw - .plan(&dev, &ulong_state(&[None, None]).shape()) - .expect("plan"); - match texture_write(&rw, &unbound, 0) { - WriteSource::Neutral(n) => assert_eq!(n.format(), Some(vk::Format::R64_UINT)), - other => panic!("{other:?}"), - } - match texture_write(&rw, &unbound, 1) { - WriteSource::Neutral(n @ NeutralResource::Image { .. }) => { - assert_eq!(n.format(), Some(vk::Format::R32G32_UINT)) - } - other => panic!("{other:?}"), - } - let all = pipeline(&dev, &bc, "unk_ulong_atomics"); - let types = [ - TextureType::Type1D, - TextureType::Type1DArray, - TextureType::Type2D, - TextureType::Type2DArray, - TextureType::Type3D, - TextureType::TextureBuffer, - ]; - let mut t = ulong_state(&types[..5].iter().copied().map(Some).collect::>()); - t.stages - .get_mut(&Stage::Kernel) - .expect("kernel") - .textures - .insert( - 5, - BoundTexture::Buffer { - pixel_format: PixelFormat::RG32Uint, - offset: 0, - length: 256, - bytes_per_row: 256, - resource_id: None, - swizzle: crate::metal::TextureSwizzleChannels::DEFAULT, - parts: 1, - }, - ); - let plan = all.plan(&dev, &t.shape()).expect("plan"); - assert!(plan.variant.is_empty(), "{:?}", plan.variant); - for index in 0..5 { - match texture_write(&all, &plan, index) { - WriteSource::Texture { view, .. } => { - assert_eq!(view.format, vk::Format::R64_UINT, "slot {index}") - } - other => panic!("slot {index}: {other:?}"), - } - } - match texture_write(&all, &plan, 5) { - WriteSource::TexelBuffer { format, .. } => assert_eq!(format, vk::Format::R64_UINT), - other => panic!("{other:?}"), - } -} diff --git a/crates/metal2vulkan/tests/api_signatures.tsv b/crates/metal2vulkan/tests/api_signatures.tsv index 607b77350..cdeb70574 100644 --- a/crates/metal2vulkan/tests/api_signatures.tsv +++ b/crates/metal2vulkan/tests/api_signatures.tsv @@ -7094,7 +7094,6 @@ method metal2vulkan::device::DeviceProfile::specialized_entry pub fn specialized method metal2vulkan::device::DeviceProfile::spirv_validation pub fn spirv_validation(&self) -> SpirvValidation method metal2vulkan::device::DeviceProfile::subgroups pub fn subgroups(&self) -> &SubgroupModel method metal2vulkan::device::DeviceProfile::supports_format pub fn supports_format(&self, format: vk::Format, usage: FormatUsage) -> bool -method metal2vulkan::device::DeviceProfile::ulong_atomic_gaps pub fn ulong_atomic_gaps(&self, buffer: bool) -> Vec method metal2vulkan::device::DeviceProfile::union_requirements pub fn union_requirements(&self, a: &Requirements, b: &Requirements) -> Requirements method metal2vulkan::device::DeviceProfile::vertex_entry_inputs pub fn vertex_entry_inputs(&self, d: &EntryDescriptor<'_>, vertex: Option<&VertexDescriptor>, budget: &Budget) -> Result method metal2vulkan::device::EnableSet::new pub fn new() -> EnableSet @@ -11131,7 +11130,6 @@ variant metal2vulkan::pipeline::RuntimeFact::TileFunction TileFunction variant metal2vulkan::pipeline::RuntimeFact::TileImageblock TileImageblock { data_size: u32, alignment: u32 } variant metal2vulkan::pipeline::RuntimeFact::TileThreadgroup TileThreadgroup { tile_sized: bool } variant metal2vulkan::pipeline::RuntimeFact::TileThreadgroupMemory TileThreadgroupMemory { index: u32 } -variant metal2vulkan::pipeline::RuntimeFact::UlongAtomicView UlongAtomicView { slot: SlotRef } variant metal2vulkan::pipeline::RuntimeFact::UniformViewAliasing UniformViewAliasing { slot: SlotRef } variant metal2vulkan::pipeline::RuntimeFact::UniformViewRange UniformViewRange { slot: SlotRef, choice: UniformViewChoice } variant metal2vulkan::pipeline::RuntimeFact::UnitAxes UnitAxes { axes: u8, relief: u8 } diff --git a/docs/API.md b/docs/API.md index 234991e7d..4b0f4a4e2 100644 --- a/docs/API.md +++ b/docs/API.md @@ -1341,8 +1341,9 @@ ask too (`plan.dispatch_variant(&dispatch)`, or `BindError::NeedsVariant` from i Textures follow Metal's texel rules: sparse textures report residency where the device can, `Depth32Float` texels are the device's depth image's (a value it clamps or a denormal it flushes is -the device's, `PrecisionNote::DepthDenormals`), `ulong` textures and their atomics use -64-bit images where the device has them, and `half` and sRGB reads give Metal's values or record +the device's, `PrecisionNote::DepthDenormals`), a `ulong` texture is an `RG32` unsigned image +whose two words the function joins and splits (its atomics are refused, `ImageAtomics`), and +`half` and sRGB reads give Metal's values or record their bound (an sRGB texel is the device's own decode wherever the device samples its format, `srgb-texel-decode`). The rustdoc of `BindState`, `TextureFacts` and `BindingPlan` states each rule. A read's, sample's or diff --git a/docs/REFUSALS.md b/docs/REFUSALS.md index c76e513d2..575db8a32 100644 --- a/docs/REFUSALS.md +++ b/docs/REFUSALS.md @@ -40,7 +40,7 @@ Columns: | Kind | `metal-measured` | `metal-documented` | `metal-takes` | `device` | `ours` | `unknown` | `delegated` | `-` | |---|---|---|---|---|---|---|---|---| -| Translator and front-end refusals | 0 | 0 | 0 | 49 | 70 | 0 | 0 | 0 | +| Translator and front-end refusals | 0 | 0 | 0 | 48 | 71 | 0 | 0 | 0 | | Binder refusals at a device limit | 0 | 0 | 0 | 9 | 0 | 0 | 0 | 0 | | Translation caps | 0 | 0 | 0 | 0 | 14 | 0 | 0 | 0 | | Rate maps the compile layer does not compile | 0 | 0 | 0 | 0 | 5 | 0 | 0 | 0 | @@ -88,7 +88,7 @@ Columns: | `ZeroedThreadgroupMemory` | Threadgroup memory that reads zero until the program writes it, on `Device::from_queries`' profile | devices short of a Vulkan feature the site names | `device` | 1: `crates/metal2vulkan/src/lower/access/local.rs (zero_threadgroup)` | `rare`: threadgroup memory on a device without shaderZeroInitializeWorkgroupMemory, which Vulkan 1.3 requires | | `CoherentMemory` | `coherent(device)` accesses (Vulkan memory model) | devices short of a Vulkan feature the site names | `device` | 1: `crates/metal2vulkan/src/lower/sync/memory_model.rs (check)` | `rare`: coherent(device) accesses | | `Int64Atomics` | 64-bit atomics | devices short of a Vulkan feature the site names; devices without buffer device addresses (`addressed_needs`) | `device` | 2: `crates/metal2vulkan/src/lower/access/atomic.rs (select, 2 sites)` | `rare`: 64-bit atomics | -| `ImageAtomics` | Image atomics beyond 32-bit integers | devices without a capability the site computes (`gaps`) | `device` | 1: `crates/metal2vulkan/src/lower/texture/slot.rs (atomic_format)` | `rare`: texture atomics beyond 32-bit integers | +| `ImageAtomics` | Image atomics beyond 32-bit integers | every device (not implemented) | `ours` | 1: `crates/metal2vulkan/src/lower/texture/atomic.rs (select)` | `rare`: texture atomics beyond 32-bit integers | | `DescriptorCount` | Too many descriptors of one kind in a stage or pipeline | devices short of a device limit the site names; devices without VkLimit::MaxUniformBufferRange | `device` | 3: `crates/metal2vulkan/src/lower/access/mod.rs (accept_placement)`, `crates/metal2vulkan/src/lower/select.rs (finish)` (+1) | `app`: many textures or buffers in one stage on a smaller device | | `BufferRange` | A buffer window beyond the descriptor range limits | devices without buffer device addresses (`addressed_needs`); every device (no Vulkan mechanism) | `device` | 6: `crates/metal2vulkan/src/bind/graphics.rs (patch_binding, 3 sites)`, `crates/metal2vulkan/src/bind/instantiate.rs (bind_buffers)` (+2) | `app`: a buffer window past a device's descriptor range | | `Int64Arithmetic` | 64-bit integer arithmetic | devices without VkFeature::ShaderInt64 | `device` | 2: `crates/metal2vulkan/src/lower/arith/legal.rs (check_scalar)`, `crates/metal2vulkan/src/lower/select.rs (selector_form)` | `rare`: 64-bit integers on a device without shaderInt64 | @@ -421,7 +421,7 @@ Each refusal's sites, with the function that builds it. - `feature::ZeroedThreadgroupMemory`: `crates/metal2vulkan/src/lower/access/local.rs (zero_threadgroup)` - `feature::CoherentMemory`: `crates/metal2vulkan/src/lower/sync/memory_model.rs (check)` - `feature::Int64Atomics`: `crates/metal2vulkan/src/lower/access/atomic.rs (select, 2 sites)` -- `feature::ImageAtomics`: `crates/metal2vulkan/src/lower/texture/slot.rs (atomic_format)` +- `feature::ImageAtomics`: `crates/metal2vulkan/src/lower/texture/atomic.rs (select)` - `feature::DescriptorCount`: `crates/metal2vulkan/src/lower/access/mod.rs (accept_placement)`; `crates/metal2vulkan/src/lower/select.rs (finish)`; `crates/metal2vulkan/src/pipeline/link.rs (limit_error)` - `feature::BufferRange`: `crates/metal2vulkan/src/bind/graphics.rs (patch_binding, 3 sites)`; `crates/metal2vulkan/src/bind/instantiate.rs (bind_buffers)`; `crates/metal2vulkan/src/lower/access/function_table.rs (select)`; `crates/metal2vulkan/src/lower/access/mod.rs (place_slots)` - `feature::Int64Arithmetic`: `crates/metal2vulkan/src/lower/arith/legal.rs (check_scalar)`; `crates/metal2vulkan/src/lower/select.rs (selector_form)`