Files
metal2vulkan/docs
Anees Iqbal addc45b2e1 Dma-buf imports fall back to the dma-buf's other memory types; NVIDIA imports a udmabuf as its type 0
On NVIDIA (RTX 3090, 620.70.06; RTX 5080 Laptop, 615.71.09) every
import of a udmabuf failed, so a no-copy buffer over sourced memory on a
device that imports no pointer was a copy ("their import failed"), and a
guest RAM's chunks there were never imported (the RAM not listed, its
objects copies): host_ram_dma_buf::without_pointer_imports_a_ram_s_chunks_are_its_dma_bufs
and no_pointer_import::without_pointer_imports_a_sourced_no_copy_buffer_lies_in_its_dma_bufs
failed on both GPUs in the round at b4cd0f9f91.

Cause, from a probe on the 3090 (job m3-max-15245, branch
steelbrain/hkhostmem-2-probe, not for landing): vkGetMemoryFdPropertiesKHR
answers memoryTypeBits 0x11 for a udmabuf of a sealed memfd, types 0
(heap 1, no property flag) and 4 (heap 1, host-visible, coherent and
cached). The import into type 4 answers ERROR_OUT_OF_DEVICE_MEMORY with
or without a dedicated allocation and the device-address flag; into
type 0 it succeeds in all four forms, for one page and for 16. The
runtime asked only the class's types (Shared requires host-visible
coherent memory), so it tried type 4 alone.

Fix: import_dma_buf tries dma_buf_candidates: the class's candidates
first, unchanged, then every other type the dma-buf and the resource
allow that the runtime may allocate and that is neither protected nor
lazily allocated. The runtime never maps a dma-buf import (the CPU uses
the caller's mapping), so a type the host does not map serves it. On
drivers whose class types import the dma-buf (RADV, lavapipe, ANV) the
order and the result are as before.

The docs that said NVIDIA refuses every udmabuf now speak of a driver's
refusal; the tests' stand-in for one is unchanged.

Tests: tests::memory::dma_buf_imports_try_the_class_s_types_then_the_dma_buf_s_others
(the 3090's types). The two device tests are unchanged: they hold on
NVIDIA once its driver imports the udmabuf.
2026-11-11 05:37:06 -08:00
..