diff --git a/crates/metal2vulkan-runtime/src/copied.rs b/crates/metal2vulkan-runtime/src/copied.rs index d17ce7c11..fe7b067eb 100644 --- a/crates/metal2vulkan-runtime/src/copied.rs +++ b/crates/metal2vulkan-runtime/src/copied.rs @@ -150,7 +150,7 @@ //! read addresses may write every copy. Without a base, a page that agrees costs one read of each //! side and a slice comparison; with one, a block that agrees costs one read of one side and its //! tag (SSE2 on x86-64, about 55 GB/s over a block in the first-level cache on a Ryzen 7 7840HS). -//! A comparison of at least twice `SPLIT_BYTES` (8 MiB) of a copy, with a base or without (a +//! A comparison of at least twice `SPLIT_BYTES` (2 MiB) of a copy, with a base or without (a //! commit's copy in of every byte of a copy the GPU only reads, whose pages carry no log), splits //! its blocks into runs of at least that many, one for each of up to four threads, the calling //! one among them: it starts at most three, each with a 256 KiB stack, and they end before it @@ -1771,7 +1771,7 @@ const SPLIT_THREADS: usize = 4; /// The fewest bytes of a copy each thread of a split comparison takes ([`split`], /// [`copy_in_untagged`]): fewer than twice as many are compared on the calling thread alone. -pub(crate) const SPLIT_BYTES: usize = 8 << 20; +pub(crate) const SPLIT_BYTES: usize = 2 << 20; /// The stack of each thread a split comparison starts ([`in_threads`]): a run's two blocks and /// its calls' frames. diff --git a/docs/API.md b/docs/API.md index 3cf944289..3d52f02dc 100644 --- a/docs/API.md +++ b/docs/API.md @@ -3436,9 +3436,9 @@ bound. (`copied_base_blocks_read_back`), then kept in 1 KiB of host memory for the base's life (`copied_base_host_blocks`); a block whose tag agrees is taken as unchanged, a changed one missed with a chance of at most 2^-64 at each comparison, and a commit that finds no host memory - for a base fails with `OutOfMemory` (`copied_bases_refused`). A comparison of a copy with a base - of 16 MiB or more splits its blocks across up to four threads, the calling one among them - (`copied_compare_threads`). An event signal submitted while a copy is live is seen once its + for a base fails with `OutOfMemory` (`copied_bases_refused`). A comparison of 4 MiB or more of a + copy, with a base or without, splits its blocks across up to four threads, the calling one among + them (`copied_compare_threads`). An event signal submitted while a copy is live is seen once its batch's writes are back in the pages, as Metal's: its value at the completion turn, and a wait for it held on the host until then (`event_signals_behind_merge`). A copy and another memory over overlapping but not the same bytes agree GPU to GPU only through the diff --git a/docs/FAST-PATHS.md b/docs/FAST-PATHS.md index d91d2fc91..d573608d4 100644 --- a/docs/FAST-PATHS.md +++ b/docs/FAST-PATHS.md @@ -608,10 +608,10 @@ driver's. Each is open work. (`command_buffer/copies_again.rs`, `copied_copy_ins_after_waits`; none for a command buffer without such a wait): until a command buffer that may write the copy is committed, a commit compares the pages with the copy a page at a - time; from then on each comparison reads one side whole (the pages at a commit, the copy at a - completion) and compares each 1 KiB block's tag with its base's (below), reading the other side's - block only where the tag changed, on up to four threads for a copy of 16 MiB or more - (`copied_compare_threads`). On a Ryzen 7 7840HS (the RTX 3090's and RTX 2080's hosts) a 256 MiB + time, and a page that differs takes the pages' whole; from then on each comparison reads one side + whole (the pages at a commit, the copy at a completion) and compares each 1 KiB block's tag with + its base's (below), reading the other side's block only where the tag changed; either on up to + four threads for 4 MiB or more (`copied_compare_threads`). On a Ryzen 7 7840HS (the RTX 3090's and RTX 2080's hosts) a 256 MiB copy that agrees takes 5.8-6.1 ms each way, 5.8-6.5 ms where 1% of its pages changed on one side or both, and 25.7-26.4 ms in and 25.9-27.3 ms back where every byte changed on both sides (the byte-for-byte snapshot this replaced, interleaved with them: 14.4-15.8, 15.0-16.4, 143-152 ms in diff --git a/docs/HOWTO.md b/docs/HOWTO.md index 1d9baf87c..926d16ffb 100644 --- a/docs/HOWTO.md +++ b/docs/HOWTO.md @@ -565,8 +565,9 @@ the base's life, so a block both sides write at every frame crosses the bus once one copy into host memory on the device's staging queue, which waits for no work of the program's (`copied_base_blocks_read_back`); a base lies in the device's memory only on a device with one. A block whose tag agrees is taken as unchanged: a changed block is missed with a chance of at most -2^-64 at each comparison. A comparison of a copy with a base of 16 MiB or more splits its blocks -across up to four threads, the calling one among them, which end before it returns +2^-64 at each comparison. A comparison of 4 MiB or more of a copy, with a base or without (a +commit's copy in of a copy the GPU only reads, whose pages carry no log), splits its blocks across +up to four threads, the calling one among them, which end before it returns (`copied_compare_threads`). A commit that finds no host memory for a base fails with `Error::OutOfMemory` and runs nothing (`copied_bases_refused`); the copy keeps none, and a later commit makes it. An event signal