protonscr

HVV -> Sysmem fallback logic is flawed

vkd3dclosed
HansKristian-Work/vkd3d-proton#2258 · opened 2024-12-20 by doitsujin · updated 2025-01-07 · 2 comments · github
Ddoitsujin 2024-12-20 github

Current NVK exposes the following memory types, in this order:

[0] DEVICE_LOCAL
[1] DEVICE_LOCAL | HOST_VISIBLE | HOST_COHERENT
[2] HOST_VISIBLE | HOST_COHERENT | HOST_CACHED

There is no uncached system memory type (yet; will probably get added).

When exceeding our fixed HVV budget with allocations from memory type 1, our fallback logic would only scan for DEVICE_LOCAL | HOST_VISIBLE and land on memory type 1 again instead of memory type 2, thus erroring out and causing games to crash unless no_upload_hvv is used, as seen in https://gitlab.freedesktop.org/mesa/mesa/-/issues/11177.

The proper fix here would be to have more sophisticated logic for allocating device memory, and feed back the memory type mask of failed allocations to the caller. There are more scenarios that are theoretically allowed by the spec where our current logic would brea, (e.g. two identical HVV types.

HHansKristian-Work maintainer 2025-01-02 github

I suppose our logic will need to mask out failed heap indices rather than just types.

Nothing extracted yet.