From 6812e2991c7cefb9c2139549dd494c95ebf79334 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Thu, 19 Nov 2026 15:01:38 -0800 Subject: [PATCH] rt: no device enables VK_EXT_zero_initialize_device_memory; the runtime writes every zero Under RADV (Mesa 26.2.6) an RX 7900 XTX's memory allocated with VK_MEMORY_ALLOCATE_ZERO_INITIALIZE_BIT_EXT read earlier processes' bytes, so the form's zeros are not the zeros Metal's newBufferWithLength:options: and a new texture owe. Metal says a new buffer is zeroed; the runtime now writes those zeros itself on every device, with no per-device exception and no start check. The extension leaves the optional list; its feature, the allocation flag and the zero-initialized image layout go, with Capabilities::zero_initialize_memory, Features::zero_initialize and ZeroInitializeDeviceMemoryFeatures. BlockInfo::zeroed and the zeroed-take and zeroed-texture metrics lose their source and go. A placed texture is cleared in its upload on every device (texture_clears); the harness zeroes every buffer through new_buffer's zero_from; the player's judged zeroed-texture metrics are the clears alone. The rt README records why the extension is unused. Verified: see the check job named in the landing. --- crates/metal2vulkan-harness/src/rt.rs | 17 +- crates/metal2vulkan-rt/README.md | 56 ++--- crates/metal2vulkan-rt/src/counters.rs | 47 +--- crates/metal2vulkan-rt/src/device.rs | 17 -- crates/metal2vulkan-rt/src/floor.rs | 93 +------- crates/metal2vulkan-rt/src/memory.rs | 73 +------ crates/metal2vulkan-rt/src/places.rs | 20 +- crates/metal2vulkan-rt/src/tests/draw.rs | 4 +- crates/metal2vulkan-rt/src/tests/floor.rs | 14 +- crates/metal2vulkan-rt/src/tests/memory.rs | 201 +----------------- crates/metal2vulkan-rt/src/tests/texture.rs | 35 +-- crates/metal2vulkan-rt/src/texture.rs | 67 ++---- .../src/replay/new_runtime/judged.rs | 17 +- .../src/replay/new_runtime/mod.rs | 2 - .../src/replay/tests.rs | 10 +- crates/metal2vulkan/tests/api_signatures.tsv | 17 +- docs/REPLAY-STREAM.md | 6 +- 17 files changed, 87 insertions(+), 609 deletions(-) diff --git a/crates/metal2vulkan-harness/src/rt.rs b/crates/metal2vulkan-harness/src/rt.rs index fa5a36937..b5ae3c7a4 100644 --- a/crates/metal2vulkan-harness/src/rt.rs +++ b/crates/metal2vulkan-harness/src/rt.rs @@ -7,9 +7,8 @@ //! allocator takes chunks of that length, and a block of its own for a buffer longer than that. A dropped buffer frees its range at once, or releases its dedicated block: the //! harness drops a buffer only once the work that used it has completed, as Metal frees a //! buffer's memory only then. So a buffer made after one of the same length was dropped takes -//! the same range, which the runtime zeroes as `newBufferWithLength:options:` does. A buffer in a -//! block of its own takes the consumer's one path: zeroed by the runtime unless the take answered -//! `BlockInfo::zeroed`, the driver's zeros, which nothing wrote before the buffer is made. +//! the same range, which the runtime zeroes as `newBufferWithLength:options:` does, as it zeroes a +//! buffer in a block of its own. //! //! A `Managed` buffer is the runtime's (`Device::new_managed_buffer`) over a range of a Shared //! block: its `contents` are the CPU's bytes, which the harness writes and names with @@ -369,9 +368,8 @@ impl crate::Device for Device { self.name.clone() } - /// Placed as the module's docs say, and zeroed by the runtime unless a block of its own - /// answered `BlockInfo::zeroed`; a `Managed` buffer's bytes zeroed by the harness, and its - /// device copy, where it has one, by the runtime. + /// Placed as the module's docs say, and zeroed by the runtime; a `Managed` buffer's bytes + /// zeroed by the harness, and its device copy, where it has one, by the runtime. fn new_buffer(&self, length: u64, storage: Storage) -> Result { let class = match storage { Storage::Shared | Storage::Managed => rt::MemoryClass::Shared, @@ -395,17 +393,12 @@ impl crate::Device for Device { _ => None, }; let (block, start) = placed.at(); - // A block of its own, taken for this buffer, holds the driver's zeros where it answered so. - let zero_from = match &placed { - Placed::Dedicated(block) if block.zeroed => None, - _ => Some(0), - }; let made = match storage { Storage::Managed => { self.new_managed_buffer((block, start), copy.as_ref().map(Placed::at), length) } Storage::Shared | Storage::Private => { - self.device.new_buffer(block, start, length, zero_from) + self.device.new_buffer(block, start, length, Some(0)) } }; match made { diff --git a/crates/metal2vulkan-rt/README.md b/crates/metal2vulkan-rt/README.md index 23e49aad4..5fbee39b2 100644 --- a/crates/metal2vulkan-rt/README.md +++ b/crates/metal2vulkan-rt/README.md @@ -238,29 +238,12 @@ in its memory. driver is called; `Gauges::blocks` counts those live. The limit is about 4.29 billion on RADV, NVIDIA's Linux driver and ANV, 8,401,685 on Intel's Windows driver for the UHD Graphics 630, and 4,096, Vulkan's minimum, on Mesa's Mac driver. -- A block's bytes are undefined, new or taken again, except where a take answers - `BlockInfo::zeroed` (below): the runtime zeroes nothing ahead of need. A buffer reads zero where +- A block's bytes are undefined, new or taken again: the runtime zeroes nothing ahead of need, and + asks the driver for no zeroed memory. A buffer reads zero where `Device::new_buffer` zeroes its range (below), as Metal zeroes a buffer from `newBufferWithLength:options:`, and Metal owes zeros for that call's buffers alone: not for a heap's memory, whose bytes are undefined, as Metal is silent on them. The consumer passes `zero_from` for a buffer Metal zeroes, or zeroes the range at its own carve, once. -- Where the device lists `VK_EXT_zero_initialize_device_memory` and reports - `zeroInitializeDeviceMemory` (`floor::Capabilities::zero_initialize_memory`), every allocation of - the pool, of either class, is made with `VK_MEMORY_ALLOCATE_ZERO_INITIALIZE_BIT_EXT` and reads - zero until written, by the driver's promise; imports never carry the flag - (`VUID-VkMemoryAllocateFlagsInfo-flags-10760`). A take then answers `BlockInfo::zeroed`: true - only where no block of the allocation ever held a byte at or past the block's first byte (each - allocation keeps the end of the furthest range a block held; the runtime writes the pool's bytes - only through blocks), so every byte reads zero as the block is handed out; false for a range - below that end (a range given back and taken again among them), on a device without the - feature, and for an imported or exported block. Nothing of the runtime touches those bytes, on - any thread, and a driver whose allocation call is lazy (RADV's and ANV's are) leaves their pages - unmade until the first write. `Metrics::zeroed_takes` and `zeroed_take_bytes` count those - blocks. It is a fact at the take: what the consumer or its guest writes through the mapping - afterwards is the consumer's to know, and a consumer skips its own zeroing only for bytes it has - not exposed for writing since the take. The runtime zeroes what it is asked to on every device - (`Device::new_buffer`'s `zero_from`, `Device::zero_block_range`, a Managed buffer's device - copy), so the consumer's path is one: zero unless `zeroed`. - A texture the runtime places reads zero until written: `Device::new_texture`'s, `new_texture_for_views`'s and `new_managed_texture`'s. The upload of the next submission clears every subresource of its image once, ahead of every command buffer committed after the @@ -269,13 +252,8 @@ in its memory. Metal does not say what a new texture holds (`newTextureWithDescriptor:` is "Allocate a new texture with privately owned storage."). The runtime chose zero because programs read textures they never wrote, an Apple M3 Max answered zero for new Shared and Managed textures, - and the memory's last bytes would follow process history. `Metrics::texture_clears` and - `texture_clear_bytes` count the clears. Where the device has the zeroed allocations above, a - texture whose memory reads the driver's zeros, which no resource used (a place in a texture - block past every place the block held, or memory of its own, made zeroed), is made in - `VK_IMAGE_LAYOUT_ZERO_INITIALIZED_EXT` and its move home from that layout, over every - subresource, is its zeroing, with no clear ("the image data is interpreted to be zeroed"); - `Metrics::zeroed_textures` and `zeroed_texture_bytes` count those. A texture in a heap's + and the memory's last bytes would follow process history. The clear runs on every device. + `Metrics::texture_clears` and `texture_clear_bytes` count the clears. A texture in a heap's memory, over a buffer, of a surface's plane, or a drawable's is not cleared: it reads its memory's bytes, or the swapchain's. A view reads its parent's image. - `Device::zero_block_range(block, offset, length)` zeroes a range of a Private block the @@ -404,9 +382,7 @@ A consumer that maps the pool's memory itself, into a guest for instance, passes The pool's allocations are in the guest's range whole, their free ranges and the runtime's own staging blocks included; the consumer hands the guest blocks only. A block given back stays mapped with its allocation: from a block's give-back to the next take that lands on its bytes, they are -the runtime's. A guest kernel that writes a free range damages only its own later buffers: among -them, where the driver zeroes allocations, a block of a range no block held before, which still -answers `BlockInfo::zeroed`. +the runtime's. A guest kernel that writes a free range damages only its own later buffers. ### Imported blocks @@ -863,14 +839,13 @@ planes' first use, so `Surface::wait_until_ready()` returns at once. memory where the card has no other device-local type, and the kernels that read a Managed buffer's device copy placed there read it across the host link: `Gauges::managed_spilled_bytes` counts those buffers' bytes while they live. -- A device without `VK_EXT_zero_initialize_device_memory` and its feature answers - `BlockInfo::zeroed` false for every block, so a new buffer's zeros are the runtime's: a Shared - buffer's are written through the mapping inside `Device::new_buffer`, which pulls the first - touch of every page into the call, where Metal pays it at the program's first write. On the - Iris Xe (Mesa's ANV, which lists no such extension) a new Shared buffer of 144 MiB takes 24 to 34 - ms to make, almost all of it that zeroing: the driver's `vkAllocateMemory` of it takes 0.01 ms. - The extension is listed by RADV, NVIDIA's Linux driver and lavapipe, and not by ANV, Mesa's Mac - driver or Intel's Windows driver for the UHD Graphics 630. +- A new buffer's zeros are the runtime's on every device: a Shared buffer's are written through + the mapping inside `Device::new_buffer`, which pulls the first touch of every page into the + call, where Metal pays it at the program's first write. On the Iris Xe a new Shared buffer of + 144 MiB takes 24 to 34 ms to make, almost all of it that zeroing: the driver's + `vkAllocateMemory` of it takes 0.01 ms. The runtime does not use + `VK_EXT_zero_initialize_device_memory`: under RADV (Mesa 26.2.6) an RX 7900 XTX's memory + allocated with its flag read other processes' bytes. ## Set 1 and index grants @@ -2815,7 +2790,6 @@ Presenting runs on the runtime's own device; nothing is exported or imported. | `VK_KHR_external_memory_win32` | device, where listed | exporting a block as an NT handle (`Device::new_exported_block`) | | `VK_EXT_queue_family_foreign` | device, where listed | the foreign queue family that a dma-buf export's ownership transfers name | | `VK_EXT_image_drm_format_modifier` | device, where listed | a dma-buf surface's planes in place, as `DRM_FORMAT_MOD_LINEAR` images (`Device::new_exported_surface`) | -| `VK_EXT_zero_initialize_device_memory` | device, where listed | the pool's allocations made zeroed by the driver, through the optional feature below | ### Features @@ -2990,9 +2964,8 @@ apart from 1.8 to 3% Private, so the host link's rate above is not on their path ### Chosen by a query -Six features choose between two forms by the device's answer: 16-bit floats, storage-image reads -without a format, 64-bit atomics, 64-bit floats, SIMD groups and zeroed allocations (the pool's -allocations made zeroed by the driver, which a take answers as `BlockInfo::zeroed`). Beside them, a device without the +Five features choose between two forms by the device's answer: 16-bit floats, storage-image reads +without a format, 64-bit atomics, 64-bit floats and SIMD groups. Beside them, a device without the attachment feedback loop reads attachments through a copy, the one form left there, which is a known gap (Known gaps of render encoders). `floor::Capabilities` holds each answer the floor reads, and the features and extensions to enable: the floor's, and each optional one the device @@ -3013,7 +2986,6 @@ The other five are one feature each: | `shaderFloat64` | `VkPhysicalDeviceFeatures` | 64-bit floats | | `shaderMaximalReconvergence` | `VkPhysicalDeviceShaderMaximalReconvergenceFeaturesKHR` | SIMD groups that reconverge as Metal's do | | `shaderSubgroupUniformControlFlow` | `VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR` | SIMD groups' reconvergence where maximal reconvergence is not offered | -| `zeroInitializeDeviceMemory` | `VkPhysicalDeviceZeroInitializeDeviceMemoryFeaturesEXT` | the pool's allocations made with `VK_MEMORY_ALLOCATE_ZERO_INITIALIZE_BIT_EXT`, where the device also lists `VK_EXT_zero_initialize_device_memory`: a take of a range no block held before answers `BlockInfo::zeroed` (Memory blocks and buffers); elsewhere every take answers false | `sparseBinding` (`VkPhysicalDeviceFeatures`) chooses no form: device creation enables it only where the device offers imports over several dma-bufs (`Device::import_dma_bufs`, Imported diff --git a/crates/metal2vulkan-rt/src/counters.rs b/crates/metal2vulkan-rt/src/counters.rs index db99dacde..42777e9e7 100644 --- a/crates/metal2vulkan-rt/src/counters.rs +++ b/crates/metal2vulkan-rt/src/counters.rs @@ -263,14 +263,10 @@ struct Atomics { bytes_copied: AtomicU64, bytes_zeroed: AtomicU64, takes_from_free_ranges: AtomicU64, - zeroed_takes: AtomicU64, - zeroed_take_bytes: AtomicU64, block_zero_fills: AtomicU64, block_zero_fill_bytes: AtomicU64, texture_clears: AtomicU64, texture_clear_bytes: AtomicU64, - zeroed_textures: AtomicU64, - zeroed_texture_bytes: AtomicU64, texture_clear_barriers: AtomicU64, cache_bytes_written: AtomicU64, pipelines_created: AtomicU64, @@ -654,13 +650,6 @@ impl Counters { self.atomics.takes_from_free_ranges.fetch_add(1, Relaxed); } - /// A block of `bytes` handed out that reads zero as taken ([`Metrics::zeroed_takes`]). - pub(crate) fn zeroed_take(&self, bytes: u64) { - let a = &self.atomics; - a.zeroed_takes.fetch_add(1, Relaxed); - a.zeroed_take_bytes.fetch_add(bytes, Relaxed); - } - /// A zero fill of `bytes` the consumer asked of a Private block /// ([`Metrics::block_zero_fills`]). pub(crate) fn zero_filled(&self, bytes: u64) { @@ -677,14 +666,6 @@ impl Counters { a.texture_clear_bytes.fetch_add(bytes, Relaxed); } - /// A new texture's image of `bytes` of memory that read the driver's zeros, moved home from the - /// zero-initialized layout with no clear ([`Metrics::zeroed_textures`]). - pub(crate) fn texture_zeroed(&self, bytes: u64) { - let a = &self.atomics; - a.zeroed_textures.fetch_add(1, Relaxed); - a.zeroed_texture_bytes.fetch_add(bytes, Relaxed); - } - /// `bytes` more of Managed buffers' bytes a commit's copy-in copies /// ([`Metrics::managed_bytes_captured`]). pub(crate) fn captured(&self, bytes: u64) { @@ -827,14 +808,10 @@ impl Counters { bytes_copied: a.bytes_copied.load(Relaxed), bytes_zeroed: a.bytes_zeroed.load(Relaxed), takes_from_free_ranges: a.takes_from_free_ranges.load(Relaxed), - zeroed_takes: a.zeroed_takes.load(Relaxed), - zeroed_take_bytes: a.zeroed_take_bytes.load(Relaxed), block_zero_fills: a.block_zero_fills.load(Relaxed), block_zero_fill_bytes: a.block_zero_fill_bytes.load(Relaxed), texture_clears: a.texture_clears.load(Relaxed), texture_clear_bytes: a.texture_clear_bytes.load(Relaxed), - zeroed_textures: a.zeroed_textures.load(Relaxed), - zeroed_texture_bytes: a.zeroed_texture_bytes.load(Relaxed), texture_clear_barriers: a.texture_clear_barriers.load(Relaxed), pipelines_created: a.pipelines_created.load(Relaxed), first_use_waits: a.first_use_waits.load(Relaxed), @@ -1013,13 +990,6 @@ pub struct Metrics { /// allocation instead ([`consumer_allocations`](Self::consumer_allocations), /// [`allocations_mapped_on_takes`](Self::allocations_mapped_on_takes)). pub takes_from_free_ranges: u64, - /// Blocks the consumer took that answered - /// [`BlockInfo::zeroed`](crate::BlockInfo::zeroed): each byte read zero as handed out, the - /// driver having made the allocation zeroed and no block having held the range before. Zero - /// on a device without `zeroInitializeDeviceMemory`. - pub zeroed_takes: u64, - /// The bytes of those blocks. - pub zeroed_take_bytes: u64, /// Zero fills the consumer asked of Private blocks /// ([`Device::zero_block_range`](crate::Device::zero_block_range)). pub block_zero_fills: u64, @@ -1030,26 +1000,13 @@ pub struct Metrics { /// [`Device::new_texture_for_views`](crate::Device::new_texture_for_views) and /// [`Device::new_managed_texture`](crate::Device::new_managed_texture)): each image's one /// clear of every subresource, or its copies from the zero source where its format takes no - /// clear. The split between this form and the zero-initialized one - /// ([`zeroed_textures`](Self::zeroed_textures)) follows where the pool places a texture, and - /// may differ between two runs of one program. + /// clear, on every device. pub texture_clears: u64, /// The bytes of memory of those images. pub texture_clear_bytes: u64, - /// New textures that read zero until written with no clear: on a device of zeroed - /// allocations ([`Capabilities::zero_initialize_memory`](crate::floor::Capabilities::zero_initialize_memory)), - /// those whose memory read the driver's zeros, which no resource used (a place in a texture - /// block past every place it held before, or memory of its own), each made in the - /// zero-initialized layout and moved home from it. The split between this form and the clear - /// ([`texture_clears`](Self::texture_clears)) follows where the pool places a texture, and may - /// differ between two runs of one program. - pub zeroed_textures: u64, - /// The bytes of memory of those images. - pub zeroed_texture_bytes: u64, /// The barriers that move new textures' images home after their zeroing: one for each upload /// that zeroed any ([`texture_clears`](Self::texture_clears)), however many it zeroed, also - /// counted in [`barriers`](Self::barriers). It follows the clears, so it may differ between - /// two runs of one program as they do. + /// counted in [`barriers`](Self::barriers). pub texture_clear_barriers: u64, /// `VkPipeline`s created. pub pipelines_created: u64, diff --git a/crates/metal2vulkan-rt/src/device.rs b/crates/metal2vulkan-rt/src/device.rs index c5df11453..ebc706618 100644 --- a/crates/metal2vulkan-rt/src/device.rs +++ b/crates/metal2vulkan-rt/src/device.rs @@ -253,9 +253,6 @@ pub(crate) struct Core { /// requirements allow. pub(crate) device_local: u32, unified_memory: bool, - /// The pool's allocations are made with `VK_MEMORY_ALLOCATE_ZERO_INITIALIZE_BIT_EXT` and read - /// zero until written (`floor::Capabilities::zero_initialize_memory`). - pub(crate) zero_initialize: bool, pub(crate) counters: Counters, /// What the device's timestamps count. pub(crate) ticks: Ticks, @@ -503,7 +500,6 @@ impl Device { mut feedback_loop, mut feedback_loop_dynamic, mut divisor, - mut zero_initialize, } = enabled_features; // `sparseBinding` for imports over several dma-bufs (`Device::import_dma_bufs`), only where // the device's queries offer that import: it changes no other path, as only that import @@ -548,9 +544,6 @@ impl Device { { features = features.push_next(&mut divisor); } - if enabled(floor::ZERO_INITIALIZE_DEVICE_MEMORY) { - features = features.push_next(&mut zero_initialize); - } // SAFETY: as for the floor check. let listed = unsafe { vk_instance.enumerate_device_extension_properties(raw) } .map_err(Error::vulkan("vkEnumerateDeviceExtensionProperties"))?; @@ -686,7 +679,6 @@ impl Device { memory_types, device_local, unified_memory, - zero_initialize: capabilities.zero_initialize_memory, counters, ticks, calibrated, @@ -877,12 +869,6 @@ impl Device { /// A buffer reads zero where /// [`Device::new_buffer`] zeroes its range, as `newBufferWithLength:options:` does in Metal; /// Metal is silent on the bytes of a placement heap's memory and of a texture placed there. - /// Where the device enabled `zeroInitializeDeviceMemory` - /// ([`floor::Capabilities::zero_initialize_memory`]), every allocation of the pool is made - /// zeroed by the driver, and a block that no block of its allocation held any byte of before - /// reads zero as it is handed out: [`BlockInfo::zeroed`](crate::BlockInfo::zeroed) says so, - /// so the consumer may skip the zeroing it would ask for. The runtime still zeroes every - /// range it is asked to: it does not see what is written after the take. /// /// Err: [`Limit::BlockLen`](crate::Limit::BlockLen) past the device's largest allocation or /// buffer; [`Limit::BlockIds`](crate::Limit::BlockIds); @@ -897,9 +883,6 @@ impl Device { } let memory = core.take_memory(class, len, Site::Take)?; let info = memory.info(); - if info.zeroed { - core.counters.zeroed_take(info.len); - } let block = memory::Block::new(memory, Arc::clone(core)); Ok(Block::claim(core, info, block)) } diff --git a/crates/metal2vulkan-rt/src/floor.rs b/crates/metal2vulkan-rt/src/floor.rs index d97d38107..4b61a1d8c 100644 --- a/crates/metal2vulkan-rt/src/floor.rs +++ b/crates/metal2vulkan-rt/src/floor.rs @@ -9,7 +9,7 @@ use ash::vk; use metal2vulkan::device::{EnableSet, VkExtension, VkFeature}; -use std::ffi::{c_void, CStr, CString}; +use std::ffi::{CStr, CString}; use std::fmt; /// The Vulkan version the runtime requires of the instance and of every device. @@ -48,9 +48,7 @@ pub const TIME_DOMAINS: [vk::TimeDomainKHR; 2] = /// exports' ([`Device::new_exported_block`](crate::Device::new_exported_block)): the fd's and /// the dma-buf's again, an NT handle's, and the foreign queue family a dma-buf's ownership /// transfers name, and the DRM format modifier, through which a dma-buf's surface lies in place -/// ([`Device::new_exported_surface`](crate::Device::new_exported_surface)), and -/// `VK_EXT_zero_initialize_device_memory`, for the pool's allocations made zeroed by the driver -/// ([`Capabilities::zero_initialize_memory`]). +/// ([`Device::new_exported_surface`](crate::Device::new_exported_surface)). pub const OPTIONAL_EXTENSIONS: &[&CStr] = &[ ash::khr::shader_maximal_reconvergence::NAME, ash::khr::shader_subgroup_uniform_control_flow::NAME, @@ -63,74 +61,8 @@ pub const OPTIONAL_EXTENSIONS: &[&CStr] = &[ ash::khr::external_memory_win32::NAME, ash::ext::queue_family_foreign::NAME, ash::ext::image_drm_format_modifier::NAME, - ZERO_INITIALIZE_DEVICE_MEMORY, ]; -/// `VK_EXT_zero_initialize_device_memory`'s name, which `ash 0.38` predates: where the device -/// lists it and reports its feature ([`Capabilities::zero_initialize_memory`]), the pool's -/// allocations are made with `VK_MEMORY_ALLOCATE_ZERO_INITIALIZE_BIT_EXT` and read zero until -/// written. -pub(crate) const ZERO_INITIALIZE_DEVICE_MEMORY: &CStr = c"VK_EXT_zero_initialize_device_memory"; - -/// `VK_MEMORY_ALLOCATE_ZERO_INITIALIZE_BIT_EXT`, which `ash 0.38` predates: the memory is zeroed -/// by the implementation before the application can access it. -pub(crate) const ZERO_INITIALIZE: vk::MemoryAllocateFlags = vk::MemoryAllocateFlags::from_raw(0x8); - -/// `VK_IMAGE_LAYOUT_ZERO_INITIALIZED_EXT`, which `ash 0.38` predates: an image's initial layout -/// whose first move away interprets its data as zeroed, which its memory must be -/// (`VUID-VkImageCreateInfo-initialLayout-10765`; a barrier from it names every subresource, -/// `VUID-VkImageMemoryBarrier2-oldLayout-10768`). -pub(crate) const ZERO_INITIALIZED: vk::ImageLayout = vk::ImageLayout::from_raw(1_000_620_000); - -/// `VkPhysicalDeviceZeroInitializeDeviceMemoryFeaturesEXT`, of -/// `VK_EXT_zero_initialize_device_memory`, which `ash 0.38` predates, laid out as the registry -/// defines it (extension number 621). -/// -/// No Metal counterpart: Metal zeroes a new buffer of `newBufferWithLength:options:` whatever the -/// device. Here the feature decides whether a block no block held before reads zero as it is -/// taken (`BlockInfo::zeroed`), so the consumer can leave those zeros to the driver. -#[repr(C)] -#[derive(Clone, Copy)] -pub struct ZeroInitializeDeviceMemoryFeatures { - s_type: vk::StructureType, - p_next: *mut c_void, - /// `zeroInitializeDeviceMemory`. - pub zero_initialize_device_memory: vk::Bool32, -} - -impl Default for ZeroInitializeDeviceMemoryFeatures { - fn default() -> Self { - ZeroInitializeDeviceMemoryFeatures { - s_type: ::STRUCTURE_TYPE, - p_next: std::ptr::null_mut(), - zero_initialize_device_memory: vk::FALSE, - } - } -} - -impl ZeroInitializeDeviceMemoryFeatures { - /// Unlinks it from the chain it was read through. - fn unlink(&mut self) { - self.p_next = std::ptr::null_mut(); - } -} - -// SAFETY: plain data, as ash's own feature structures, which are `Send`: the link is only read -// while the chain it heads is passed to a Vulkan call. -unsafe impl Send for ZeroInitializeDeviceMemoryFeatures {} -// SAFETY: as above. -unsafe impl Sync for ZeroInitializeDeviceMemoryFeatures {} -// SAFETY: the layout is the registry's `VkPhysicalDeviceZeroInitializeDeviceMemoryFeaturesEXT`, -// which begins with `sType` and `pNext` as every chained structure must, and this is its -// structure type (`VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ZERO_INITIALIZE_DEVICE_MEMORY_FEATURES_EXT`). -unsafe impl vk::TaggedStructure for ZeroInitializeDeviceMemoryFeatures { - const STRUCTURE_TYPE: vk::StructureType = vk::StructureType::from_raw(1_000_620_000); -} -// SAFETY: the registry lists `VkDeviceCreateInfo` in the structure's `structextends`. -unsafe impl vk::ExtendsDeviceCreateInfo for ZeroInitializeDeviceMemoryFeatures {} -// SAFETY: the registry lists `VkPhysicalDeviceFeatures2` in the structure's `structextends`. -unsafe impl vk::ExtendsPhysicalDeviceFeatures2 for ZeroInitializeDeviceMemoryFeatures {} - /// The device extensions of the attachment feedback loop (`VK_EXT_attachment_feedback_loop_layout` /// and its dynamic state), through which a draw reads, through a texture, an attachment its own /// pass renders (Metal's texture read of a render target): device creation enables both, with @@ -285,9 +217,6 @@ pub struct Features { /// and `VK_EXT_vertex_attribute_divisor` (the same structure): read and enabled only where the /// device lists one of them, and then only the step-rate feature. pub divisor: vk::PhysicalDeviceVertexAttributeDivisorFeaturesKHR<'static>, - /// `VkPhysicalDeviceZeroInitializeDeviceMemoryFeaturesEXT`, of - /// `VK_EXT_zero_initialize_device_memory`: read and enabled only where the device lists it. - pub zero_initialize: ZeroInitializeDeviceMemoryFeatures, } /// One feature: the Vulkan structure that reports it, its member as ash spells it, the member, and @@ -333,9 +262,6 @@ macro_rules! feature { (@structure divisor) => { "VkPhysicalDeviceVertexAttributeDivisorFeaturesKHR" }; - (@structure zero_initialize) => { - "VkPhysicalDeviceZeroInitializeDeviceMemoryFeaturesEXT" - }; (@translator) => { None }; @@ -489,8 +415,6 @@ pub(crate) const OPTIONAL: &[Feature] = &[ // control flow where it offers that. feature!(maximal_reconvergence.shader_maximal_reconvergence => ShaderMaximalReconvergence), feature!(subgroup_uniform_control_flow.shader_subgroup_uniform_control_flow => ShaderSubgroupUniformControlFlow), - // The pool's allocations made zeroed by the driver, where the device lists the extension. - feature!(zero_initialize.zero_initialize_device_memory), ]; /// The features of the attachment feedback loop ([`ATTACHMENT_READ_EXTENSIONS`]): enabled together @@ -687,12 +611,6 @@ pub struct Capabilities { /// Metal reads a render target. It reads through the attachment feedback loop where /// [`feedback_loop`](Self::feedback_loop) holds, and through a copy of the image otherwise. pub attachment_reads: bool, - /// The device lists `VK_EXT_zero_initialize_device_memory` and reports - /// `zeroInitializeDeviceMemory`: the pool's allocations are made zeroed by the driver - /// (`VK_MEMORY_ALLOCATE_ZERO_INITIALIZE_BIT_EXT`), and a take of a range no block held before - /// answers [`BlockInfo::zeroed`](crate::BlockInfo::zeroed). Elsewhere every take answers - /// false. - pub zero_initialize_memory: bool, /// The attachment reads hold, and so does every attachment-read feature, with /// [`ATTACHMENT_READ_EXTENSIONS`]: a draw reads an attachment through the attachment feedback /// loop. @@ -807,7 +725,6 @@ unsafe fn query( listed(ash::ext::attachment_feedback_loop_dynamic_state::NAME); let divisor_listed = listed(ash::khr::vertex_attribute_divisor::NAME) || listed(ash::ext::vertex_attribute_divisor::NAME); - let zero_initialize_listed = listed(ZERO_INITIALIZE_DEVICE_MEMORY); let Features { core, @@ -821,7 +738,6 @@ unsafe fn query( feedback_loop, feedback_loop_dynamic, divisor, - zero_initialize, } = &mut queried.features; let mut features = vk::PhysicalDeviceFeatures2::default() .push_next(&mut *vulkan11) @@ -848,9 +764,6 @@ unsafe fn query( if divisor_listed { features = features.push_next(&mut *divisor); } - if zero_initialize_listed { - features = features.push_next(&mut *zero_initialize); - } instance.get_physical_device_features2(physical, &mut features); *core = features.features; vulkan11.p_next = std::ptr::null_mut(); @@ -863,7 +776,6 @@ unsafe fn query( feedback_loop.p_next = std::ptr::null_mut(); feedback_loop_dynamic.p_next = std::ptr::null_mut(); divisor.p_next = std::ptr::null_mut(); - zero_initialize.unlink(); queried.families = instance.get_physical_device_queue_family_properties(physical); queried.memory = instance.get_physical_device_memory_properties(physical); @@ -976,7 +888,6 @@ pub(crate) fn decide(device: &Queried) -> Result { .shader_subgroup_uniform_control_flow == vk::TRUE, attachment_reads, - zero_initialize_memory: features.zero_initialize.zero_initialize_device_memory == vk::TRUE, feedback_loop, features, extensions: DEVICE_EXTENSIONS diff --git a/crates/metal2vulkan-rt/src/memory.rs b/crates/metal2vulkan-rt/src/memory.rs index 37c133575..1c3a4a4af 100644 --- a/crates/metal2vulkan-rt/src/memory.rs +++ b/crates/metal2vulkan-rt/src/memory.rs @@ -5,12 +5,6 @@ //! ([`Internal`]); and how memory is made and freed. A block's bytes are undefined: the runtime //! zeroes nothing ahead of need. A buffer reads zero where //! [`Device::new_buffer`](crate::Device::new_buffer) zeroes its range. -//! -//! Where the device enabled `zeroInitializeDeviceMemory`, every allocation of the pool is made -//! with `VK_MEMORY_ALLOCATE_ZERO_INITIALIZE_BIT_EXT`, which reads zero until written, and a take -//! answers whether its block's bytes all lie past every range a block of its allocation held -//! before ([`BlockInfo::zeroed`](crate::BlockInfo::zeroed)): then they read zero as handed out. -//! The runtime trusts nothing of it after the take, and zeroes every range it is asked to. use crate::counters::{Counters, Gauge, Metric, Site}; use crate::device::{lock, Core}; @@ -186,23 +180,6 @@ pub struct BlockInfo { /// block is where the device's Shared type is, and an imported one where the type imported /// into is. pub device_local: bool, - /// Whether every byte of it reads zero as the take hands it out: the device enabled - /// `zeroInitializeDeviceMemory` - /// ([`floor::Capabilities::zero_initialize_memory`](crate::floor::Capabilities::zero_initialize_memory)), - /// so the driver made its allocation zeroed, and no block of that allocation ever held a byte - /// at or past this block's first byte (the runtime writes the pool's bytes only through - /// blocks). False on a device without the feature, for a block below the furthest range a - /// block of its allocation held (one given back and taken again among them), and for an - /// imported or exported block. Counted in - /// [`Metrics::zeroed_takes`](crate::Metrics::zeroed_takes). - /// - /// Metal's counterpart is the zeros of a new buffer of `newBufferWithLength:options:`. It is a - /// fact at the take: what the consumer or its guest writes through the mapping afterwards is - /// the consumer's to know, and a consumer skips its own zeroing only for bytes it has not - /// exposed for writing since the take. The runtime zeroes every range it is asked to - /// ([`Device::new_buffer`](crate::Device::new_buffer)'s `zero_from`, - /// [`Device::zero_block_range`](crate::Device::zero_block_range)) on every device. - pub zeroed: bool, } // SAFETY: plain data. `contents` is an address; reading or writing through it is the consumer's @@ -293,8 +270,6 @@ pub(crate) struct Memory { /// An import's block ([`import`]) or an export's ([`export`]): an allocation of its own, /// which no pool holds and which is freed once the block is given back. pub(crate) own: Option, - /// Its bytes read zero as the take found them ([`BlockInfo::zeroed`]). - zeroed: bool, } /// What a block that is an allocation of its own is. @@ -372,7 +347,6 @@ impl Memory { gpu_address: self.address, contents: self.mapping.map(Mapping::get), device_local: self.device_local, - zeroed: self.zeroed, } } } @@ -506,11 +480,6 @@ struct Allocation { /// one it was made for, until it is idle again /// ([`Gauges::shared_long_reused_bytes`](crate::Gauges::shared_long_reused_bytes)). reused: bool, - /// Made with `VK_MEMORY_ALLOCATE_ZERO_INITIALIZE_BIT_EXT`: its bytes read zero until written. - zeroed: bool, - /// The end of the furthest range a block of it ever held: past it no block was, so where the - /// allocation is [`zeroed`](Self::zeroed) those bytes read zero. - taken_to: u64, } impl Allocation { @@ -679,8 +648,6 @@ struct Carve { mapping: Option, device_local: bool, spilled: bool, - /// The range reads zero as taken ([`BlockInfo::zeroed`]). - zeroed: bool, } impl Carve { @@ -699,7 +666,6 @@ impl Carve { device_local: self.device_local, spilled: self.spilled, own: None, - zeroed: self.zeroed, } } } @@ -1169,12 +1135,8 @@ impl State { } impl Allocation { - /// What a block of `len` bytes at `base`, a range taken from the free bytes, is. It reads zero - /// where the allocation is [`zeroed`](Self::zeroed) and it lies past every range a block held - /// before; from now on its bytes are held too. - fn carve(&mut self, base: u64, len: u64) -> Carve { - let zeroed = self.zeroed && base >= self.taken_to; - self.taken_to = self.taken_to.max(base + len); + /// What a block of `len` bytes at `base`, a range taken from the free bytes, is. + fn carve(&self, base: u64, len: u64) -> Carve { Carve { allocation: self.id, memory: self.memory, @@ -1187,7 +1149,6 @@ impl Allocation { .map(|mapping| Mapping(unsafe { mapping.at(base) })), device_local: self.device_local, spilled: self.spilled, - zeroed, } } @@ -1485,10 +1446,8 @@ pub(crate) unsafe fn allocate( /// Makes an allocation of `len` bytes of `class` with device addresses, its number, the /// `VkBuffer` with every buffer usage that spans it and that buffer's address, mapped whole if /// Shared, its free ranges all of it. Nothing of the runtime writes its bytes, and a Shared -/// allocation's pages become resident as they are first written. Where the device enabled -/// `zeroInitializeDeviceMemory` it is made with `VK_MEMORY_ALLOCATE_ZERO_INITIALIZE_BIT_EXT`, -/// which no import carries (`VUID-VkMemoryAllocateFlagsInfo-flags-10760`), and its bytes read zero -/// until written; elsewhere they are undefined. Counted at `site`, where it names one. +/// allocation's pages become resident as they are first written. Its bytes are undefined. Counted +/// at `site`, where it names one. fn make_allocation( core: &Core, class: MemoryClass, @@ -1507,12 +1466,8 @@ fn make_allocation( unsafe { device.create_buffer(&info, None) }.map_err(Error::vulkan("vkCreateBuffer"))?; // SAFETY: the buffer is the device's. let requirements = unsafe { device.get_buffer_memory_requirements(buffer) }; - let zeroed = core.zero_initialize; - let mut flags = vk::MemoryAllocateFlags::DEVICE_ADDRESS; - if zeroed { - flags |= floor::ZERO_INITIALIZE; - } - let mut flags = vk::MemoryAllocateFlagsInfo::default().flags(flags); + let mut flags = + vk::MemoryAllocateFlagsInfo::default().flags(vk::MemoryAllocateFlags::DEVICE_ADDRESS); let allocate_info = vk::MemoryAllocateInfo::default() .allocation_size(requirements.size.max(len)) .memory_type_index(core.memory_type(class)) @@ -1544,8 +1499,6 @@ fn make_allocation( idle_since: crate::host_time(), retiring: false, reused: false, - zeroed, - taken_to: 0, }; core.counters.count(Metric::BlocksMade); core.counters.allocated(len); @@ -1636,8 +1589,7 @@ impl ImportFailed { /// is told of. `mapping` is the host address of its bytes, where the consumer imported them by /// address. `own` is [`Own::Import`] for the consumer's import, Shared as Metal's no-copy buffers /// are, counted in the imports gauge; or [`Own::Surface`] for a dma-buf surface's buffer -/// ([`crate::Surface::buffer`]), Private as an export is, counted in the surface gauges. Never -/// zeroed. +/// ([`crate::Surface::buffer`]), Private as an export is, counted in the surface gauges. /// /// # Safety /// @@ -1720,7 +1672,6 @@ pub(crate) unsafe fn import( device_local: core.device_local & (1 << info.memory_type_index) != 0, spilled: false, own: Some(own), - zeroed: false, }) } @@ -1757,7 +1708,7 @@ pub(crate) unsafe fn sparse_buffer( } /// Imports one dma-buf of an import over several, `info`'s, with no buffer: counted against the -/// device's allocations ([`allocate`]) and in the imports gauge. Never zeroed. +/// device's allocations ([`allocate`]) and in the imports gauge. /// /// # Safety /// @@ -1812,7 +1763,7 @@ pub(crate) struct SparseParts { /// The block of an import over several dma-bufs: Shared, as an import is, over the sparse buffer /// from its first byte, at the buffer's device address, never mapped. Each chunk is a block of its /// own under it ([`Block::_chunks`]), of the same numbers, its memory and no buffer, the last one -/// holding `release`. Never zeroed. +/// holding `release`. #[cfg(unix)] pub(crate) fn sparse_block( core: &Arc, @@ -1848,7 +1799,6 @@ pub(crate) fn sparse_block( device_local, spilled: false, own: Some(own), - zeroed: false, }; let chunk = |(memory_of, chunk_len): (vk::DeviceMemory, u64), release: Option| { let held = memory(memory_of, chunk_len, vk::Buffer::null(), 0, Own::Chunk); @@ -1875,7 +1825,7 @@ pub(crate) fn sparse_block( /// exports `handle`, its dedicated allocation in the Private memory type, exportable as `handle` /// (counted against the device's allocations, [`allocate`]), bound at its first byte, the /// buffer's address, and its numbers: the block's, and its allocation's, which no hook is told -/// of. Private; never zeroed, never mapped. With it, the allocation's size, which an import of +/// of. Private; never mapped. With it, the allocation's size, which an import of /// the handle names. /// /// Err: [`Limit::BlockLen`] past the device's longest allocation or buffer; [`Limit::ExportType`] @@ -1973,7 +1923,6 @@ pub(crate) unsafe fn export( device_local: core.device_local & (1 << index) != 0, spilled: false, own: Some(Own::Export(handle)), - zeroed: false, }; Ok((memory, needs.size)) } @@ -2034,7 +1983,6 @@ pub(crate) unsafe fn export_surface( device_local: core.device_local & (1 << index) != 0, spilled: false, own: Some(Own::Export(handle)), - zeroed: false, }) } @@ -2126,7 +2074,6 @@ pub(crate) unsafe fn surface_view( device_local: under.memory.device_local, spilled: false, own: Some(Own::Surface { import: false }), - zeroed: false, }; Ok(Block::over(memory, Arc::clone(core), Arc::clone(under))) } diff --git a/crates/metal2vulkan-rt/src/places.rs b/crates/metal2vulkan-rt/src/places.rs index ac1614cd5..6e9301072 100644 --- a/crates/metal2vulkan-rt/src/places.rs +++ b/crates/metal2vulkan-rt/src/places.rs @@ -36,10 +36,6 @@ struct PlaceBlock { free: Ranges, /// The places taken in it. live: usize, - /// Its bytes read zero as the pool handed it out ([`BlockInfo::zeroed`](crate::BlockInfo::zeroed)). - zeroed: bool, - /// The end of the furthest place taken in it: a place past it is bytes no place held. - taken_to: u64, } /// A resource's place: `len` bytes at `offset` in a block of a set. @@ -65,11 +61,9 @@ impl Places { } } - /// A place of `len` bytes at a multiple of `align`, a power of two, its block, and whether - /// its bytes read zero: true where the block read zero as the pool handed it out and no place - /// of it ever held a byte at or past the place's first byte. Where no block has room, a - /// Private block is taken from the pool, without the lock: of the block length, or of `len` - /// where that is longer. + /// A place of `len` bytes at a multiple of `align`, a power of two, and its block. Where no + /// block has room, a Private block is taken from the pool, without the lock: of the block + /// length, or of `len` where that is longer. /// /// Err: what [`Core::take_memory`] returns. pub(crate) fn place( @@ -77,21 +71,19 @@ impl Places { core: &Core, len: u64, align: u64, - ) -> Result<(Place, Memory, bool), Error> { + ) -> Result<(Place, Memory), Error> { let mut blocks = lock(&self.blocks); loop { for block in blocks.iter_mut() { // The image's alignment holds in the allocation the block is a range of. if let Some(offset) = block.free.take_from(len, align, block.memory.base()) { block.live += 1; - let zeroed = block.zeroed && offset >= block.taken_to; - block.taken_to = block.taken_to.max(offset + len); let place = Place { block: block.memory.id, offset, len, }; - return Ok((place, block.memory, zeroed)); + return Ok((place, block.memory)); } } drop(blocks); @@ -108,8 +100,6 @@ impl Places { memory, free: Ranges::new(memory.len), live: 0, - zeroed: memory.info().zeroed, - taken_to: 0, }); } } diff --git a/crates/metal2vulkan-rt/src/tests/draw.rs b/crates/metal2vulkan-rt/src/tests/draw.rs index 86eec7d89..7fe750c32 100644 --- a/crates/metal2vulkan-rt/src/tests/draw.rs +++ b/crates/metal2vulkan-rt/src/tests/draw.rs @@ -829,8 +829,8 @@ pub(crate) mod on_device { let counters = device.counters(); // The first command buffer's submission records two barriers more than the second's: // its upload's, which moves the two new images from undefined to their home layouts - // in one and ends in the other, and one more where it clears a new image (one whose - // memory does not read the driver's zeros) between its move and its home. + // in one and ends in the other, and one more where it clears a new image the runtime + // placed between its move and its home. for (load, first, color_of, barriers) in [ (crate::LoadAction::Clear, 3, BLUE, 5), (crate::LoadAction::Load, 6, WHITE, 3), diff --git a/crates/metal2vulkan-rt/src/tests/floor.rs b/crates/metal2vulkan-rt/src/tests/floor.rs index 26fdfba95..eaf3d9b13 100644 --- a/crates/metal2vulkan-rt/src/tests/floor.rs +++ b/crates/metal2vulkan-rt/src/tests/floor.rs @@ -1181,7 +1181,7 @@ fn a_set_layout_the_device_does_not_support_is_named() { #[test] fn the_optional_features_decide_the_capabilities() { type Set = fn(&mut Features); - let cases: [(Set, &str); 8] = [ + let cases: [(Set, &str); 7] = [ (|f| f.vulkan12.shader_float16 = vk::TRUE, "float16"), ( |f| f.core.shader_storage_image_read_without_format = vk::TRUE, @@ -1207,10 +1207,6 @@ fn the_optional_features_decide_the_capabilities() { }, "subgroup_uniform_control_flow", ), - ( - |f| f.zero_initialize.zero_initialize_device_memory = vk::TRUE, - "zero_initialize_memory", - ), ]; assert_eq!( cases.len(), @@ -1235,10 +1231,6 @@ fn the_optional_features_decide_the_capabilities() { "subgroup_uniform_control_flow", capabilities.subgroup_uniform_control_flow, ), - ( - "zero_initialize_memory", - capabilities.zero_initialize_memory, - ), ]; for (name, value) in answers { assert_eq!( @@ -1434,7 +1426,6 @@ fn every_device_the_loader_lists_is_above_the_floor() { mut feedback_loop, mut feedback_loop_dynamic, mut divisor, - mut zero_initialize, } = capabilities.features; let mut features = vk::PhysicalDeviceFeatures2::default() .features(core) @@ -1462,9 +1453,6 @@ fn every_device_the_loader_lists_is_above_the_floor() { { features = features.push_next(&mut divisor); } - if enabled(crate::floor::ZERO_INITIALIZE_DEVICE_MEMORY) { - features = features.push_next(&mut zero_initialize); - } let extensions: Vec<*const c_char> = capabilities .extensions .iter() diff --git a/crates/metal2vulkan-rt/src/tests/memory.rs b/crates/metal2vulkan-rt/src/tests/memory.rs index 362fe6cdd..a5732d227 100644 --- a/crates/metal2vulkan-rt/src/tests/memory.rs +++ b/crates/metal2vulkan-rt/src/tests/memory.rs @@ -8,8 +8,8 @@ //! map is refused, that a block given back is a free range at once, its bytes as written, the //! first fit of a later take, that each idle allocation is freed at its idle age, under steady //! commits too, that seeded takes and releases of mixed lengths all return, that a Private range -//! is zeroed when the consumer asks, that a take answers whether its bytes are the driver's zeros -//! and the runtime zeroes what it is asked over bytes written outside its buffers, and that +//! is zeroed when the consumer asks, that the runtime zeroes what it is asked over bytes written +//! outside its buffers, and that //! teardown frees everything with the gauges at zero. use crate::fill::{plan, Plan}; @@ -2146,203 +2146,6 @@ mod on_device { } } - /// The driver's zeros at a take (`BlockInfo::zeroed`), on both forms. Where the device - /// enabled `zeroInitializeDeviceMemory` (its floor check's `zero_initialize_memory`), a take - /// that no block of its allocation reached before answers true and is counted: a long Shared - /// block reads zero through its mapping, whole, and a long Private one to a kernel, with no - /// zeroing asked of the runtime, and a block carved past another in a unit allocation answers - /// true as well. A range given back after a write and taken again answers false, its bytes as - /// written, and the consumer's zeroing of it reads zero; so does a unit allocation's range - /// taken again below a later block. Elsewhere every take answers false and none is counted. - /// The consumer's one path, zero unless `zeroed`, reads zero on both forms. - #[test] - fn every_device_answers_at_a_take_whether_its_bytes_are_the_driver_s_zeros() { - const LONG: u64 = 32 << 20; - const SMALL: u64 = 64 << 10; - let len = (WORDS * 4) as u64; - let deep = LONG - len; - let instance = crate::tests::validation::instance(&[]); - let devices = devices_of_the_cfgs_kind(&instance); - assert!(!devices.is_empty(), "no device of this cfg's kind"); - for (name, physical) in &devices { - let capabilities = (physical.check()).unwrap_or_else(|below| panic!("{name}: {below}")); - let form = capabilities.zero_initialize_memory; - let device = Device::new(physical, DeviceOptions::default()) - .unwrap_or_else(|error| panic!("{name}: {error}")); - let core = device.core(); - let counters = device.counters(); - assert_eq!(core.zero_initialize, form, "{name}: the device's form"); - let listed = (device.extensions().iter()) - .any(|extension| extension.as_c_str() == c"VK_EXT_zero_initialize_device_memory"); - assert!(listed || !form, "{name}: the form without its extension"); - let start = counters.metrics(); - let zero_unless = |block: &Block| (!block.zeroed).then_some(0); - - // The kernel's other input, words 1 to WORDS, and its output. - let words_block = (device.take_block(MemoryClass::Shared, 2 * len)) - .unwrap_or_else(|error| panic!("{name}: a Shared block: {error}")); - assert_eq!(words_block.zeroed, form, "{name}: the first take"); - let ones = (device.new_buffer(words_block.id, 0, len, zero_unless(&words_block))) - .unwrap_or_else(|error| panic!("{name}: a buffer: {error}")); - let out = (device.new_buffer(words_block.id, len, len, None)) - .unwrap_or_else(|error| panic!("{name}: a buffer: {error}")); - let contents = ones.contents().expect("a Shared buffer").cast::(); - for index in 0..WORDS { - // SAFETY: the buffer is alive and holds `WORDS` words, and no GPU work uses it. - unsafe { (contents.as_ptr().add(index)).write_volatile(index as u32 + 1) }; - } - let state = add(&device); - let queue = device.new_command_queue(2).expect("a queue"); - let ones_words: Vec = (1..=WORDS as u32).collect(); - - // A long Shared take: an allocation of its own, made in the take. - let before = counters.metrics(); - let long = (device.take_block(MemoryClass::Shared, LONG)) - .unwrap_or_else(|error| panic!("{name}: a long Shared block: {error}")); - assert_eq!(long.zeroed, form, "{name}: a long Shared take"); - let host = bytes(&long); - if long.zeroed { - assert!( - host.iter().all(|&byte| byte == 0), - "{name}: a Shared take that answered zeroed reads zero through its mapping" - ); - } - let whole = (device.new_buffer(long.id, 0, LONG, zero_unless(&long))) - .unwrap_or_else(|error| panic!("{name}: a buffer: {error}")); - assert!( - host.iter().all(|&byte| byte == 0), - "{name}: the consumer's path reads zero" - ); - assert_eq!( - counters.metrics().bytes_zeroed - before.bytes_zeroed, - if form { 0 } else { LONG }, - "{name}: the runtime's zeroing of the long Shared buffer" - ); - - // A long Private take, read by a kernel deep in it. - let private = (device.take_block(MemoryClass::Private, LONG)) - .unwrap_or_else(|error| panic!("{name}: a long Private block: {error}")); - assert_eq!(private.zeroed, form, "{name}: a long Private take"); - let before = counters.metrics(); - let read = (device.new_buffer(private.id, deep, len, zero_unless(&private))) - .unwrap_or_else(|error| panic!("{name}: a Private buffer: {error}")); - assert_eq!( - counters.metrics().bytes_zeroed - before.bytes_zeroed, - if form { 0 } else { len }, - "{name}: the runtime's zeroing of the Private buffer" - ); - add_into(name, &queue, &state, [&read, &ones, &out]); - assert_eq!( - words(&out), - ones_words, - "{name}: a kernel reads the Private take's zeros" - ); - - // A carve past another in a unit allocation. - let first = (device.take_block(MemoryClass::Shared, SMALL)) - .unwrap_or_else(|error| panic!("{name}: a Shared block: {error}")); - let second = (device.take_block(MemoryClass::Shared, SMALL)) - .unwrap_or_else(|error| panic!("{name}: a Shared block: {error}")); - assert_eq!(second.zeroed, form, "{name}: a carve past another"); - let taken = counters.metrics(); - let zeroed_bytes = words_block.len + 2 * LONG + first.len + second.len; - assert_eq!( - ( - taken.zeroed_takes - start.zeroed_takes, - taken.zeroed_take_bytes - start.zeroed_take_bytes - ), - if form { (5, zeroed_bytes) } else { (0, 0) }, - "{name}: the takes counted" - ); - - // Written, given back and taken again: false, as written, and zeroed when asked. - host.fill(0xA5); - drop(whole); - let (address, id) = (long.gpu_address, long.id); - device.release_block(long).expect("a release"); - wait_until("the long Shared block given back", || core.pool.holds(id)); - let again = (device.take_block(MemoryClass::Shared, LONG)) - .unwrap_or_else(|error| panic!("{name}: the long Shared block again: {error}")); - assert_eq!( - again.gpu_address, address, - "{name}: the long allocation again" - ); - assert!(!again.zeroed, "{name}: a long Shared range taken again"); - let host = bytes(&again); - assert!( - host.iter().all(|&byte| byte == 0xA5), - "{name}: a range taken again, as written" - ); - let before = counters.metrics().bytes_zeroed; - let whole = (device.new_buffer(again.id, 0, LONG, zero_unless(&again))) - .unwrap_or_else(|error| panic!("{name}: a buffer: {error}")); - assert!( - host.iter().all(|&byte| byte == 0), - "{name}: the consumer's zeroing of a range taken again" - ); - assert_eq!(counters.metrics().bytes_zeroed - before, LONG, "{name}"); - - add_into(name, &queue, &state, [&ones, &ones, &read]); - drop(read); - let (address, id) = (private.gpu_address, private.id); - device.release_block(private).expect("a release"); - wait_until("the long Private block given back", || core.pool.holds(id)); - let private = (device.take_block(MemoryClass::Private, LONG)) - .unwrap_or_else(|error| panic!("{name}: the long Private block again: {error}")); - assert_eq!( - private.gpu_address, address, - "{name}: the long allocation again" - ); - assert!(!private.zeroed, "{name}: a long Private range taken again"); - let written = (device.new_buffer(private.id, deep, len, None)) - .unwrap_or_else(|error| panic!("{name}: a Private buffer: {error}")); - add_into(name, &queue, &state, [&written, &ones, &out]); - let thrice: Vec = ones_words.iter().map(|word| 3 * word).collect(); - assert_eq!( - words(&out), - thrice, - "{name}: a Private range taken again, as written" - ); - let read = (device.new_buffer(private.id, deep, len, zero_unless(&private))) - .unwrap_or_else(|error| panic!("{name}: a Private buffer: {error}")); - add_into(name, &queue, &state, [&read, &ones, &out]); - assert_eq!( - words(&out), - ones_words, - "{name}: the consumer's zeroing of a Private range taken again" - ); - - // A unit allocation's range given back and taken again below a later block. - let (address, id) = (first.gpu_address, first.id); - device.release_block(first).expect("a release"); - wait_until("the Shared block given back", || core.pool.holds(id)); - let third = (device.take_block(MemoryClass::Shared, SMALL)) - .unwrap_or_else(|error| panic!("{name}: a Shared block: {error}")); - assert_eq!(third.gpu_address, address, "{name}: the first fit"); - assert!( - !third.zeroed, - "{name}: a unit allocation's range taken again" - ); - let end = counters.metrics(); - assert_eq!( - end.zeroed_takes - taken.zeroed_takes, - 0, - "{name}: no range taken again is counted" - ); - println!( - "memory: {name}: zeroed takes, form {form} (extension listed {listed}): zeroed_takes {} zeroed_take_bytes {} bytes_zeroed {} block_zero_fill_bytes {}", - end.zeroed_takes - start.zeroed_takes, - end.zeroed_take_bytes - start.zeroed_take_bytes, - end.bytes_zeroed - start.bytes_zeroed, - end.block_zero_fill_bytes - start.block_zero_fill_bytes, - ); - drop((whole, read, written, ones, out, queue, state)); - drop((again, private, second, third, words_block)); - drop(device); - wait_until("the teardown", || counters.gauges() == Gauges::default()); - } - } - /// The runtime zeroes what the consumer asks over bytes it cannot see written: the consumer's /// writes through a new Shared block's mapping, outside every buffer, then a buffer zeroed /// over some of them, read zero there and as written elsewhere; a new Private block's bytes diff --git a/crates/metal2vulkan-rt/src/tests/texture.rs b/crates/metal2vulkan-rt/src/tests/texture.rs index 6ee9ea879..a1a5c24ea 100644 --- a/crates/metal2vulkan-rt/src/tests/texture.rs +++ b/crates/metal2vulkan-rt/src/tests/texture.rs @@ -33,8 +33,8 @@ //! layer and slice once, each within the zero source. Under a device cfg, a new texture reads //! zero in every subresource in the place another texture wrote and gave back, Shared and //! Private, colour, depth and block-compressed, and each counts one clear of its image's bytes; -//! the device's first texture, in memory no resource used, reads zero too, moved home from the -//! zero-initialized layout with no clear on a device of zeroed allocations and cleared elsewhere. +//! the device's first texture, in memory no resource used, reads zero too, by one clear on every +//! device. use crate::arrays::Grants; use crate::error::{Error, Refusal}; @@ -685,8 +685,8 @@ mod on_device { /// and a block-compressed one where the device makes it, each new texture Shared and Private. /// The written texture reads its bytes back first, in every subresource, and the new one /// takes its place; the device counts one clear for each new texture, of its image's bytes. - /// The device's first texture reads zero too: on a device of zeroed allocations with no - /// clear, its memory the driver's zeros, counted in `zeroed_textures`; elsewhere cleared. + /// The device's first texture reads zero too, by one clear of the runtime's, on every device: + /// no device enables `VK_EXT_zero_initialize_device_memory`. #[test] fn every_device_reads_zero_from_a_new_texture_where_another_was_written() { use crate::tests::command::on_device::{finished, within}; @@ -753,9 +753,12 @@ mod on_device { 4, ), ]; - // The device's first texture, in a texture block the pool handed out: on a device of - // zeroed allocations its memory reads the driver's zeros, and it is moved home from - // the zero-initialized layout with no clear; elsewhere it is cleared. + // The device's first texture, in a texture block the pool handed out, cleared. + let zero_initialize = c"VK_EXT_zero_initialize_device_memory"; + assert!( + !(device.extensions().iter()).any(|e| e.as_c_str() == zero_initialize), + "{name}: the zero-initialize extension enabled" + ); let before = counters.metrics(); let d = descriptor(TextureType::Type2D, PixelFormat::RGBA8Unorm, [64, 64, 1]); let first = (device.new_texture(&d, Some(4096))) @@ -772,26 +775,26 @@ mod on_device { "{name}: the first texture" ); let after = counters.metrics(); - let form = device.core().zero_initialize; let size = first.image_size(); assert_eq!( ( - after.zeroed_textures - before.zeroed_textures, - after.zeroed_texture_bytes - before.zeroed_texture_bytes, after.texture_clears - before.texture_clears, + after.texture_clear_bytes - before.texture_clear_bytes, ), - match form { - true => (1, size, 0), - false => (0, 0, 1), - }, - "{name}: the first texture's zeros, zero-initialized form {form}" + (1, size), + "{name}: the first texture's clear" ); let textures = counters.gauges().textures - 1; drop(first); within("the first texture freed", || { counters.gauges().textures == textures }); - println!("texture zeros: {name}: the first texture, zero-initialized form {form}"); + println!( + "texture zeros: {name}: the first texture cleared by the runtime: texture_clears \ + {}, texture_clear_bytes {}", + after.texture_clears - before.texture_clears, + after.texture_clear_bytes - before.texture_clear_bytes + ); let mut cleared = 0; for (format, texture_type, extent, levels, slices, unit, block) in shapes { let mut d = descriptor(texture_type, format, extent); diff --git a/crates/metal2vulkan-rt/src/texture.rs b/crates/metal2vulkan-rt/src/texture.rs index c433f41c7..ea46e5fcb 100644 --- a/crates/metal2vulkan-rt/src/texture.rs +++ b/crates/metal2vulkan-rt/src/texture.rs @@ -14,9 +14,8 @@ //! A texture the runtime places (a new texture of [`Device::new_texture`], //! [`Device::new_texture_for_views`] or [`Device::new_managed_texture`]) reads zero until written: //! that upload clears every subresource of its image between the move from undefined and the -//! move home ([`Zero`]), unless its memory reads the driver's zeros, which no resource used: on a -//! device of zeroed allocations its image is made in the zero-initialized layout, and its move -//! home from there zeroes it with no clear. Metal does not say what a new texture holds. The +//! move home ([`Zero`]), on every device, its first texture in memory no resource used included. +//! Metal does not say what a new texture holds. The //! runtime's choice is zero, as an Apple M3 Max answered for new Shared and Managed textures, //! because programs read textures they never wrote, and the memory's last bytes would follow //! process history. @@ -45,7 +44,6 @@ use crate::copy_out; use crate::counters::{Counters, Gauge, Metric, Site}; use crate::device::{lock, Core, Device}; use crate::error::{Error, Gap, Limit, Refusal, RenderPassKind, TextureViewKind}; -use crate::floor; use crate::hazard::HeapId; use crate::host_bytes::HostBytes; use crate::memory::{self, Block, BlockId, MemoryClass}; @@ -387,11 +385,7 @@ pub(crate) struct Image { /// The image is cube-compatible ([`Plan`]'s `cube`), so a cube view takes six of its layers. cube: bool, /// The layout its move home starts from: undefined; preinitialized for a texture over a buffer - /// in place, whose move home keeps the bytes; zero-initialized for a texture whose memory - /// reads the driver's zeros, which no resource used, whose move home then zeroes it with no - /// clear. A texture that reads zero is made zero-initialized on a device of zeroed - /// allocations even where its memory was used, and its move home then starts from - /// undefined, which any layout takes. + /// in place, whose move home keeps the bytes. first: vk::ImageLayout, /// An upload recorded its move from `first` to `home`. Read and set under the work lock. homed: AtomicBool, @@ -687,7 +681,7 @@ impl Image { let (d, shape, plan) = &shadowing.made; // SAFETY: the device is live, and the texture's plan checked the shadow's usage against // its image format query for the shape (`plan`). - let (image, backing, bytes, _, _, _) = unsafe { make(core, d, shape, plan, Bind::Pooled) }?; + let (image, backing, bytes, _, _) = unsafe { make(core, d, shape, plan, Bind::Pooled) }?; core.counters.rise(Gauge::Shadows); core.counters.rise_by(Gauge::ShadowBytes, bytes); let made = Arc::new(Image { @@ -1332,7 +1326,7 @@ impl Device { // memory or over a buffer's bytes. let placed = matches!(source, Source::Plain | Source::Managed(..)); let (bind, mut block) = match source { - Source::Plain | Source::Managed(..) => (Bind::Zeroed, None), + Source::Plain | Source::Managed(..) => (Bind::Pooled, None), Source::Heap(block, heap, offset) => { let bind = Bind::Heap { memory: block.memory.device_memory(), @@ -1387,15 +1381,10 @@ impl Device { // SAFETY: as above. made = unsafe { make(core, &d, &shape, &plan, Bind::Pooled) }; } - let (image, backing, bytes, sampled, storage, driver_zeros) = made?; + let (image, backing, bytes, sampled, storage) = made?; core.counters.rise(Gauge::Textures); - // Its memory reads the driver's zeros, which no resource used: its move home from the - // zero-initialized layout zeroes it, with no clear. Else a clear does. - if driver_zeros { - first = floor::ZERO_INITIALIZED; - core.counters.texture_zeroed(bytes); - } - let zero = (placed && !driver_zeros).then(|| Zero::of(&plan, d.mipmap_level_count, &shape)); + // A clear zeroes it in its move home. + let zero = placed.then(|| Zero::of(&plan, d.mipmap_level_count, &shape)); let attachment_reads = plan.attachment_reads && home == vk::ImageLayout::SHADER_READ_ONLY_OPTIMAL; // On a device without the feedback loop, a draw reads such an image through its shadow. @@ -2297,16 +2286,14 @@ fn whole(aspects: vk::ImageAspectFlags) -> vk::ImageSubresourceRange { } } -/// The image, its memory and the memory's bytes, its views (the sampled view and the storage -/// view), and whether its memory reads the driver's zeros, which no resource used before -/// ([`Bind::Zeroed`]). +/// The image, its memory and the memory's bytes, and its views (the sampled view and the storage +/// view). type Objects = ( vk::Image, Backing, u64, Option, Option, - bool, ); /// Makes the image, binds it to a place in a texture block or to memory of its own, and makes its @@ -2357,10 +2344,6 @@ enum Source<'a> { enum Bind { /// A place in a texture block, or memory of its own. Pooled, - /// As `Pooled`, for a texture that reads zero until written ([`Zero`]): on a device of - /// zeroed allocations ([`Capabilities::zero_initialize_memory`](floor::Capabilities::zero_initialize_memory)) - /// made in the zero-initialized layout, and its memory of its own made zeroed. - Zeroed, /// A linear image, made preinitialized, at `at` in a block at `base` in the allocation /// `memory`, of type `memory_type` and of `block_len` bytes, where the device lays its rows /// `bytes_per_row` apart from there; of a render target, where its subresource ends within @@ -2469,11 +2452,7 @@ impl Made { .tiling(vk::ImageTiling::LINEAR) .usage(plan.linear_usage()) .initial_layout(vk::ImageLayout::PREINITIALIZED), - // Every image of a texture that reads zero starts in the zero-initialized layout on a - // device of zeroed allocations; its move home names that layout only where its - // memory reads zero, and undefined elsewhere, which any layout takes. - Bind::Zeroed if core.zero_initialize => info.initial_layout(floor::ZERO_INITIALIZED), - Bind::Pooled | Bind::Zeroed | Bind::Heap { .. } => info, + Bind::Pooled | Bind::Heap { .. } => info, }; // SAFETY: the caller's contract: the device makes such an image. let image = @@ -2492,8 +2471,7 @@ impl Made { let placed = dedicated.requires_dedicated_allocation == vk::FALSE && bits & (1 << core.memory_type(MemoryClass::Private)) != 0; // Where the device-local memory has no texture block left, memory of its own. - let zeroed = matches!(bind, Bind::Zeroed) && core.zero_initialize; - let pooled = match placed && matches!(bind, Bind::Pooled | Bind::Zeroed) { + let pooled = match placed && matches!(bind, Bind::Pooled) { true => match (core.places).place(core, requirements.size, requirements.alignment) { Ok(found) => Some(found), Err(error) if error.is_out_of_device_memory() => None, @@ -2501,8 +2479,6 @@ impl Made { }, false => None, }; - // Whether the image's memory reads the driver's zeros, which no resource used. - let mut driver_zeros = false; let (backing, memory, offset) = if let Bind::InPlace { memory, base, @@ -2560,8 +2536,7 @@ impl Made { (true, Some(at)) => (Backing::InBlock, memory, base + at), _ => return Err(refused), } - } else if let Some((place, block, fresh)) = pooled { - driver_zeros = zeroed && fresh; + } else if let Some((place, block)) = pooled { ( Backing::Placed(place), block.device_memory(), @@ -2575,17 +2550,10 @@ impl Made { _ => local.trailing_zeros(), }; let mut own = vk::MemoryDedicatedAllocateInfo::default().image(image); - // Made zeroed for a texture that reads zero, on a device of zeroed allocations. - let mut flags = vk::MemoryAllocateFlagsInfo::default().flags(floor::ZERO_INITIALIZE); let allocate = vk::MemoryAllocateInfo::default() .allocation_size(requirements.size) .memory_type_index(memory_type) .push_next(&mut own); - let allocate = match zeroed { - true => allocate.push_next(&mut flags), - false => allocate, - }; - driver_zeros = zeroed; // SAFETY: the type, and each a spill takes, is one the image's requirements allow, and // the allocation its own. let (memory, spilled) = unsafe { @@ -2611,14 +2579,7 @@ impl Made { .map_err(Error::vulkan("vkBindImageMemory"))?; // SAFETY: the image is bound, of the plan's format, and has its usage. let (sampled, storage) = unsafe { self.views(device, image, shape, plan) }?; - Ok(( - image, - backing, - requirements.size, - sampled, - storage, - driver_zeros, - )) + Ok((image, backing, requirements.size, sampled, storage)) } /// Makes `image`'s views of `plan`: its sampled view and its storage view, where it has them. diff --git a/crates/metal2vulkan-validation/src/replay/new_runtime/judged.rs b/crates/metal2vulkan-validation/src/replay/new_runtime/judged.rs index 610692e3a..989cd8c3f 100644 --- a/crates/metal2vulkan-validation/src/replay/new_runtime/judged.rs +++ b/crates/metal2vulkan-validation/src/replay/new_runtime/judged.rs @@ -9,25 +9,16 @@ use crate::replay::range::stem; use std::path::Path; /// Each judged metric: its name, the executed counters it adds and the one it takes away. A new -/// texture is zeroed by a clear or made zero-initialized, and the split between the two follows -/// where the pool places it, which may differ between two plays: the two are counted as one, and -/// the barriers leave out the one after an upload's clears (`texture_clear_barriers`). +/// texture is zeroed by a clear, and the barriers leave out the one after an upload's clears +/// (`texture_clear_barriers`). const JUDGED: [(&str, &[&str], Option<&str>); 7] = [ ("submissions", &["submissions"], None), ("passes", &["passes"], None), ("barriers", &["barriers"], Some("texture_clear_barriers")), ("bytes_copied", &["bytes_copied"], None), ("pipelines_created", &["pipelines_created"], None), - ( - "new_textures_zeroed", - &["texture_clears", "zeroed_textures"], - None, - ), - ( - "new_texture_zeroed_bytes", - &["texture_clear_bytes", "zeroed_texture_bytes"], - None, - ), + ("new_textures_zeroed", &["texture_clears"], None), + ("new_texture_zeroed_bytes", &["texture_clear_bytes"], None), ]; /// The judged metrics' records of the play of the stream whose first segment is `first`, with diff --git a/crates/metal2vulkan-validation/src/replay/new_runtime/mod.rs b/crates/metal2vulkan-validation/src/replay/new_runtime/mod.rs index a2ee8e60f..fc9d858a3 100644 --- a/crates/metal2vulkan-validation/src/replay/new_runtime/mod.rs +++ b/crates/metal2vulkan-validation/src/replay/new_runtime/mod.rs @@ -2596,8 +2596,6 @@ impl Backend for NewRuntime { ("block_zero_fill_bytes", metrics.block_zero_fill_bytes), ("texture_clears", metrics.texture_clears), ("texture_clear_bytes", metrics.texture_clear_bytes), - ("zeroed_textures", metrics.zeroed_textures), - ("zeroed_texture_bytes", metrics.zeroed_texture_bytes), ("texture_clear_barriers", metrics.texture_clear_barriers), ("pipelines_created", metrics.pipelines_created), ("first_use_waits", metrics.first_use_waits), diff --git a/crates/metal2vulkan-validation/src/replay/tests.rs b/crates/metal2vulkan-validation/src/replay/tests.rs index 34959d4b6..90b15bfc3 100644 --- a/crates/metal2vulkan-validation/src/replay/tests.rs +++ b/crates/metal2vulkan-validation/src/replay/tests.rs @@ -958,9 +958,7 @@ fn judged_counts() -> Counters { ("barriers", 5), ("texture_clear_barriers", 1), ("texture_clears", 2), - ("zeroed_textures", 4), ("texture_clear_bytes", 100), - ("zeroed_texture_bytes", 60), ("bytes_copied", 7), ("blocks_made", 9), ]) @@ -968,8 +966,8 @@ fn judged_counts() -> Counters { /// The matrix's judged metrics of a play on the new runtime are the play's executed totals, one /// record each under the stream's first segment's stem (whitespace made `_`) and its range: the -/// barriers less the one after each upload's clears, the clears and the zero-initialized textures -/// as one count and their bytes as one, a counter the backend does not report as 0, and no other +/// barriers less the one after each upload's clears, the clears and their bytes, a counter the +/// backend does not report as 0, and no other /// counter (here `blocks_made`). A play through a last frame names it. #[test] fn the_judged_metrics_total_the_play_less_the_zeroing_barrier() { @@ -987,8 +985,8 @@ fn the_judged_metrics_total_the_play_less_the_zeroing_barrier() { "M2V-MATRIX metric replay-rt/a_b/whole/barriers 8", "M2V-MATRIX metric replay-rt/a_b/whole/bytes_copied 14", "M2V-MATRIX metric replay-rt/a_b/whole/pipelines_created 0", - "M2V-MATRIX metric replay-rt/a_b/whole/new_textures_zeroed 12", - "M2V-MATRIX metric replay-rt/a_b/whole/new_texture_zeroed_bytes 320", + "M2V-MATRIX metric replay-rt/a_b/whole/new_textures_zeroed 4", + "M2V-MATRIX metric replay-rt/a_b/whole/new_texture_zeroed_bytes 200", ]; assert_eq!(records, whole); let mut kept = Kept { diff --git a/crates/metal2vulkan/tests/api_signatures.tsv b/crates/metal2vulkan/tests/api_signatures.tsv index 3449c593b..6002caa1d 100644 --- a/crates/metal2vulkan/tests/api_signatures.tsv +++ b/crates/metal2vulkan/tests/api_signatures.tsv @@ -1213,7 +1213,7 @@ const-value metal2vulkan-rt::floor::ATTACHMENT_READ_EXTENSIONS &[ash::ext::attac const-value metal2vulkan-rt::floor::BUFFER_USAGE vk::BufferUsageFlags::from_raw(vk::BufferUsageFlags::TRANSFER_SRC.as_raw() | vk::BufferUsageFlags::TRANSFER_DST.as_raw() | vk::BufferUsageFlags::UNIFORM_TEXEL_BUFFER.as_raw() | vk::BufferUsageFlags::STORAGE_TEXEL_BUFFER.as_raw() | vk::BufferUsageFlags::UNIFORM_BUFFER.as_raw() | vk::BufferUsageFlags::STORAGE_BUFFER.as_raw() | vk::BufferUsageFlags::INDEX_BUFFER.as_raw() | vk::BufferUsageFlags::VERTEX_BUFFER.as_raw() | vk::BufferUsageFlags::INDIRECT_BUFFER.as_raw() | vk::BufferUsageFlags::SHADER_DEVICE_ADDRESS.as_raw()) const-value metal2vulkan-rt::floor::DEVICE_EXTENSIONS &[ash::khr::swapchain::NAME, ash::ext::robustness2::NAME, ash::ext::calibrated_timestamps::NAME] const-value metal2vulkan-rt::floor::INSTANCE_EXTENSIONS &[ash::khr::surface::NAME] -const-value metal2vulkan-rt::floor::OPTIONAL_EXTENSIONS &[ash::khr::shader_maximal_reconvergence::NAME, ash::khr::shader_subgroup_uniform_control_flow::NAME, ash::khr::portability_subset::NAME, ash::khr::vertex_attribute_divisor::NAME, ash::ext::vertex_attribute_divisor::NAME, ash::ext::external_memory_host::NAME, ash::khr::external_memory_fd::NAME, ash::ext::external_memory_dma_buf::NAME, ash::khr::external_memory_win32::NAME, ash::ext::queue_family_foreign::NAME, ash::ext::image_drm_format_modifier::NAME, ZERO_INITIALIZE_DEVICE_MEMORY] +const-value metal2vulkan-rt::floor::OPTIONAL_EXTENSIONS &[ash::khr::shader_maximal_reconvergence::NAME, ash::khr::shader_subgroup_uniform_control_flow::NAME, ash::khr::portability_subset::NAME, ash::khr::vertex_attribute_divisor::NAME, ash::ext::vertex_attribute_divisor::NAME, ash::ext::external_memory_host::NAME, ash::khr::external_memory_fd::NAME, ash::ext::external_memory_dma_buf::NAME, ash::khr::external_memory_win32::NAME, ash::ext::queue_family_foreign::NAME, ash::ext::image_drm_format_modifier::NAME] const-value metal2vulkan-rt::floor::OPTIONAL_INSTANCE_EXTENSIONS &[ash::khr::portability_enumeration::NAME] const-value metal2vulkan-rt::floor::TIME_DOMAINS [vk::TimeDomainKHR::DEVICE, crate::times::HOST_DOMAIN] const-value metal2vulkan-rt::floor::VERSION vk::API_VERSION_1_3 @@ -2265,7 +2265,6 @@ field metal2vulkan-rt::BlockInfo.gpu_address pub gpu_address: u64 field metal2vulkan-rt::BlockInfo.id pub id: BlockId field metal2vulkan-rt::BlockInfo.len pub len: u64 field metal2vulkan-rt::BlockInfo.offset pub offset: u64 -field metal2vulkan-rt::BlockInfo.zeroed pub zeroed: bool field metal2vulkan-rt::BufferLayout.bytes_per_image pub bytes_per_image: u64 field metal2vulkan-rt::BufferLayout.bytes_per_row pub bytes_per_row: u64 field metal2vulkan-rt::BufferLayout.offset pub offset: u64 @@ -2444,10 +2443,6 @@ field metal2vulkan-rt::Metrics.untimed_command_buffers pub untimed_command_buffe field metal2vulkan-rt::Metrics.upload_waits pub upload_waits: u64 field metal2vulkan-rt::Metrics.waits_behind_counter pub waits_behind_counter: u64 field metal2vulkan-rt::Metrics.zero_source_allocations pub zero_source_allocations: SiteAllocations -field metal2vulkan-rt::Metrics.zeroed_take_bytes pub zeroed_take_bytes: u64 -field metal2vulkan-rt::Metrics.zeroed_takes pub zeroed_takes: u64 -field metal2vulkan-rt::Metrics.zeroed_texture_bytes pub zeroed_texture_bytes: u64 -field metal2vulkan-rt::Metrics.zeroed_textures pub zeroed_textures: u64 field metal2vulkan-rt::PixelFormatInfo.cast_class pub cast_class: u64 field metal2vulkan-rt::PixelFormatInfo.flags pub flags: u64 field metal2vulkan-rt::PixelFormatInfo.name pub name: &'static str @@ -2608,7 +2603,6 @@ field metal2vulkan-rt::floor::Capabilities.queue_family pub queue_family: u32 field metal2vulkan-rt::floor::Capabilities.shared_int64_atomics pub shared_int64_atomics: bool field metal2vulkan-rt::floor::Capabilities.storage_read_without_format pub storage_read_without_format: bool field metal2vulkan-rt::floor::Capabilities.subgroup_uniform_control_flow pub subgroup_uniform_control_flow: bool -field metal2vulkan-rt::floor::Capabilities.zero_initialize_memory pub zero_initialize_memory: bool field metal2vulkan-rt::floor::Features.core pub core: vk::PhysicalDeviceFeatures field metal2vulkan-rt::floor::Features.divisor pub divisor: vk::PhysicalDeviceVertexAttributeDivisorFeaturesKHR<'static> field metal2vulkan-rt::floor::Features.feedback_loop pub feedback_loop: vk::PhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT<'static> @@ -2620,11 +2614,9 @@ field metal2vulkan-rt::floor::Features.subgroup_uniform_control_flow pub subgrou field metal2vulkan-rt::floor::Features.vulkan11 pub vulkan11: vk::PhysicalDeviceVulkan11Features<'static> field metal2vulkan-rt::floor::Features.vulkan12 pub vulkan12: vk::PhysicalDeviceVulkan12Features<'static> field metal2vulkan-rt::floor::Features.vulkan13 pub vulkan13: vk::PhysicalDeviceVulkan13Features<'static> -field metal2vulkan-rt::floor::Features.zero_initialize pub zero_initialize: ZeroInitializeDeviceMemoryFeatures field metal2vulkan-rt::floor::MemoryTypes.private pub private: u32 field metal2vulkan-rt::floor::MemoryTypes.ring pub ring: u32 field metal2vulkan-rt::floor::MemoryTypes.shared pub shared: u32 -field metal2vulkan-rt::floor::ZeroInitializeDeviceMemoryFeatures.zero_initialize_device_memory pub zero_initialize_device_memory: vk::Bool32 field metal2vulkan-runtime::AddressRange.length pub length: u64 field metal2vulkan-runtime::AddressRange.start pub start: GpuAddress field metal2vulkan-runtime::BinaryArchiveDescriptor.url pub url: Option @@ -11927,7 +11919,6 @@ struct metal2vulkan-rt::floor::BelowFloor #[derive(Clone, Debug, PartialEq, Eq)] struct metal2vulkan-rt::floor::Capabilities pub struct Capabilities struct metal2vulkan-rt::floor::Features #[derive(Clone, Copy, Default)] pub struct Features struct metal2vulkan-rt::floor::MemoryTypes #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct MemoryTypes -struct metal2vulkan-rt::floor::ZeroInitializeDeviceMemoryFeatures #[derive(Clone, Copy)] #[repr(C)] pub struct ZeroInitializeDeviceMemoryFeatures struct metal2vulkan-runtime::AddressModeMap #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct AddressModeMap struct metal2vulkan-runtime::AddressPool pub struct AddressPool struct metal2vulkan-runtime::AddressRange #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[non_exhaustive] pub struct AddressRange @@ -12502,12 +12493,6 @@ trait-impl metal2vulkan-rt::TextureSwizzleChannels impl Default impl Default for trait-impl metal2vulkan-rt::floor::BelowFloor impl fmt::Display impl fmt::Display for BelowFloor trait-impl metal2vulkan-rt::floor::BelowFloor impl std::error::Error impl std::error::Error for BelowFloor trait-impl metal2vulkan-rt::floor::Missing impl fmt::Display impl fmt::Display for Missing -trait-impl metal2vulkan-rt::floor::ZeroInitializeDeviceMemoryFeatures impl Default impl Default for ZeroInitializeDeviceMemoryFeatures -trait-impl metal2vulkan-rt::floor::ZeroInitializeDeviceMemoryFeatures impl fe impl Send unsafe impl Send for ZeroInitializeDeviceMemoryFeatures -trait-impl metal2vulkan-rt::floor::ZeroInitializeDeviceMemoryFeatures impl fe impl Sync unsafe impl Sync for ZeroInitializeDeviceMemoryFeatures -trait-impl metal2vulkan-rt::floor::ZeroInitializeDeviceMemoryFeatures impl fe impl vk::ExtendsDeviceCreateInfo unsafe impl vk::ExtendsDeviceCreateInfo for ZeroInitializeDeviceMemoryFeatures -trait-impl metal2vulkan-rt::floor::ZeroInitializeDeviceMemoryFeatures impl fe impl vk::ExtendsPhysicalDeviceFeatures2 unsafe impl vk::ExtendsPhysicalDeviceFeatures2 for ZeroInitializeDeviceMemoryFeatures -trait-impl metal2vulkan-rt::floor::ZeroInitializeDeviceMemoryFeatures impl fe impl vk::TaggedStructure unsafe impl vk::TaggedStructure for ZeroInitializeDeviceMemoryFeatures trait-impl metal2vulkan-runtime::AddressModeMap impl Default impl Default for AddressModeMap trait-impl metal2vulkan-runtime::AddressPool impl Drop impl Drop for AddressPool trait-impl metal2vulkan-runtime::AddressPool impl std::fmt::Debug impl std::fmt::Debug for AddressPool diff --git a/docs/REPLAY-STREAM.md b/docs/REPLAY-STREAM.md index 428065985..a1ed42e62 100644 --- a/docs/REPLAY-STREAM.md +++ b/docs/REPLAY-STREAM.md @@ -1049,10 +1049,8 @@ finished its range (it ended without an error, through frame `F`'s present where metric replay-rt/STEM/RANGE/NAME N` (`STEM` the first segment's stem, whitespace made `_`; `RANGE` `through-F` or `whole`; `N` the play's executed total of `submissions`, `passes`, `barriers` less `texture_clear_barriers`, `bytes_copied` and `pipelines_created`, and of -`new_textures_zeroed`, the new textures zeroed by a clear (`texture_clears`) and those made -zero-initialized (`zeroed_textures`) as one count, the split between the two following where the -runtime's pool places a texture, which may differ between two plays, and -`new_texture_zeroed_bytes`, their bytes as one), each one two plays of one stream at one commit +`new_textures_zeroed`, the new textures zeroed by a clear (`texture_clears`), and +`new_texture_zeroed_bytes`, their bytes), each one two plays of one stream at one commit on one card gave alike, which the matrix's rule (`scripts/matrix/results.py`) holds equal to the base's, failing a play whose base has a record it lacks; a play that did not finish its range prints none,