diff --git a/crates/metal2vulkan-runtime/src/command_buffer/mod.rs b/crates/metal2vulkan-runtime/src/command_buffer/mod.rs index 1c8ba455b..556b1805c 100644 --- a/crates/metal2vulkan-runtime/src/command_buffer/mod.rs +++ b/crates/metal2vulkan-runtime/src/command_buffer/mod.rs @@ -2105,8 +2105,8 @@ impl CommandBuffer { /// /// Called once the command buffer is committed and before it completed, it does nothing, as /// Metal's (measured before and after the command buffer was scheduled). Refused once it - /// completed (`Invalid`, `Problem::ScheduledSignalAfterCompletion`), where Metal's process - /// ends; while an encoder is open (Metal asserts), after an abandoned encoder, and for another + /// completed or failed (`Invalid`, `Problem::ScheduledSignalAfterCompletion`), where Metal's + /// process ends; while an encoder is open (Metal asserts), after an abandoned encoder, and for another /// device's event, as [`encode_signal_event`](Self::encode_signal_event) is. Metal ends the /// process for an `MTLEvent`, which this call does not take. pub fn encode_signal_event_scheduled( @@ -2124,7 +2124,12 @@ impl CommandBuffer { let mut state = self.state(); match state.refusal() { None => state.scheduled_signals.push((Arc::clone(event), value)), - Some(Problem::AlreadyCommitted) if state.status == CommandBufferStatus::Completed => { + Some(Problem::AlreadyCommitted) + if matches!( + state.status, + CommandBufferStatus::Completed | CommandBufferStatus::Error + ) => + { return Err(invalid(CALL, Problem::ScheduledSignalAfterCompletion)) } Some(Problem::AlreadyCommitted) => {} diff --git a/crates/metal2vulkan-runtime/src/degradation.rs b/crates/metal2vulkan-runtime/src/degradation.rs index f4ae79a50..9777ee875 100644 --- a/crates/metal2vulkan-runtime/src/degradation.rs +++ b/crates/metal2vulkan-runtime/src/degradation.rs @@ -1403,8 +1403,9 @@ degradations! { /// resolved buffer) that was rebound (`rebind_bytes_no_copy`) after the command was /// encoded and before the command buffer was first submitted /// (`CommandBufferError::EncodedUseRebound`, `command_buffer/first_submission.rs`), in an - /// encoder the rebind could not encode again (a command predication's command buffer; a - /// render pass a host step records, or whose end captured its draws' tile reach; work + /// encoder the rebind could not encode again (a command predication's compute encoder + /// that shares its unit of predication with other encoders, holds a loop or leaves work + /// out; a render pass a host step records, or whose end captured its draws' tile reach; work /// recorded on the GPU alone that no longer runs there; a call that answers otherwise than /// at its encoding; `replay.rs`). Its reason names where the first such submission found /// the use (the encoder, and its own commands or work it left for later) and why no rebind @@ -1484,8 +1485,8 @@ degradations! { /// A render pass over a rasterization-rate map that was reset /// (`RasterizationRateMap::reset_using_descriptor`) after the pass took it and before /// its command buffer was submitted, in an encoder the runtime could not encode again - /// (it kept no log: a command predication's command buffer, a render encoder opened - /// while a buffer of the device was detached, or one that left work for a host step; + /// (it kept no log: a render encoder opened while a buffer of the device was detached, + /// or one that left work for a host step; /// `rate_mapped_pass.rs`). The pass draws by the map as it took it, where Metal's GPU /// reads the map as it runs the pass (the M3 Max under macOS 27.0.1). Announced at the /// commit, or at the reset where the command buffer was committed. diff --git a/crates/metal2vulkan-runtime/src/error.rs b/crates/metal2vulkan-runtime/src/error.rs index 9f626fbfd..484245d1b 100644 --- a/crates/metal2vulkan-runtime/src/error.rs +++ b/crates/metal2vulkan-runtime/src/error.rs @@ -509,7 +509,7 @@ pub enum Problem { /// committed command buffer", and a new encoder's `_status < /// MTLCommandBufferStatusCommitted`). AlreadyCommitted, - /// A scheduled signal encoded once the command buffer completed + /// A scheduled signal encoded once the command buffer completed, or failed (status `Error`) /// (`CommandBuffer::encode_signal_event_scheduled`): Metal's process ends there (a /// segmentation fault, as the consumer measured; in 10 of 15 runs on an M3 Max under macOS /// 27.0.1, the others setting nothing). Encoded after the commit and before the completion, diff --git a/crates/metal2vulkan-validation/runtime-sources.sha256 b/crates/metal2vulkan-validation/runtime-sources.sha256 index cc44388ef..ff021324c 100644 --- a/crates/metal2vulkan-validation/runtime-sources.sha256 +++ b/crates/metal2vulkan-validation/runtime-sources.sha256 @@ -1 +1 @@ -a3b8c15082102613a2b3ee8f34a2d3bfc31e56373dfc6344c9df59292d834c84 +5094e8542e6a5b764a2c08086852291aa1d35e730ae9db319827575abb30c343 diff --git a/crates/metal2vulkan-validation/src/runtime_lane/events.rs b/crates/metal2vulkan-validation/src/runtime_lane/events.rs index 5f41b662d..e7bb18e7f 100644 --- a/crates/metal2vulkan-validation/src/runtime_lane/events.rs +++ b/crates/metal2vulkan-validation/src/runtime_lane/events.rs @@ -17,9 +17,9 @@ use crate::gpu::TEST_DEVICE; use metal2vulkan::metal::{PixelFormat, TextureUsage}; use metal2vulkan_runtime::{ host_time, BlitCommandEncoder, BlitOption, Buffer, CommandBuffer, CommandBufferStatus, - CommandQueue, CpuCacheMode, Device, Error, EventRef, HazardTrackingMode, Invalid, Origin, - Problem, ResourceOptions, RuntimeGap, SharedEvent, SharedEventListener, Size, StorageMode, - Texture, TextureDescriptor, + CommandQueue, CommitFailure, CpuCacheMode, Device, Error, EventRef, HazardTrackingMode, + Invalid, Origin, Problem, ResourceOptions, RuntimeGap, SharedEvent, SharedEventListener, Size, + StorageMode, Texture, TextureDescriptor, }; use std::sync::mpsc; use std::sync::{Arc, Mutex}; @@ -935,6 +935,19 @@ fn a_scheduled_signal_sets_its_value_as_the_command_buffer_is_scheduled() { )) ); assert_eq!(later.signaled_value(), 3); + // As once it failed (status `Error`): Metal's process ends there too. + let failed = first.command_buffer().unwrap(); + failed.commit_failed(CommitFailure::new(8)).unwrap(); + failed.wait_until_completed_for(WAIT).unwrap(); + assert_eq!(failed.status(), CommandBufferStatus::Error); + assert_eq!( + failed.encode_signal_event_scheduled(&later, 9), + Err(invalid( + "encode_signal_event_scheduled", + Problem::ScheduledSignalAfterCompletion + )) + ); + assert_eq!(later.signaled_value(), 3); }); } diff --git a/crates/metal2vulkan/src/cache/mod.rs b/crates/metal2vulkan/src/cache/mod.rs index d89c256b5..6f5224762 100644 --- a/crates/metal2vulkan/src/cache/mod.rs +++ b/crates/metal2vulkan/src/cache/mod.rs @@ -93,7 +93,7 @@ pub const ARTIFACT_FORMAT_VERSION: u32 = 446; /// 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 = 1518; +pub const RUNTIME_VERSION: u32 = 1519; /// 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/docs/REFUSALS.md b/docs/REFUSALS.md index 73370870d..c80effea5 100644 --- a/docs/REFUSALS.md +++ b/docs/REFUSALS.md @@ -14,7 +14,7 @@ Columns: - `none`: no public API path: malformed or non-Metal input, Apple-private calls, or a cap no valid program of ordinary size meets; - `?`: not assessed yet. -Generated at `c2b39a526`. +Generated at `a484b368e`. ## Totals @@ -135,7 +135,7 @@ Generated at `c2b39a526`. | `TextureSwizzle` | A texture swizzle whose Metal behavior is not measured | devices short of a Vulkan feature the site names; every device (not implemented) | 7: `crates/metal2vulkan-runtime/src/binding_view.rs:167`, `crates/metal2vulkan-runtime/src/texture.rs:999` (+5) | `app`: texture swizzles whose Metal behaviour is unmeasured | | `MipmapGeneration` | `generateMipmapsForTexture:` where the device's filter is not shown to give Metal's answer | devices without VkFeature::ShaderInt64; devices without a format's usage; every device (not implemented) | 7: `crates/metal2vulkan-runtime/src/blit_texture.rs:1890`, `crates/metal2vulkan-runtime/src/mipmap_pick.rs:37` (+5) | `app`: generateMipmapsForTexture: where the device's filter is not Metal's | | `HostMemory` | A buffer over the caller's host memory without a copy (`newBufferWithBytesNoCopy:`) | devices without VkExtension::ExtExternalMemoryHost; every device (no Vulkan mechanism); every device (not implemented) | 5: `crates/metal2vulkan-runtime/src/host_memory.rs:430`, `crates/metal2vulkan-runtime/src/host_memory.rs:470` (+3) | `system`: newBufferWithBytesNoCopy: where the device cannot import the memory | -| `GpuTimes` | A command buffer's GPU times (`GPUStartTime`, `GPUEndTime`) on a device whose queue family writes no timestamps (`timestampValidBits` 0) | every device (no Vulkan mechanism) | 1: `crates/metal2vulkan-runtime/src/command_buffer/mod.rs:2930` | `rare`: GPU times on a queue without timestamps | +| `GpuTimes` | A command buffer's GPU times (`GPUStartTime`, `GPUEndTime`) on a device whose queue family writes no timestamps (`timestampValidBits` 0) | every device (no Vulkan mechanism) | 1: `crates/metal2vulkan-runtime/src/command_buffer/mod.rs:2935` | `rare`: GPU times on a queue without timestamps | | `CountingVisibility` | A `Counting` visibility result (`MTLVisibilityResultModeCounting`) on a device without `occlusionQueryPrecise` | devices without VkFeature::OcclusionQueryPrecise | 1: `crates/metal2vulkan-runtime/src/visibility.rs:452` | `rare`: counting occlusion queries on a device without precise queries | | `ViewFormatReinterpretation` | A texture view whose format has other components, or components of other widths, than its texture's (`RGBA8Unorm` as `R32Uint`), on a device whose... | every device (no Vulkan mechanism) | 1: `crates/metal2vulkan-runtime/src/view_plan.rs:573` | `app`: a view of another component layout on a portability subset (MoltenVK) | | `SeparateMultisampledDepthStencil` | A render pass whose depth and stencil attachments are separate multisampled textures that it loads or may store, on a device without maintenance8,... | - | via a helper: 7: `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:188`, `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:294` (+5) | `rare`: separate multisampled depth and stencil textures | @@ -232,7 +232,7 @@ Generated at `c2b39a526`. | Variant | What it blocks | Where | Sites | Reach | |---|---|---|---|---| -| `ProtectedContent` | Protection options whose answer on Metal is not measured (`command_buffer/protection.rs`) | every device (Apple-private, Metal's answer not measured) | 3: `crates/metal2vulkan-runtime/src/command_buffer/mod.rs:2461`, `crates/metal2vulkan-runtime/src/command_buffer/protection.rs:126` (+1) | `none`: Apple-private (no public header) | +| `ProtectedContent` | Protection options whose answer on Metal is not measured (`command_buffer/protection.rs`) | every device (Apple-private, Metal's answer not measured) | 3: `crates/metal2vulkan-runtime/src/command_buffer/mod.rs:2466`, `crates/metal2vulkan-runtime/src/command_buffer/protection.rs:126` (+1) | `none`: Apple-private (no public header) | | `LineWidth` | A line width other than 1 (`setLineWidth:`) | every device (Apple-private, Metal's answer not measured) | 1: `crates/metal2vulkan-runtime/src/apple_only.rs:190` | `none`: Apple-private (no public header) | | `ViewportTransformDisabled` | The viewport transform turned off (`setViewportTransformEnabled:NO`) | every device (Apple-private, Metal's answer not measured) | 1: `crates/metal2vulkan-runtime/src/apple_only.rs:192` | `none`: Apple-private (no public header) | | `VertexAmplificationMode` | `setVertexAmplificationMode:value:` of a count (the value's set bits in mode 1, else the value) of 0, whose copies change from run to run on... | every device (Apple-private, Metal's answer not measured) | 2: `crates/metal2vulkan-runtime/src/apple_only.rs:196`, `crates/metal2vulkan-runtime/src/apple_only.rs:321` | `none`: Apple-private (no public header) | @@ -394,7 +394,7 @@ Each refusal's sites, with the function that builds it. - `feature::TextureSwizzle`: `crates/metal2vulkan-runtime/src/binding_view.rs:167 (binding_view)`; `crates/metal2vulkan-runtime/src/texture.rs:999 (may_view)`; `crates/metal2vulkan/src/bind/plan/resources.rs:1102 (plain_texture)`; `crates/metal2vulkan/src/lower/sampler/select.rs:2587 (select_one)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3415 (select_read_as)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3762 (select_write)`; `crates/metal2vulkan/src/lower/texture/slice.rs:307 (select)` - `feature::MipmapGeneration`: `crates/metal2vulkan-runtime/src/blit_texture.rs:1890 (mipmaps)`; `crates/metal2vulkan-runtime/src/mipmap_pick.rs:37 (pick_mipmaps)`; `crates/metal2vulkan-runtime/src/mipmap_plan.rs:262 (plan_mipmaps)`; `crates/metal2vulkan-runtime/src/mipmap_plan.rs:270 (plan_mipmaps)`; `crates/metal2vulkan-runtime/src/mipmap_plan.rs:275 (plan_mipmaps)`; `crates/metal2vulkan-runtime/src/mipmap_plan.rs:304 (plan_mipmaps)`; `crates/metal2vulkan/src/bind/mipmap_filter.rs:973 (mipmap_filter_module)` - `feature::HostMemory`: `crates/metal2vulkan-runtime/src/host_memory.rs:430 (not_importable)`; `crates/metal2vulkan-runtime/src/host_memory.rs:470 (refuse_unwritable)`; `crates/metal2vulkan-runtime/src/host_memory.rs:689 (new)`; `crates/metal2vulkan-runtime/src/host_memory.rs:694 (new)`; `crates/metal2vulkan-runtime/src/host_memory.rs:712 (new)` -- `feature::GpuTimes`: `crates/metal2vulkan-runtime/src/command_buffer/mod.rs:2930 (gpu_times)` +- `feature::GpuTimes`: `crates/metal2vulkan-runtime/src/command_buffer/mod.rs:2935 (gpu_times)` - `feature::CountingVisibility`: `crates/metal2vulkan-runtime/src/visibility.rs:452 (check_mode)` - `feature::ViewFormatReinterpretation`: `crates/metal2vulkan-runtime/src/view_plan.rs:573 (reinterpretation_refused)` - `feature::SeparateMultisampledDepthStencil`: `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:188 (sampled_candidate)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:294 (by_draws)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:336 (scratch)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:376 (scratch)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:777 (plan)`; `crates/metal2vulkan-runtime/src/nan_clear.rs:658 (nan_write)`; `crates/metal2vulkan-runtime/src/texture/signed_depth.rs:191 (sample_strip)` @@ -481,7 +481,7 @@ Each refusal's sites, with the function that builds it. - `gap::MultisampledBufferCopy`: `crates/metal2vulkan-runtime/src/blit_texture.rs:536 (copy_from_buffer_to_texture)`; `crates/metal2vulkan-runtime/src/blit_texture.rs:693 (copy_from_texture_to_buffer)` - `gap::MultisampledBufferLayout`: `crates/metal2vulkan-runtime/src/sample_interleave.rs:1029 (plan)` - `gap::ColorAttachmentGroups`: `crates/metal2vulkan-runtime/src/render/color_groups.rs:106 (gap)` -- `apple::ProtectedContent`: `crates/metal2vulkan-runtime/src/command_buffer/mod.rs:2461 (commit_now)`; `crates/metal2vulkan-runtime/src/command_buffer/protection.rs:126 (refuse_protected_state_encoder)`; `crates/metal2vulkan-runtime/src/command_buffer/protection.rs:52 (set)` +- `apple::ProtectedContent`: `crates/metal2vulkan-runtime/src/command_buffer/mod.rs:2466 (commit_now)`; `crates/metal2vulkan-runtime/src/command_buffer/protection.rs:126 (refuse_protected_state_encoder)`; `crates/metal2vulkan-runtime/src/command_buffer/protection.rs:52 (set)` - `apple::LineWidth`: `crates/metal2vulkan-runtime/src/apple_only.rs:190 (check)` - `apple::ViewportTransformDisabled`: `crates/metal2vulkan-runtime/src/apple_only.rs:192 (check)` - `apple::VertexAmplificationMode`: `crates/metal2vulkan-runtime/src/apple_only.rs:196 (check)`; `crates/metal2vulkan-runtime/src/apple_only.rs:321 (set_vertex_amplification_mode)`