Files
metal2vulkan/docs
Anees Iqbal c6371eebfe dma-buf: an import tries first the form and type its kind last imported as
On the RTX 5080 Laptop GPU (NVIDIA 615.71.09) the four- and eight-thread leak probes still
stalled with the type order alone. A failed import there can spin inside vkAllocateMemory while
holding the driver's lock. With every failed import printed (potluck m3-max-17206, a scratch
commit that also tried no host-visible type), 4346 of the probe's 6000 imports failed first: type
0, dedicated to nothing, ERROR_OUT_OF_DEVICE_MEMORY, for udmabufs of scattered pages from 16 KiB
to 63 MiB. Each then succeeded dedicated to its buffer. The type order cannot remove these,
because they are a refusal of the form, not of the type. Locking every import alone did not stop
the stall either: 2 of 4 runs still stalled, every import failing twice before it succeeded
(m3-max-17296).

The order extends from type to form and type. Each kind remembers the form (dedicated to its
buffer or not) and the type its last import succeeded as (Memory::dma_buf_imported_as), and
tries that pair first. Every other pair is still tried after it, in today's order. worked_first is
generic over what it orders. On 615.71.09 a no-copy buffer's imports then go dedicated first and
no longer fail in steady state. On 620.70.06 the pair is (dedicated to nothing, type 0), as
before. The import's third value now says whether the memory is dedicated to its buffer, made so
now or because an earlier import of its kind found that form
(WorkCounts::dma_buf_buffer_imports_dedicated counts the same imports). The dedicated-allocation
info is renamed so that it no longer shadows the attempt's form.

docs/FAST-PATHS.md records 615.71.09's refusal of the form, the order, the first-import lock, and
the stall's runs on 615.71.09.

Test: memory::a_dma_buf_import_tries_the_form_and_type_its_kind_last_imported_as_first covers
the pairs: a buffer's attempts with the dedicated form put first, and with the undedicated form
put first; a shared import, which has no dedicated form; and the type cases as before.

Verified at this change's sources (branch steelbrain/nv5080fails-serialform, which carries the
same code on the earlier base):
- CPU: 31 of 31 tests pass (potluck m3-max-17327).
- RTX 2080: 31 of 31 touched tests pass (m3-max-17331), including host_ram_dma_buf x12 and
  no_pointer_import x2, which cover the dedicated retry. The probes ran in 28.8 s (four threads),
  56.8 s (eight threads) and 16.8 s (one thread).
- RTX 3090: 31 of 31 pass (m3-max-17358). The probes ran in 41.7 s, 69.2 s and 18.0 s.
2026-11-11 14:24:48 -08:00
..