Linux/NVIDIA: a refused host import of a read-only range makes every later vkAllocateMemory fail #1022
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-07T00:47:57Z.
Summary
On Linux with the NVIDIA driver,
importAllocationoffers read-only ranges of the relinked image toVK_EXT_external_memory_host. NVIDIA refuses them withVK_ERROR_OUT_OF_DEVICE_MEMORY(-2), and from then on everyvkAllocateMemoryon that device returns -2, including plain device-local allocations. The title then dies on the next texture or buffer allocation:Before the first failure, 651 imports of guest memory succeeded (4.6 GiB live), so it is not the budget. VRAM was 14 GB free.
Standalone repro (no AnyPS5)
An 80-line Vulkan program imports one 1 MiB mapping, then allocates 16 MiB of device-local memory:
MAP_PRIVATErwMAP_PRIVATErwMAP_SHAREDrwMAP_SHAREDrwmprotectto r or rxMAP_PRIVATEr or rxMAP_SHAREDrwThe spec allows the refusal. Failing every later allocation is a driver bug, but AnyPS5 can avoid triggering it.
RTX 5070 Ti, driver 595.91.07, Linux 7.2 (Nobara 44), GCC 16.
Repro source (
g++ -std=c++20 repro.cpp -lvulkan, run as./repro <file> <mode>)Proposed fix
On Linux, skip the import when the range is not mapped read-write (
GuestMemory::Accessible(base, bytes, true)), as the Windows branch already does for read-only memory. The range is copied instead, as for any refused import. Linux write watch uses userfaultfd write protection, so watched pages still read asrwin/proc/self/mapsand stay importable.With that change, Demon's Souls (PPSA01341 v1.07, on
main+ #861 + #864 + #732) logs no failed imports and no longer crashes. It runs at about 7 fps, against about 0.4 fps withAPS5_NO_HOST_IMPORT=1, which was the only way to keep it running before. It still renders black; that is a separate issue.The change and a TechnicalDebt entry are on a branch based on
main. On this machinectestpasses 368 of 370. The two failures,agc_driver_lds_atomics64andagc_driver_scalar_sop1, also fail on unmodifiedmainon this NVIDIA GPU; I will report them separately. I can open the PR if this is the direction you want.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-07T01:48:07Z.
Thanks for the standalone repro; it makes the driver behaviour clear.
The direction looks right to me. Choosing the path from the mapping before importing fits the project's rule better than what main does now: main tries the import and copies the range after the import fails. Please open the PR with the
Accessible(base, bytes, true)check on Linux and the TechnicalDebt line. Please put the repro table and the PPSA01341 numbers (about 7 fps with imports against 0.4 fps withAPS5_NO_HOST_IMPORT=1) in the description, and keep the black screen separate (#1025).Since it changes how guest memory reaches the GPU on Linux, we'll run it against the titles we use as regression checks before merging.