diff --git a/AGENTS.md b/AGENTS.md index 8919169f9..334e065c9 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -62,7 +62,9 @@ order, and a lower one never overrides a higher one. atomics, 64-bit floats, SIMD groups (the subgroup size range with its stages and operations, and maximal reconvergence), unified memory (decided by Vulkan's physical device type alone: one copy of a Managed buffer on an integrated or CPU - device, two elsewhere), the attachment feedback loop (a device without it reads a render + device, two elsewhere, and a texture over a host-pointer import in place on an integrated or + CPU device, after one counted copy pair at its first use, and through its per-use counted copy + elsewhere), the attachment feedback loop (a device without it reads a render target through a counted copy of that target, recorded as a known gap), run-time texel offsets (a device with the maintenance8 feature takes a run-time texel offset as the sampling or read instruction's own operand; a device without it branches over the offset's values, and @@ -109,10 +111,11 @@ order, and a lower one never overrides a higher one. rule 2's query takes them), nothing copied that Metal would not copy. Optimal images have two exceptions. A texture over a Shared buffer: a linear image on that buffer's memory, in the device's own layout, created so its first use keeps the bytes, and where that memory is a - host-pointer import, whose images must start undefined, a counted copy pair once at the - texture's first use restores the bytes, with the alignment the guest reads from Metal's minimum - linear texture alignment, and where a format query offers no linear image for the format and - usage, a counted copy at commit. A plane texture of an exported + host-pointer import on an integrated or CPU device (rule 2's unified memory), whose images + must start undefined, a counted copy pair once at the texture's first use restores the bytes, + with the alignment the guest reads from Metal's minimum linear texture alignment, and where a + format query offers no linear image for the format and usage, a counted copy at commit. A + plane texture of an exported surface: a linear image on the surface's own exported memory, at the pitch and plane starts the surface's export states, and where the device offers no such image or cannot meet the layout the consumer asked for, the copy form of the same call, counted and recorded as a known gap. diff --git a/crates/metal2vulkan-runtime/README.md b/crates/metal2vulkan-runtime/README.md index e48dba778..e05565eb8 100644 --- a/crates/metal2vulkan-runtime/README.md +++ b/crates/metal2vulkan-runtime/README.md @@ -843,40 +843,43 @@ another resource which aliases memory that is bound to" it. From then on, the im general layout, a host-accessible alias of the buffer, as in place over a Shared block. A second texture over the same bytes acquires them again at its own move home. -A texture over a buffer in host memory's import (`import_host_memory`) is in place too, where the -external image query for host memory's handle -(`VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT`, of the linear tiling, format, usage -and flags) answers it importable, compatible and not dedicated-only at the texture's extent, and -the image meets the layout, alignment and feature tests of any texture over a buffer in place. -Its image is the device's linear image made for that handle, bound in the import's memory at the -texture's place, in the import's memory type. Vulkan's rule for such an image is two sentences: -an image bound in imported memory names the import's handle type when it is made +A texture over a buffer in host memory's import (`import_host_memory`) is in place too on an +integrated or CPU device (`Device::has_unified_memory`, Vulkan's device type), where the external +image query for host memory's handle (`VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT`, of +the linear tiling, format, usage and flags) answers it importable, compatible and not dedicated-only +at the texture's extent, and the image meets the layout, alignment and feature tests of any texture +over a buffer in place. Its image is the device's linear image made for that handle, bound in the +import's memory at the texture's place, in the import's memory type. Vulkan's rule for such an image +is two sentences: an image bound in imported memory names the import's handle type when it is made (`VUID-vkBindImageMemory-memory-02989`), and an image made with a handle type starts in the undefined layout (`VUID-VkImageCreateInfo-pNext-01443`). A move out of the undefined layout may -discard the bytes ("If the old layout is VK_IMAGE_LAYOUT_UNDEFINED, the contents of that range -may be discarded", section 7.1.1), and host memory has no other side whose release an acquire -could match ("Importing memory from a host pointer shares ownership of the memory between the -host and the Vulkan implementation", section 11.2.6). So the image's one move home goes between a -copy of the bytes bound under it into a Private block of the runtime's and a copy of them back, -all in the upload ahead of the first command buffer submitted after the texture's making, from -any queue: a barrier from every earlier command's writes (earlier submissions on the runtime's -one queue among them) to the save, the save, the move in a barrier that waits for the save's -reads, the write-back, and a barrier from it to every later command and the host. Nothing of the -consumer's runs between the save and the write-back. The bytes the host wrote before the commit, -and those the commands submitted before it wrote, are what the image holds after it (the save -runs on the GPU after the submission, section 7.9). The two copies count in -`Metrics::over_copies_host_memory`, each of the bytes bound under the image (and in -`over_copies`, `over_copies_imported` and `bytes_copied`), the block goes back once the upload -retires, and the texture counts in `Metrics::textures_in_place_over_imports` at its making. From -then on the image stays in the general layout, a host-accessible alias of the buffer (section -12.11): a later use copies nothing, and the host and the device see each other's writes through -it as through the buffer. While that upload runs, a host write to those bytes may be lost and a -host read of them may see them undefined (Known gaps of memory blocks). +discard the bytes ("If the old layout is VK_IMAGE_LAYOUT_UNDEFINED, the contents of that range may +be discarded", section 7.1.1), and host memory has no other side whose release an acquire could +match ("Importing memory from a host pointer shares ownership of the memory between the host and the +Vulkan implementation", section 11.2.6). So the image's one move home goes between a copy of the +bytes bound under it into a Private block of the runtime's and a copy of them back, all in the +upload ahead of the first command buffer submitted after the texture's making, from any queue: a +barrier from every earlier command's writes (earlier submissions on the runtime's one queue among +them) to the save, the save, the move in a barrier that waits for the save's reads, the write-back, +and a barrier from it to every later command and the host. Nothing of the consumer's runs between +the save and the write-back. The bytes the host wrote before the commit, and those the commands +submitted before it wrote, are what the image holds after it (the save runs on the GPU after the +submission, section 7.9). The two copies count in `Metrics::over_copies_host_memory`, each of the +bytes bound under the image (and in `over_copies`, `over_copies_imported` and `bytes_copied`), the +block goes back once the upload retires, and the texture counts in +`Metrics::textures_in_place_over_imports` at its making. From then on the image stays in the general +layout, a host-accessible alias of the buffer (section 12.11): a later use copies nothing, and the +host and the device see each other's writes through it as through the buffer. While that upload +runs, a host write to those bytes may be lost and a host read of them may see them undefined (Known +gaps of memory blocks). On a discrete or virtual device the texture is the counted copy below, since +its shaders would read the host's memory across the device's link at each use, slower there than the +copy (Known gaps of memory blocks). Anything else is the counted copy of a texture over a buffer: an image of its own, which the device copies the buffer's bytes into before the submissions that use it and back after a command writes it (`Metrics::over_copies`, `Metrics::over_copies_imported`). That covers a -texture over several dma-bufs, or where a query does not take it (Known gaps of memory blocks). +texture over several dma-bufs, a texture over host memory's import on a discrete or virtual +device, or where a query does not take it (Known gaps of memory blocks). In every form the buffer stays the import itself. ### Exported blocks @@ -1444,26 +1447,47 @@ exported block, an exported surface in either form, and a Direct3D 11 import. arguments) or of the index size (indexed draws), which documented Metal does not allow, its pointer being page-aligned. The consumer places every other buffer at an aligned byte. Such a buffer is still made and its other uses run; only the dispatch or draw is refused. -- A texture over a buffer in host memory's import (`Device::import_host_memory`) in place - (Imported blocks) costs one pair of counted copies in its life, where Metal copies nothing: the - save and the write-back of the bytes bound under its image around its move out of the undefined - layout, the layout Vulkan makes such an image start in (`VUID-vkBindImageMemory-memory-02989`, - `VUID-VkImageCreateInfo-pNext-01443`) and lets that move discard the bytes. While the upload that - carries the pair runs, a host write to those bytes may be lost, which races the guest's own use - of the texture, as Metal leaves it; and a host read of them may see them undefined, where Metal - would answer the bytes. Where the device's external image query offers no linear image of the - texture's format and usage for host memory's handle, the texture stays the counted copy at each - use (`Metrics::over_copies_host_memory`), its bytes copied into an image of its own before the - submissions that use it and back after a command writes it. Asked of lavapipe, RADV and ANV of - Mesa 26.2.6, NVIDIA's 620.70.06 and Mesa 26.3.1's Mac driver over 13 colour formats, read, - written and rendered, the query offers host memory's handle a linear image of every format and - usage it offers one of without a handle. So that copy stays where the linear tiling offers no - image of the format and usage at all, as over a Shared block, and on the Mac driver (KosmicKrisp) - for every texture with render-target usage, since it makes no linear colour attachment with or - without a handle. Those pages are the Mac and Windows hosts' imports by address and, on Linux, - pages not imported as a dma-buf (on the RTX 3090, all of them; on the Iris Xe, those one dma-buf - cannot hold, Imported blocks). Documented Metal asks for no call before a CPU write to a Shared - buffer reaches a texture over it, so the runtime has no call to hold a copy for. +- A texture over a buffer in host memory's import (`Device::import_host_memory`) is in place on + an integrated or CPU device alone (`Device::has_unified_memory`, Vulkan's device type, the query + that keeps one copy of a Managed buffer), and on a discrete or virtual device the counted copy at + each use (`Metrics::over_copies_host_memory`), its bytes copied into an image of its own before + the submissions that use it and back after a command writes it, where Metal copies nothing. In + place (Imported blocks) it costs one pair of counted copies in its life, where Metal copies + nothing: the save and the write-back of the bytes bound under its image around its move out of + the undefined layout, the layout Vulkan makes such an image start in + (`VUID-vkBindImageMemory-memory-02989`, `VUID-VkImageCreateInfo-pNext-01443`) and lets that move + discard the bytes. While the upload that carries the pair runs, a host write to those bytes may + be lost, which races the guest's own use of the texture, as Metal leaves it; and a host read of + them may see them undefined, where Metal would answer the bytes. In place, every read of the + texture is a read of a linear image, as of any texture over a Shared buffer in place, where the + copy's image is optimal. The device type chooses because of what a frame costs each way. Measured + with a 1920 by 1080 RGBA8Unorm texture over host memory that the CPU writes whole each frame + and a 1080p pass of 1 or 4 draws that read its every texel, the per-use copy against in place, in + microseconds a frame (median of six alternating runs of 300 frames each): + - Apple M3 Max, integrated (KosmicKrisp 26.3.1, job m3-max-81356): 1016 against 843 at one + draw, 1043 against 888 at four (in place 0.829 and 0.852 of the copy). + - Intel Iris Xe (RPL-P), integrated (ANV, Mesa 26.2.6, job m3-max-81425): 3069 against 2630 at + one draw, 4810 against 5381 at four. A full 1080p read of the linear image costs about 360 + more than a read of the copy's optimal image, and the copy it replaces about 480 to 500 a + frame, so in place costs more from about two full reads a frame. + - AMD Radeon RX 7900 XTX, discrete on OCuLink (RADV, Mesa 26.2.6, job m3-max-81416): 1602 + against 1561 at one draw, 1743 against 1579 at four, within the runs' spread: its shaders read + host memory in place at the copy's own rate, about 6.7 GB/s. + - NVIDIA RTX 3090, discrete behind Thunderbolt (620.70.06, job m3-max-81379): 5219 against + 12522 at one draw, 5291 against 12564 at four: its copy moves the bytes at about 1.98 GB/s + and its shaders read them in place at about 0.72 GB/s. + Where the device's external image query offers no linear image of the texture's format and + usage for host memory's handle, the texture is the counted copy at each use on any device. + Asked of lavapipe, RADV and ANV of Mesa 26.2.6, NVIDIA's 620.70.06 and Mesa 26.3.1's Mac driver + over 13 colour formats, read, written and rendered, the query offers host memory's handle a + linear image of every format and usage it offers one of without a handle. So that copy stays + where the linear tiling offers no image of the format and usage at all, as over a Shared block, + and on the Mac driver (KosmicKrisp) for every texture with render-target usage, since it makes + no linear colour attachment with or without a handle. Those pages are the Mac and Windows hosts' + imports by address and, on Linux, pages not imported as a dma-buf (on the RTX 3090, all of them; + on the Iris Xe, those one dma-buf cannot hold, Imported blocks). Documented Metal asks for no + call before a CPU write to a Shared buffer reaches a texture over it, so the runtime has no call + to hold a copy for. - A texture over a buffer in a dma-buf's one import is the counted copy too on a device that offers no linear image for a dma-buf import without a dedicated allocation (Imported blocks). On the Radeon 780M (RADV) the external image query refuses the dma-buf handle with linear diff --git a/crates/metal2vulkan-runtime/src/counters.rs b/crates/metal2vulkan-runtime/src/counters.rs index d05c91e98..7f02f0dab 100644 --- a/crates/metal2vulkan-runtime/src/counters.rs +++ b/crates/metal2vulkan-runtime/src/counters.rs @@ -655,9 +655,11 @@ const SITES: usize = Site::PrivateArena as usize + 1; #[non_exhaustive] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum OverCause { - /// The buffer's bytes are in host memory's import, and the device's external image query - /// offers no linear image of the texture's format and usage for its handle; also the cause - /// of the save and write-back of a texture in place there ([`Metrics::over_copies_host_memory`]). + /// The buffer's bytes are in host memory's import, and the device is discrete or virtual + /// ([`Device::has_unified_memory`](crate::Device::has_unified_memory) false) or its external + /// image query offers no linear image of the texture's format and usage for its handle; also + /// the cause of the save and write-back of a texture in place there + /// ([`Metrics::over_copies_host_memory`]). HostMemory, /// A dma-buf's one import that takes no image here ([`Metrics::over_copies_dma_buf`]). DmaBuf, @@ -3194,12 +3196,15 @@ pub struct Metrics { /// imported block's among them; the rest are over a Managed buffer's device copy. pub over_copy_bytes_shared: u64, /// Of [`over_copies`](Self::over_copies), those of a texture over a buffer in host memory's - /// import ([`Device::import_host_memory`](crate::Device::import_host_memory)). In place, two in - /// the texture's life: an image made for that memory starts undefined, and its move from there - /// may discard the bytes, so the move comes between a save of the bytes under it and their - /// write-back ([`textures_in_place_over_imports`](Self::textures_in_place_over_imports)). - /// Where the device's external image query offers no linear image of the texture's format and - /// usage for host memory's handle, the texture's copies in and back at its uses. + /// import ([`Device::import_host_memory`](crate::Device::import_host_memory)). In place, on an + /// integrated or CPU device + /// ([`Device::has_unified_memory`](crate::Device::has_unified_memory)), two in the texture's + /// life: an image made for that memory starts undefined, and its move from there may discard + /// the bytes, so the move comes between a save of the bytes under it and their write-back + /// ([`textures_in_place_over_imports`](Self::textures_in_place_over_imports)). On a discrete + /// or virtual device, and where the device's external image query offers no linear image of + /// the texture's format and usage for host memory's handle, the texture's copies in and back + /// at its uses. pub over_copies_host_memory: u64, /// The bytes of those copies, which count in [`over_copy_bytes`](Self::over_copy_bytes) too. pub over_copy_bytes_host_memory: u64, @@ -3417,8 +3422,9 @@ pub struct Metrics { /// counted at its making ([`Buffer::new_texture`](crate::Buffer::new_texture)): over a /// dma-buf's one import (`Device::import_dma_buf`, on Unix), whose move home is an acquire /// ([`external_acquires`](Self::external_acquires)), and over host memory's import - /// ([`Device::import_host_memory`](crate::Device::import_host_memory)), whose move home is - /// between a save of the bytes under it and their write-back, two copies in + /// ([`Device::import_host_memory`](crate::Device::import_host_memory)) on an integrated or CPU + /// device, whose move home is between a save of the bytes under it and their write-back, two + /// copies in /// [`over_copies_host_memory`](Self::over_copies_host_memory). No Metal counterpart: Metal's /// texture over a no-copy buffer is its bytes, with no move. pub textures_in_place_over_imports: u64, diff --git a/crates/metal2vulkan-runtime/src/tests/host_in_place.rs b/crates/metal2vulkan-runtime/src/tests/host_in_place.rs index 0a2de8099..610acf19d 100644 --- a/crates/metal2vulkan-runtime/src/tests/host_in_place.rs +++ b/crates/metal2vulkan-runtime/src/tests/host_in_place.rs @@ -1,9 +1,10 @@ //! A texture over a buffer in host memory's import (`Device::import_host_memory`), under a device //! cfg, on every device of the cfg's kind that imports host memory: an RGBA8Unorm texture of 16 by -//! 4 texels at the device's linear pitch, over a buffer that spans the import. Where the device's -//! external image query offers its linear image for host memory's handle (on lavapipe, every -//! image: Mesa's `lvp_formats.c` answers that handle importable), the texture is in place: its -//! image is bound in the import's own memory, made undefined, as an image for imported memory is +//! 4 texels at the device's linear pitch, over a buffer that spans the import. Where the device is +//! integrated or CPU (`Device::has_unified_memory`, rule 2's query) and its external image query +//! offers its linear image for host memory's handle (on lavapipe, every image: Mesa's +//! `lvp_formats.c` answers that handle importable), the texture is in place: its image is bound in +//! the import's own memory, made undefined, as an image for imported memory is //! (`VUID-VkImageCreateInfo-pNext-01443`), and moved to the general layout once, in the upload //! ahead of the first command buffer submitted after its making, between a save of the bytes under //! it and their write-back: one pair of counted copies (`Metrics::over_copies_host_memory`), no @@ -20,8 +21,9 @@ //! //! No command names the image in the preinitialized layout, and its move home comes before any //! command that names it. The texture counts once in `Metrics::textures_in_place_over_imports`, at -//! its making. Where the query offers no such image, the texture is the counted copy, printed, -//! counted there not at all, and the same reads hold. +//! its making. Elsewhere, the texture is the counted copy, printed, counted there not at all, and +//! the same reads hold. A second test runs each device in both forms and checks that the device +//! type alone chooses. #[cfg(any(m2v_gpu, m2v_cpu_icd))] mod on_device { diff --git a/crates/metal2vulkan-runtime/src/tests/import.rs b/crates/metal2vulkan-runtime/src/tests/import.rs index 5550df686..5e7ba0135 100644 --- a/crates/metal2vulkan-runtime/src/tests/import.rs +++ b/crates/metal2vulkan-runtime/src/tests/import.rs @@ -696,12 +696,12 @@ pub(crate) mod on_device { /// A texture over a buffer in an imported block of host memory, read and written by shaders: a /// blit's read of it into a Shared buffer finds the host's rows, and a blit's write to it - /// reaches the host's memory. In place where the device's external image query offers its - /// linear image for host memory's handle (on lavapipe), its move home's save and write-back - /// are the two copies counted, both in the first command buffer, and the write copies - /// nothing; else it is the counted copy, its copies between the buffer and its image each its - /// texels' bytes. Either way each copy counts in `Metrics::over_copies` and, being over an - /// imported block, in `Metrics::over_copies_imported`. + /// reaches the host's memory. In place on an integrated or CPU device where its external image + /// query offers its linear image for host memory's handle (on lavapipe), its move home's save + /// and write-back are the two copies counted, both in the first command buffer, and the write + /// copies nothing; else it is the counted copy, its copies between the buffer and its image + /// each its texels' bytes. Either way each copy counts in `Metrics::over_copies` and, being + /// over an imported block, in `Metrics::over_copies_imported`. #[test] fn every_device_makes_a_texture_over_an_imported_buffer() { each_device("import_texture", |name, _, device| { diff --git a/crates/metal2vulkan-runtime/src/tests/imported_aliases.rs b/crates/metal2vulkan-runtime/src/tests/imported_aliases.rs index cdf692461..deac0c990 100644 --- a/crates/metal2vulkan-runtime/src/tests/imported_aliases.rs +++ b/crates/metal2vulkan-runtime/src/tests/imported_aliases.rs @@ -1,12 +1,11 @@ //! Two textures over the same bytes of host memory's import, as a drawer and a compositor hold a //! shared surface: T1, a render target shaders also read, and T2, a texture shaders read, made //! second and first, over one buffer, and apart, each over a buffer of its own over the same bytes -//! of the import; each in place where the device's external image query offers its linear image -//! for host memory's handle, its move home between a save of the bytes under it and their -//! write-back, else in an image of its own, the form printed. Under a device cfg, on every device -//! of the cfg's kind that imports host memory, in -//! BGRA8Unorm and then in RGBA16Float, 32 by 16 texels at 256-byte rows. Three command buffers, each -//! read exact: +//! of the import; each in place on an integrated or CPU device where its external image query +//! offers its linear image for host memory's handle, its move home between a save of the bytes +//! under it and their write-back, else in an image of its own, the form printed. Under a device +//! cfg, on every device of the cfg's kind that imports host memory, in BGRA8Unorm and then in +//! RGBA16Float, 32 by 16 texels at 256-byte rows. Three command buffers, each read exact: //! //! - the CPU writes the pages, T1 unused, and a kernel reads T2: the CPU's texels; //! - the CPU writes the pages again, and a kernel reads T2: the new texels; diff --git a/crates/metal2vulkan-runtime/src/tests/over_causes.rs b/crates/metal2vulkan-runtime/src/tests/over_causes.rs index 1112ba9a3..2647d790f 100644 --- a/crates/metal2vulkan-runtime/src/tests/over_causes.rs +++ b/crates/metal2vulkan-runtime/src/tests/over_causes.rs @@ -11,9 +11,9 @@ //! texels' bytes, its cause's pair and its buffer's memory class's bytes alike, every other //! cause's pair and the other class's bytes still; one in place moves nothing. On lavapipe each is //! copied for the cause it was made for: pitch (twice), alignment and render reach. The one over -//! host memory's import is in place there, where the external image query offers its linear -//! image: its move home's save and write-back, carried by a command buffer ahead of its read, move -//! host memory's pair by two copies and no other. +//! host memory's import is in place there, a CPU device whose external image query offers its +//! linear image: its move home's save and write-back, carried by a command buffer ahead of its +//! read, move host memory's pair by two copies and no other. //! lavapipe's linear tiling has its optimal tiling's features for every color format (Mesa's //! `lvp_formats.c`), so no texture here is copied for a format or usage. diff --git a/crates/metal2vulkan-runtime/src/texture.rs b/crates/metal2vulkan-runtime/src/texture.rs index 74da06761..9a00371a7 100644 --- a/crates/metal2vulkan-runtime/src/texture.rs +++ b/crates/metal2vulkan-runtime/src/texture.rs @@ -2649,11 +2649,15 @@ fn check_over( // import, in place: the move home acquires the bytes from the foreign queue family, which // Vulkan's external resource sharing keeps ("To make the contents of the underlying memory // accessible in the destination instance or API, applications must ... Acquire exclusive - // ownership"). Over host memory, in place too, restored: Vulkan shares that memory's ownership + // ownership"). Over host memory, in place too on an integrated or CPU device (rule 2's + // unified-memory query, Vulkan's device type), restored: Vulkan shares that memory's ownership // with the host ("Importing memory from a host pointer shares ownership of the memory between // the host and the Vulkan implementation"), whose accesses are host accesses, never a release // that an acquire could match, so the move home comes between a save of the bytes and their - // write-back, one counted pair in the texture's life (`Image::homing`). Over several dma-bufs, + // write-back, one counted pair in the texture's life (`Image::homing`). On a discrete or + // virtual device, the copy at each use: its shaders would read the host's memory across the + // device's link at each use, slower than the copy (the crate's README, known gaps of memory + // blocks). Over several dma-bufs, // the copy: the block's buffer is sparse, bound to many imports. Over an exported block, the // copy too: its memory is dedicated to its buffer, and no image is bound in it // (VUID-vkBindImageMemory-memory-10926). @@ -2672,7 +2676,7 @@ fn check_over( handle: ImportHandle::HostMemory, memory_type, }), - ) => Laid::HostMemory { memory_type }, + ) if core.unified_memory() => Laid::HostMemory { memory_type }, (None, Some(own)) => return Ok(Err(memory_cause(own))), }; let spilled = copy.is_none() && block.memory.spilled(); @@ -2740,8 +2744,8 @@ fn check_over( fn memory_cause(own: Own) -> OverCause { match own { Own::Import { handle, .. } => match handle { - // Unreached: host memory's import is in place, or names this cause where its external - // query offers no linear image (`check_over`). + // On a discrete or virtual device: in place only on an integrated or CPU one + // (`check_over`). ImportHandle::HostMemory => OverCause::HostMemory, // On a device without the foreign queue family. ImportHandle::DmaBuf => OverCause::DmaBuf, @@ -6772,9 +6776,10 @@ impl Buffer { /// under it, in one barrier, which keeps the bytes (Vulkan's external resource sharing), /// counted in [`Metrics::external_acquires`](crate::Metrics::external_acquires). /// - /// Over a buffer in host memory's import ([`Device::import_host_memory`]), the image is so - /// where the device's external image query takes a linear image made for host memory's - /// handle (importable, compatible and not dedicated-only): made undefined, as Vulkan requires + /// Over a buffer in host memory's import ([`Device::import_host_memory`]), the image is so on + /// an integrated or CPU device ([`Device::has_unified_memory`]) where the device's external + /// image query takes a linear image made for host memory's handle (importable, compatible and + /// not dedicated-only): made undefined, as Vulkan requires /// of an image for imported memory, and moved home once, in the upload ahead of the first /// command buffer submitted after the making, from any queue, between a copy of the bytes /// under it into a block of the runtime's and a copy of them back, since Vulkan lets a move @@ -6788,7 +6793,9 @@ impl Buffer { /// Where the device's linear image does not take the texture (another pitch, an offset off /// its memory alignment, a format or usage its linear tiling lacks, memory that spilled, a /// render target whose advertised subresource passes its rows or the buffer, an import the - /// external query does not take, a dma-buf's on a device without the foreign queue family), + /// external query does not take, a dma-buf's on a device without the foreign queue family, + /// host memory's on a discrete or virtual device, whose shaders would read it across the + /// device's link at each use), /// over a buffer in an import over several dma-bufs /// (`Device::import_dma_bufs` on Unix, whose buffer is sparse), and over a buffer in an /// exported block ([`Device::new_exported_block`], whose memory is dedicated to its buffer), the diff --git a/docs/REPLAY-STREAM.md b/docs/REPLAY-STREAM.md index 7dc25c629..af62f06bf 100644 --- a/docs/REPLAY-STREAM.md +++ b/docs/REPLAY-STREAM.md @@ -643,9 +643,9 @@ contract (below) where the surface is made, and each check matches where the sta buffer stops the play with a refusal that says so. A texture over an imported buffer is in place where the runtime's linear image takes it, each - frame's `textures_in_place_over_imports` counting those made, a host-memory import's with one - save and write-back pair at its first submission in `over_copies_host_memory`; else it is the - runtime's counted copy. Each frame's `over_copies` and + frame's `textures_in_place_over_imports` counting those made, a host-memory import's (on an + integrated or CPU device alone) with one save and write-back pair at its first submission in + `over_copies_host_memory`; else it is the runtime's counted copy. Each frame's `over_copies` and `over_copy_bytes` count every copy of a texture over a buffer, and its `over_copies_imported` and `over_copy_bytes_imported` those over an imported one alone; the rest are over the runtime's own blocks, where the device's linear image does not take the texture. `over_copies_host_memory`,