Skip to content

amdgpu: Add vamgr for capture/replay.

Bas Nieuwenhuizen requested to merge bnieuwenhuizen/drm:replay into master

In Vulkan we have extensions to assist with capture in replay in a world where addresses are returned to the application. This involves creating buffers at the same VA during replay as they were during capture.

By itself libdrm_amdgpu already has support for this, but there is the obvious failure mode that if another buffer is already allocated at that VA things fail spectacularly. This is an actual issue as internal buffers, like winsys images or shader binaries also participate in the same VA allocation.

To avoid this problem applications have to create buffers which are going to be captured with a flag, and the implementation is to separate VA allocation for those buffers to reduce the collision risk:

"Implementations are expected to separate such buffers in the GPU address space so normal allocations will avoid using these addresses. Apps/tools should avoid mixing app-provided and implementation-provided addresses for buffers created with VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT, to avoid address space allocation conflicts."

This patch implements that by splitting the high vamgr into two, with each managing half of the address range, and introducing a new flag to choose which vamgr to use.

As some older GPUs have very limited address space we do not force the allocations into a specific vamgr. If the preferred one fails we try the other one.

Signed-off-by: Bas Nieuwenhuizen bas@basnieuwenhuizen.nl

MR that uses it: mesa!10570 (merged)

Edited by Bas Nieuwenhuizen

Merge request reports