From 47fb2942e519fd882bd0641cc186e333d5bbb82a Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Fri, 13 Nov 2026 07:58:34 -0800 Subject: [PATCH] FAST-PATHS: on NVIDIA a no-copy object across two imported guest RAM chunks is a copy What: a known-gaps entry for the copied-host-pages copy of a no-copy object whose pages cross the end of a guest RAM's chunk with both chunks imported (CopiedBecause::OverRamChunk). The consumer's boot makes one on the RTX 2080 and the RTX 3090: a 2 MiB Shared heap 0xde000 bytes before a 64 MiB chunk's end. It names why only NVIDIA meets it and why no in-place form exists there. Why only NVIDIA: the plan, not alignment. NVIDIA's held pointer imports cost a submission nothing, so its plan is Plan::AHEAD: the device's thread imports the RAM's chunks by pointer before the objects over them exist, and a straddling object finds both imported. RADV and ANV take the listed plan (the consumer's RAM has a dma-buf source and each held import costs every submission there): a chunk is imported only for a copy over it, and an object over chunks no copy imported takes its own import. Routes judged: - Sparse binding over both chunks' imports: VUID-VkSparseMemoryBind-memory-01096 needs a memory type the sparse buffer takes; on the RTX 2080 (620.70.06) that is type 1 alone (device-local, 64 KiB alignment), every usage, with the host handle type or without, where host pointers import as types 3 and 4 (system memory). The intersection is empty. - A plain buffer binds one memory, its whole size inside it (VUID-vkBindBufferMemory-buffer-07459, -None-10741). - Chunk ends that follow objects: each chunk is imported before the objects over it and binds others by the time a straddling one comes; no cut or extension puts the object in one memory without a page imported twice. - An own import beside the chunks: of the pointer, a second import of the same pages (VK_EXT_external_memory_host issue 6); of dma-bufs, an alias of a pointer import Vulkan does not define (the beside route exists only for dma-bufs beside dma-bufs on the listed plan). - The Managed route's GPU copy in (003dc10fee) rests on Managed's explicit synchronization; a Shared copy's coherence is the three-way merge at every commit and completion, which a GPU form would run over the host pages at each batch's start and end. Verified on the RTX 2080 (620.70.06, um790, potluck m3-max-25500, at 65ca5fc387): tests::sparse_host_pages printed the types above ("the intersection is empty: no bind"); host_ram_device's a_heap_across_two_imported_chunks_is_a_copy_and_imports_nothing passed, its copied-host-pages notice naming the chunk cause. Docs only; no code changed. --- docs/FAST-PATHS.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/FAST-PATHS.md b/docs/FAST-PATHS.md index 1c3802794..558db4194 100644 --- a/docs/FAST-PATHS.md +++ b/docs/FAST-PATHS.md @@ -740,6 +740,24 @@ driver's. Each is open work. on the RTX 3090 (620.70.06) that check makes no image of its own, its verdicts unchecked, so an `RGBA8Unorm` 38x8 render target at rows 256 bytes apart over either is a shadow there, where one that only reads is the driver's linear image in place. +- **On NVIDIA, a no-copy object across a guest RAM's chunk end, both chunks imported, is a copy** + (`copied-host-pages`, `CopiedBecause::OverRamChunk`, `host_ram.rs`), which costs what any + copied host buffer costs (below). The consumer's guest boot makes one on the RTX 2080 and the + RTX 3090: a 2 MiB `Shared` heap 0xde000 bytes before a 64 MiB chunk's end. A device whose held + pointer imports cost a submission nothing (NVIDIA's) imports the RAM's chunks by their pointers + ahead of the objects (`Plan::AHEAD`), so both chunks' imports hold such an object's pages when + it is made. An import of its own pointer would import those pages again, which + `VK_EXT_external_memory_host` leaves undefined (its issue 6), and Vulkan defines no alias between + a host pointer's import and a dma-buf of the same pages. No `VkBuffer` binds the two imports: a + plain one binds one memory, its whole size inside it (VUID-vkBindBufferMemory-buffer-07459, + VUID-vkBindBufferMemory-None-10741), and a sparse one binds only memory of a type its + requirements take (VUID-VkSparseMemoryBind-memory-01096), which on the RTX 2080 (620.70.06) is + type 1 alone, device-local, for every usage, with the host handle type or without, where a host + pointer imports as type 3 or 4, of system memory (`tests::sparse_host_pages`). A chunk's end + cannot follow the objects: each chunk is imported before the objects over it, and binds others + by the time a straddling one is made. Where the plan is listed (the consumer's RADV and ANV + devices, its RAM given a source of dma-bufs), a chunk is imported only for a copy over it, and + an object over chunks no copy imported takes its own import. - **A copied host buffer costs O(its size) at every batch's completion that may have written it, and at every commit where its pages carry no log** (`copied.rs`, `copied-host-pages`), and again at the submission of each batch that waits for an event value its commit found not reached