diff --git a/crates/metal2vulkan-runtime/src/in_place.rs b/crates/metal2vulkan-runtime/src/in_place.rs index ebbaa0d39..259cdefe2 100644 --- a/crates/metal2vulkan-runtime/src/in_place.rs +++ b/crates/metal2vulkan-runtime/src/in_place.rs @@ -142,7 +142,8 @@ //! the next device's check runs that class and access again (`encode`), its note saying which //! the cause was. A program that will make such textures //! starts the check earlier, where it likes, through `Device::settle_in_place_checks` (with no -//! wait: a zero timeout). +//! wait: a zero timeout). A buffer's making starts none: until the verdicts of exportable +//! blocks are known the runtime's own buffers lie in plain blocks ([`Device::fd_blocks_checked`]). //! - **Visibility.** A command reads the image's texels in the memory a buffer over the same pages //! reads: the pages' host-visible, host-coherent import (a dma-buf's own import is of the same //! memory type). So a CPU write reaches a command through the image as it reaches the buffer's @@ -1262,11 +1263,16 @@ impl Device { /// Whether the runtime's own buffers lie in blocks allocated exportable (`memory.rs`'s /// "Buffers in exportable blocks"), by the device's verdicts ([`fd_blocks_take`]), asked as - /// such a buffer is made: a pending verdict starts the check, and the buffer lies in a plain - /// block meanwhile, as it does where the verdicts refuse such blocks; each counted - /// (`WorkCounts::fd_blocks_awaited`, `WorkCounts::fd_blocks_refused`). Never waits. + /// such a buffer is made: where a verdict is pending the buffer lies in a plain block, as it + /// does where the verdicts refuse such blocks; each counted (`WorkCounts::fd_blocks_awaited`, + /// `WorkCounts::fd_blocks_refused`). Never waits, and starts no check: the verdicts come from + /// the check's record as the device is made, or from a check a texture over host pages or + /// `Device::settle_in_place_checks` started. A check a buffer's making started would run + /// beside every program from its first buffer, its own buffers, imports and command buffers + /// among the program's, where a program that makes no texture over host pages has no use + /// for it. pub(crate) fn fd_blocks_checked(&self) -> bool { - let verdict = |class, access, rows| self.in_place_verdict(class, access, rows); + let verdict = |class, access, rows| self.shared().in_place.verdict(class, access, rows); match fd_blocks_take(verdict) { FdBlocksTake::Take => true, FdBlocksTake::Pending => { diff --git a/crates/metal2vulkan-runtime/src/memory.rs b/crates/metal2vulkan-runtime/src/memory.rs index 0adb3d238..5056394ba 100644 --- a/crates/metal2vulkan-runtime/src/memory.rs +++ b/crates/metal2vulkan-runtime/src/memory.rs @@ -89,8 +89,10 @@ //! buffer it starts `PREINITIALIZED`. So the buffers lie there only once the device's in-place //! check of such blocks (`in_place.rs`'s `PagesClass::FdBlocks`) passed what a texture over one //! takes that it takes over a plain block's (`in_place.rs`'s `fd_blocks_take`): from the check's -//! record as the device is made, else once its check answered, in plain blocks until then -//! (`WorkCounts::fd_blocks_awaited`) and where it refused them (`fd_blocks_refused`). A +//! record as the device is made, else once its check answered (a check a texture over host +//! pages or `Device::settle_in_place_checks` started; a buffer's making starts none), in plain +//! blocks until then (`WorkCounts::fd_blocks_awaited`) and where it refused them +//! (`fd_blocks_refused`). A //! two-plane texture's planes over such a buffer are read through the texel buffer, the //! device's conversion image not made (`ycbcr_planes_images_kept_exportable_block`): the check //! covers single-plane images alone. On a Radeon 780M (RADV) a block's `vkAllocateMemory` of a diff --git a/crates/metal2vulkan-runtime/src/tests/reclaim_submit_bench.rs b/crates/metal2vulkan-runtime/src/tests/reclaim_submit_bench.rs index bbc39f0ce..4de2938d1 100644 --- a/crates/metal2vulkan-runtime/src/tests/reclaim_submit_bench.rs +++ b/crates/metal2vulkan-runtime/src/tests/reclaim_submit_bench.rs @@ -35,8 +35,9 @@ //! (`WorkCounts::buffer_blocks_made_ahead`), allocated exportable where the device's check of //! such blocks passed (`memory.rs`'s "Buffers in exportable blocks"); the second settles the //! device's in-place check before the phases, as a device of a driver whose check's record -//! holds its verdicts knows them as it is made, where the first's check runs beside them, as a -//! driver's first device's does. +//! holds its verdicts knows them as it is made, where the first starts no check (a buffer's +//! making starts none), its blocks plain, as a driver's first device's are until a texture over +//! host pages starts the check and it answers. //! - **System heap, 64 MiB**, **System heap, 16 MiB** and **System heap, 4 MiB**: allocations of //! the device's first memory type that is host-visible and host-coherent but not device-local or //! cached (where a unified-memory device's `Private` blocks lie, `memory.rs`, `candidates`), of diff --git a/crates/metal2vulkan-runtime/src/tests/recycle.rs b/crates/metal2vulkan-runtime/src/tests/recycle.rs index 6f4435428..c7d8f491e 100644 --- a/crates/metal2vulkan-runtime/src/tests/recycle.rs +++ b/crates/metal2vulkan-runtime/src/tests/recycle.rs @@ -28,10 +28,6 @@ //! the same length was filled and released: the inplace-surface probe's `fresh` mode). //! - **Each frame's buffers, recycled.** Eight `Private` buffers made, filled and released each of //! sixty frames take parked buffers from the second frame on. -//! -//! Each test's device settles its check of textures over host pages before the test counts: the -//! check, which a buffer's making starts where its verdicts are pending, parks and recycles -//! buffers of its own while it runs. use super::blit_holds::{Scratch, WAIT}; use crate::recycle; @@ -65,12 +61,7 @@ fn device(cache: &Path) -> Device { }, ..DeviceOptions::default() }; - let device = Device::system_default_with(&options).unwrap(); - // The device's check of textures over host pages, which its first buffer's making starts - // (`in_place.rs`'s `fd_blocks_checked`), parks and recycles buffers of its own as it runs: - // settled before a test counts, so the counts are the test's own. - device.settle_in_place_checks(WAIT); - device + Device::system_default_with(&options).unwrap() } fn descriptor() -> TextureDescriptor { diff --git a/crates/metal2vulkan-runtime/src/work_counts.rs b/crates/metal2vulkan-runtime/src/work_counts.rs index 491c1b715..18528647b 100644 --- a/crates/metal2vulkan-runtime/src/work_counts.rs +++ b/crates/metal2vulkan-runtime/src/work_counts.rs @@ -5075,8 +5075,10 @@ pub struct WorkCounts { pub plain_buffer_blocks_made: u64, /// The buffers of the runtime's own and the program's made so far in a plain block, not one /// allocated exportable, on a device that allocates such blocks, while the device's in-place - /// check of them was pending (`in_place.rs`'s `Device::fd_blocks_checked`): its first run on a - /// driver, before the check's record holds its verdicts. 0 once they are known. A buffer that + /// check of them was pending (`in_place.rs`'s `Device::fd_blocks_checked`): on its first run + /// on a driver, before the check's record holds its verdicts, until a check a texture over + /// host pages or `Device::settle_in_place_checks` started answered (a buffer's making starts + /// none). 0 once they are known. A buffer that /// declares its padding unobserved lies in a plain block wherever, and is not counted. pub fd_blocks_awaited: u64, /// As `fd_blocks_awaited`, once the device's check of such blocks found a texture over one's diff --git a/docs/FAST-PATHS.md b/docs/FAST-PATHS.md index 33ee408bf..38d3ace8d 100644 --- a/docs/FAST-PATHS.md +++ b/docs/FAST-PATHS.md @@ -1020,7 +1020,9 @@ driver's. Each is open work. policy takes textures in place by its check and that check of such blocks gave every texture over one what it takes over a plain block's buffer (`in_place::fd_blocks_take`, `texture/fd_blocks_cover.rs`, the in-place row above; plain blocks until it answered, - `WorkCounts::fd_blocks_awaited`): on a Radeon 780M (RADV PHOENIX, Mesa + `WorkCounts::fd_blocks_awaited`, the verdicts from the check's record or from a check a texture + over host pages or `Device::settle_in_place_checks` started, a buffer's making starting none): + on a Radeon 780M (RADV PHOENIX, Mesa 26.2.4) a plain block's `vkAllocateMemory` holds every submission of the process while the kernel fills its pages, under the reservation the process's buffer objects share, and an exportable block, a buffer object of its own reservation, holds none. With a 64 MiB block of @@ -1033,11 +1035,9 @@ driver's. Each is open work. its pools growing by 64 MiB blocks made ahead; two runs each), the base took 13 and 12 turnarounds of 8 ms or more on the quiet host and 103 and 17 on the fragmented one (19 and 4 of 17 ms or more, the slowest 40.4 and 49.0 ms, the scheduler's thread waiting 350 and 311 ms on - the kernel's lock); with the blocks exportable, none on the fragmented host (the slowest 5.9 - and 6.0 ms, 21 and 24 ms waited) and one each on the quiet one, where 3 blocks were made plain - while the device's first check was pending (446 and 447 buffers awaited it); with the check's - verdicts known first, as from its record, none in either phase (the slowest 7.1 ms, 4 and 10 - ms waited). In the arm whose 64 `Private` buffers of 32 MiB were made + the kernel's lock); with the check's verdicts known first, as from its record, the blocks + exportable and none in either phase (the slowest 7.1 ms, 4 and 10 ms waited). Until the + verdicts are known the blocks are plain, as the base's. In the arm whose 64 `Private` buffers of 32 MiB were made before the phases, in plain blocks, the first turnaround took 57.0 ms and none after it 1.4 ms; with 64 exportable blocks held, the first took 2.4 to 8.1 ms. The trade: each such block held costs every