Files
metal2vulkan/docs
Anees Iqbal 78a98addc1 Guest RAM: a listed chunk stays imported where the whole RAM fits the memory its imports count against
On RADV the first kernel submission that lists a guest-RAM chunk just imported waits while
amdgpu writes the chunk's page tables, one entry per host page, through SDMA jobs that wait
for room in the IB suballocator (amdgpu_cs_ioctl > amdgpu_vm_bo_update > amdgpu_vm_sdma_update
> drm_suballoc). It holds the VM's reservation lock throughout, so every other submission of
the device waits too, and so did the guest-RAM thread's next PRIME_FD_TO_HANDLE (218 ms in
amdgpu_gem_object_open). Seen with a root /proc stack sampler on the Radeon 780M (gem10 job
4750): 231 to 275 ms of a gather's submission per 3.94 GiB chunk imported again. Every
re-import after the idle release paid it again.

A listed chunk, once imported, now stays imported while the device uses the RAM, where the
whole RAM fits in half the device's memory heaps with unified memory (RADV reports an APU's
GTT and carve-out together, split across two heaps), else in three quarters of the heaps that
are not device-local (a discrete GPU's GTT). Chunks kept past their objects must fit in the
kernel's GTT: RADV lists every import in every submission, which fails once they pass it.
Where the RAM does not fit, chunks are released while idle as before. Each kept chunk costs
every submission about half a microsecond (3 chunks for 8 GiB: 16 us against 14 us).

Plan::releases says which; Device::count_host_ram_imports_against is the device tests' seam
(cfg(test)): the release test makes the RAM too long, and a new test sees chunks kept past
their objects and the idle window, with the next objects bound in them and no import made.
The lane probe's gathers say how many chunks are live and were released. FAST-PATHS and
HOWTO say what is true now.

(cherry picked from commit 75f17258ddd0dc03e2f89a85819091cfa22c345a)
2026-11-07 14:11:16 -08:00
..