diff --git a/crates/metal2vulkan/tests/api_signatures.tsv b/crates/metal2vulkan/tests/api_signatures.tsv index 7e6ce3dce..5bca80857 100644 --- a/crates/metal2vulkan/tests/api_signatures.tsv +++ b/crates/metal2vulkan/tests/api_signatures.tsv @@ -2796,6 +2796,7 @@ field metal2vulkan-runtime::WorkCounts.host_ram_chunks_imported_ahead pub host_r field metal2vulkan-runtime::WorkCounts.host_ram_chunks_live pub host_ram_chunks_live: u64 field metal2vulkan-runtime::WorkCounts.host_ram_chunks_released pub host_ram_chunks_released: u64 field metal2vulkan-runtime::WorkCounts.host_ram_copies pub host_ram_copies: u64 +field metal2vulkan-runtime::WorkCounts.host_ram_copies_staged pub host_ram_copies_staged: u64 field metal2vulkan-runtime::WorkCounts.host_ram_copy_bytes pub host_ram_copy_bytes: u64 field metal2vulkan-runtime::WorkCounts.host_ram_copy_dispatches pub host_ram_copy_dispatches: u64 field metal2vulkan-runtime::WorkCounts.host_ram_copy_import_wait_nanos pub host_ram_copy_import_wait_nanos: u64 @@ -2803,6 +2804,8 @@ field metal2vulkan-runtime::WorkCounts.host_ram_copy_import_waits pub host_ram_c field metal2vulkan-runtime::WorkCounts.host_ram_copy_regions pub host_ram_copy_regions: u64 field metal2vulkan-runtime::WorkCounts.host_ram_dma_buf_imports pub host_ram_dma_buf_imports: u64 field metal2vulkan-runtime::WorkCounts.host_ram_pointer_imports_failed pub host_ram_pointer_imports_failed: u64 +field metal2vulkan-runtime::WorkCounts.host_ram_staged_fill_nanos pub host_ram_staged_fill_nanos: u64 +field metal2vulkan-runtime::WorkCounts.host_ram_staged_fills_gated pub host_ram_staged_fills_gated: u64 field metal2vulkan-runtime::WorkCounts.host_range_lookups pub host_range_lookups: u64 field metal2vulkan-runtime::WorkCounts.host_rebind_imports_covered pub host_rebind_imports_covered: u64 field metal2vulkan-runtime::WorkCounts.host_rebind_imports_made pub host_rebind_imports_made: u64 diff --git a/docs/HOWTO.md b/docs/HOWTO.md index e06ee0187..c6d64e4d4 100644 --- a/docs/HOWTO.md +++ b/docs/HOWTO.md @@ -661,9 +661,21 @@ submission, can give the device the guest's RAM once instead: import that holds them (whole pages, imported as for any copy) and the buffer, the regions of one import one command of at most 1024: no other byte of their pages is read or written, and of runs that write a byte twice the later's bytes stay (`WorkCounts::host_ram_copy_regions`). A copy - takes each chunk it touches as an object over it does, and the thread's window moves past it; but where - an object over a chunk not imported yet is bound in an import of its own run, a copy makes none: - the chunk is imported first, or the thread's import of it waited for. Each copy is ordered + takes each chunk it touches as an object over it does, and the thread's window moves past it. + Over a chunk not imported yet, a copy of at most 16 ranges of it imports those ranges alone, as + an object's run is imported (not on MoltenVK or ANV). A gather of more, on a device whose thread + imports ahead (every device but one whose listed imports cost each submission: RADV with a + dma-buf source), is staged through the CPU instead. The CPU copies its runs from the pages into + memory of the command buffer's own once its batch is otherwise ready to submit (its event waits + met), and the GPU copies them from there into the buffer. No import is made or waited for, no + page is pinned for it, and the thread imports each such chunk next, so the copies after it read + the imports (`WorkCounts::host_ram_copies_staged`, `host_ram_staged_fill_nanos`). Where a buffer + or heap over host pages lies over the runs' bytes, or a scatter into those chunks was recorded, + the CPU's copy first waits until every queue completed the work submitted before it + (`host_ram_staged_fills_gated`), and where that is so at the encoding the copy takes the imports' + path. Any other copy imports the chunk on its encoding thread, or waits for the import under way + (`host_ram_copy_import_waits`, `host_ram_copy_import_wait_nanos`; every chunk import's time in + `host_ram_chunk_import_nanos`). Each copy is ordered and seen as a copy between the buffer and a no-copy buffer over the pages: the chunk's bytes have a hazard-tracking key placed over its host bytes, as a no-copy buffer's are, so the copy is ordered against every other copy of those bytes and every no-copy buffer or heap over the RAM's