The old runtime imported a Shared no-copy buffer's dma-buf on NVIDIA as type 0 (system memory,
no property flag): its udmabuf order (system-memory types the host maps last) puts type 0
before type 4. A type without HOST_COHERENT promises nothing of what the caller's own mapping
of the pages and the device see of each other's writes, and Shared memory's bytes are exactly
that; the consumer's probe showed wrong bytes there.
The form, decided by the memory types' flags alone (no fact row, device check or switch):
today's order is computed unchanged (memory::dma_buf_order, the former dma_buf_candidates);
for MemoryClass::Shared, dma_buf_candidates then keeps only its host-coherent types, in its
order, where its first type is host-coherent, and none where it is not. An empty order tries no
import and refuses as ImportFailure::NoMemoryType, which callers already map to not_importable()
("host memory this device cannot import exactly"), so what it would back takes the refused
dma-buf's path, a copy of its pages. Type 4 is never tried: a refused import there breaks every
later exportable device-local allocation for the device's life (tests::export_after_dma_buf).
Private and the other classes keep the order whole (type 0 on NVIDIA as before).
Tests:
- tests::memory::a_shared_dma_buf_import_takes_host_coherent_types_or_none: over NVIDIA's,
ANV's, RADV's (discrete) and lavapipe's types and udmabuf bits, the first type before and
after is the same but NVIDIA's (0 before, refused after, no attempt), and every other class's
order is unchanged. The order tests name dma_buf_order.
- tests::export_after_dma_buf::a_shared_dma_buf_import_is_host_coherent_or_refused_untried
(device test): where the order is empty the import is refused and exportable Private buffers
made after it still lie in device-local memory with no overflow; elsewhere it imports as a
host-coherent type and a Shared buffer over it shares bytes both ways (the GPU's fill read
through the caller's mapping; the CPU's writes there read by the GPU's copy).
docs/FAST-PATHS.md's known gap on NVIDIA's dma-buf imports says so. docs/REFUSALS.md
regenerates unchanged (the refusal is the existing one).