From d4d1b5ff05ca7d78cc970d2f3667f02b085e63d9 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Thu, 19 Nov 2026 06:59:17 -0800 Subject: [PATCH] rt README: the no-copy imports have no read-only form; the ledger lists Metal's bit 24 as that gap The planner's ruling on Metal's private read-only no-copy option (bit 24 of MTLResourceOptions): no options word, no new Gap. Instead, one README sentence in Imported blocks and a ledger row citing it. Each clause was checked before it was written: - import_host_memory's safety contract takes "host memory mapped readable and writable" (import.rs). - Vulkan's host-pointer import (VkImportMemoryHostPointerInfoEXT: sType, pNext, handleType, pHostPointer) and its fd import carry no access of their own; the spec's Host External Memory section defines no read-only import. - MTLResource.h's MTLResourceOptions has no bit 24: its fields are the CPU cache mode at shift 0, the storage mode at 4 and hazard tracking at 8. - Over imported pages a GPU write reaches them (the import is the pages, no copy), where Metal drops it (host_pages.rs, the M3 Max recordings). The rows: host-page-writes-kernel-store-read-only and host-page-writes-visibility-read-only, both refused at case/host-buffer with the Side's Unavailable naming the call with bit 24, venue *. The same answer was held on all eight runs: lavapipe m3-max-52171; XTX, 2080 and 780M m3-max-52173; 780M and 3090 m3-max-52172; Iris Xe m3-max-52174; RX 550 m3-max-52305. --- crates/metal2vulkan-conformance/known-gaps-rt.tsv | 5 +++++ crates/metal2vulkan-rt/README.md | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/crates/metal2vulkan-conformance/known-gaps-rt.tsv b/crates/metal2vulkan-conformance/known-gaps-rt.tsv index f69c57405..0e0a7cb73 100644 --- a/crates/metal2vulkan-conformance/known-gaps-rt.tsv +++ b/crates/metal2vulkan-conformance/known-gaps-rt.tsv @@ -1823,3 +1823,8 @@ vertex-format-uint4 * refused case/MTLVertexFormatUInt Err(Error::Unsupported("a vertex-format-uint4 * refused case/MTLVertexFormatUInt2 Err(Error::Unsupported("a render pass with NoAttachment is not built")) Gap::RenderPass (NoAttachment): the rt README, Known gaps of render encoders, "Refused by `Gap::RenderPass`, naming its `RenderPassKind`: ... and a pass with no attachment". vertex-format-uint4 * refused case/MTLVertexFormatUInt3 Err(Error::Unsupported("a render pass with NoAttachment is not built")) Gap::RenderPass (NoAttachment): the rt README, Known gaps of render encoders, "Refused by `Gap::RenderPass`, naming its `RenderPassKind`: ... and a pass with no attachment". vertex-format-uint4 * refused case/MTLVertexFormatUInt4 Err(Error::Unsupported("a render pass with NoAttachment is not built")) Gap::RenderPass (NoAttachment): the rt README, Known gaps of render encoders, "Refused by `Gap::RenderPass`, naming its `RenderPassKind`: ... and a pass with no attachment". +# +# Metal's private read-only no-copy option (MTLResourceOptions bit 24), which the no-copy imports +# have no form of, refused alike on every venue run. +host-page-writes-kernel-store-read-only * refused case/host-buffer Err(Unavailable({call: "newBufferWithBytesNoCopy:length:options:deallocator: with MTLResourceOptions bit 24"})) No read-only no-copy import (MTLResourceOptions bit 24): the rt README, Imported blocks, "The no-copy imports have no read-only form: ... over pages a consumer imports, a GPU write reaches them, where Metal drops it." +host-page-writes-visibility-read-only * refused case/host-buffer Err(Unavailable({call: "newBufferWithBytesNoCopy:length:options:deallocator: with MTLResourceOptions bit 24"})) No read-only no-copy import (MTLResourceOptions bit 24): the rt README, Imported blocks, "The no-copy imports have no read-only form: ... over pages a consumer imports, a GPU write reaches them, where Metal drops it." diff --git a/crates/metal2vulkan-rt/README.md b/crates/metal2vulkan-rt/README.md index 97ac66c46..f5e0223a8 100644 --- a/crates/metal2vulkan-rt/README.md +++ b/crates/metal2vulkan-rt/README.md @@ -364,6 +364,11 @@ first, and what to do where both refuse, is the consumer's. Each call returns the block and the index of the memory type it imported into, and refuses before any allocation is attempted. +The no-copy imports have no read-only form: `import_host_memory` takes pages mapped readable and +writable, and Vulkan defines no read-only import. Metal's private read-only option (bit 24 of +`MTLResourceOptions`, not in the public header) so has no counterpart here: over pages a consumer +imports, a GPU write reaches them, where Metal drops it. + The two rules differ because a failed dma-buf import is not harmless: on NVIDIA's Linux driver (620.70.06, an RTX 3090) one failed dma-buf import into a later type the query offered broke every later allocation of that type, the Shared type among them, so the dma-buf rule attempts nothing it