AGC: Vulkan device creation fails on the NVIDIA proprietary driver since #943 (dma-buf import probe) #1289

Closed
opened 2026-10-07 22:27:53 +00:00 by awake-devel · 3 comments
awake-devel commented 2026-10-07 22:27:53 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by awake-devel on 2026-10-07T22:27:53Z.


Summary

Since #943, no Vulkan device can be created on the NVIDIA proprietary driver on Linux. Every VulkanDevice construction fails with:

AGC graphics: vkAllocateDescriptorSets color transfer: Vulkan result -2

git bisect between cea1ef13 (good) and 539cbd88 (bad) points at 00e6d078 ("keep dma-buf imports write-watched when they leave write protection intact"). It adds ProbeDmaBufImportWriteProtection (GuestBufferMemory.cpp#L1208), which decideImportWatch runs while each device is set up (L316). The probe imports a memfd through /dev/udmabuf (createDmaBufImport, L231). On this driver that vkAllocateMemory fails with VK_ERROR_OUT_OF_DEVICE_MEMORY; the probe reports it and goes on, but every later allocation on the device then fails with the same error, starting with the color transfer's descriptor sets.

dma-buf import is enabled whenever the device lists VK_KHR_external_memory_fd and VK_EXT_external_memory_dma_buf (VulkanDevice.cpp#L837). This driver lists both, and vkGetPhysicalDeviceExternalBufferProperties reports dma-buf buffers with the import's usage as importable, without a dedicated allocation.

In the test suite every GPU test then returns 77 and ctest counts it as skipped, so a run still ends with 100% tests passed (about 160 skipped here). CI runs on lavapipe and does not see it.

Found while rebasing #1239. This issue was investigated and written by Claude Code (AI), and posted by me after review.

Evidence

Arch Linux, kernel 7.2.8, GeForce GTX 1050 Ti Max-Q, NVIDIA 580.178.04, main at 539cbd88:

[write-watch] host imports resolve write protection: no (0 of 4 scratch pages written after a GPU read, 4 after the import); imported ranges stay watched
[write-watch] dma-buf imports keep write protection: unknown (probe failed at vkAllocateMemory, -2); imported ranges are compared
skipped, no usable Vulkan device: AGC graphics: vkAllocateDescriptorSets color transfer: Vulkan result -2
  • The probe's import: vkGetMemoryFdPropertiesKHR gives memory types 0x27f, the buffer allows 0x381, and bindImport takes type 0 (system heap, no host flags). Importing into type 9 (host visible, coherent, cached) instead fails the same way.
  • The validation layer (1.4.363.0, core validation) reports nothing before the failure.
  • APS5_WRITE_WATCH_IMPORTS=watch or unwatch skips both probes, and the suite then passes with no test skipped (407/407 on 539cbd88 plus #1239).
  • cea1ef13 creates devices and passes on the same machine.

Only the probe's import was observed failing; whether the dma-buf imports of shared direct memory from 815d2747 break a device the same way on this driver was not tested.

Possible fixes

  • Do not use dma-buf import on VK_DRIVER_ID_NVIDIA_PROPRIETARY until an import is known to work there (VkPhysicalDeviceDriverProperties), so neither the probe nor 815d2747's imports run on it.
  • Or probe dma-buf import on a separate, short-lived VkDevice, and turn it off for the real device when the import fails.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5752786612 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1289). Originally posted by [awake-devel](https://github.com/awake-devel) on 2026-10-07T22:27:53Z. --- ### Summary Since #943, no Vulkan device can be created on the NVIDIA proprietary driver on Linux. Every `VulkanDevice` construction fails with: ``` AGC graphics: vkAllocateDescriptorSets color transfer: Vulkan result -2 ``` `git bisect` between cea1ef13 (good) and 539cbd88 (bad) points at 00e6d078 ("keep dma-buf imports write-watched when they leave write protection intact"). It adds `ProbeDmaBufImportWriteProtection` ([GuestBufferMemory.cpp#L1208](https://github.com/boykopovar/AnyPS5/blob/539cbd88/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp#L1208)), which `decideImportWatch` runs while each device is set up ([L316](https://github.com/boykopovar/AnyPS5/blob/539cbd88/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp#L316)). The probe imports a memfd through `/dev/udmabuf` (`createDmaBufImport`, [L231](https://github.com/boykopovar/AnyPS5/blob/539cbd88/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp#L231)). On this driver that `vkAllocateMemory` fails with `VK_ERROR_OUT_OF_DEVICE_MEMORY`; the probe reports it and goes on, but every later allocation on the device then fails with the same error, starting with the color transfer's descriptor sets. dma-buf import is enabled whenever the device lists `VK_KHR_external_memory_fd` and `VK_EXT_external_memory_dma_buf` ([VulkanDevice.cpp#L837](https://github.com/boykopovar/AnyPS5/blob/539cbd88/core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp#L837)). This driver lists both, and `vkGetPhysicalDeviceExternalBufferProperties` reports dma-buf buffers with the import's usage as importable, without a dedicated allocation. In the test suite every GPU test then returns 77 and ctest counts it as skipped, so a run still ends with `100% tests passed` (about 160 skipped here). CI runs on lavapipe and does not see it. Found while rebasing #1239. This issue was investigated and written by Claude Code (AI), and posted by me after review. ### Evidence Arch Linux, kernel 7.2.8, GeForce GTX 1050 Ti Max-Q, NVIDIA 580.178.04, `main` at 539cbd88: ``` [write-watch] host imports resolve write protection: no (0 of 4 scratch pages written after a GPU read, 4 after the import); imported ranges stay watched [write-watch] dma-buf imports keep write protection: unknown (probe failed at vkAllocateMemory, -2); imported ranges are compared skipped, no usable Vulkan device: AGC graphics: vkAllocateDescriptorSets color transfer: Vulkan result -2 ``` - The probe's import: `vkGetMemoryFdPropertiesKHR` gives memory types 0x27f, the buffer allows 0x381, and `bindImport` takes type 0 (system heap, no host flags). Importing into type 9 (host visible, coherent, cached) instead fails the same way. - The validation layer (1.4.363.0, core validation) reports nothing before the failure. - `APS5_WRITE_WATCH_IMPORTS=watch` or `unwatch` skips both probes, and the suite then passes with no test skipped (407/407 on 539cbd88 plus #1239). - cea1ef13 creates devices and passes on the same machine. Only the probe's import was observed failing; whether the dma-buf imports of shared direct memory from 815d2747 break a device the same way on this driver was not tested. ### Possible fixes - Do not use dma-buf import on `VK_DRIVER_ID_NVIDIA_PROPRIETARY` until an import is known to work there (`VkPhysicalDeviceDriverProperties`), so neither the probe nor 815d2747's imports run on it. - Or probe dma-buf import on a separate, short-lived `VkDevice`, and turn it off for the real device when the import fails.
Dextroid17 commented 2026-10-07 23:41:19 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-07T23:41:19Z.


Reproduced first-hand on a different NVIDIA stack — RTX 3080 Ti, driver 615.71.09, main at df16c4c2. Full git bisect not needed: the probe is the trigger, exactly as described.

Baseline (build/tests/agc_driver_* via ctest, 16 jobs):

49% tests passed, 84 tests failed out of 166

The first failure carries your diagnostics verbatim:

[write-watch] host imports resolve write protection: no (0 of 4 scratch pages written after a GPU read, 4 after the import); imported ranges stay watched
[write-watch] dma-buf imports keep write protection: unknown (probe failed at vkAllocateMemory, -2); imported ranges are compared
vkCreateComputePipelines: Vulkan result -13

One difference from your box: the device is created here (Vulkan device ready device=…), and the poisoning shows up later at vkCreateComputePipelines (-13) rather than at vkAllocateDescriptorSets. Same probe line, same root.

Control — APS5_WRITE_WATCH_IMPORTS=watch, which skips both probes:

100% tests passed out of 166

So the differential is clean: 84 failures → 0 by skipping the probe alone.

Worth noting for the fix choice: in that control context.dmaBufImport is still true, so 815d2747's real imports do run, and the suite is green — which suggests the probe's import is what corrupts the device here, not the shared-memory imports. Since you flagged those as untested on this driver, I am going with your option 1 (do not enable dma-buf import on VK_DRIVER_ID_NVIDIA_PROPRIETARY) rather than option 2, so neither the probe nor the real imports run there.

Implemented as #1329 (option 1: dma-buf import off on VK_DRIVER_ID_NVIDIA_PROPRIETARY, including the Recorder test device). Shout if you are already on a fix and I will drop it rather than cost you a review.

Measured and written with AI assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6049074595 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1289#issuecomment-6049074595). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-07T23:41:19Z. --- Reproduced first-hand on a different NVIDIA stack — RTX 3080 Ti, driver 615.71.09, `main` at df16c4c2. Full git bisect not needed: the probe is the trigger, exactly as described. **Baseline** (`build/tests/agc_driver_*` via ctest, 16 jobs): ``` 49% tests passed, 84 tests failed out of 166 ``` The first failure carries your diagnostics verbatim: ``` [write-watch] host imports resolve write protection: no (0 of 4 scratch pages written after a GPU read, 4 after the import); imported ranges stay watched [write-watch] dma-buf imports keep write protection: unknown (probe failed at vkAllocateMemory, -2); imported ranges are compared vkCreateComputePipelines: Vulkan result -13 ``` One difference from your box: the device is created here (`Vulkan device ready device=…`), and the poisoning shows up later at `vkCreateComputePipelines` (`-13`) rather than at `vkAllocateDescriptorSets`. Same probe line, same root. **Control** — `APS5_WRITE_WATCH_IMPORTS=watch`, which skips both probes: ``` 100% tests passed out of 166 ``` So the differential is clean: 84 failures → 0 by skipping the probe alone. Worth noting for the fix choice: in that control `context.dmaBufImport` is still true, so 815d2747's real imports do run, and the suite is green — which suggests the *probe's* import is what corrupts the device here, not the shared-memory imports. Since you flagged those as untested on this driver, I am going with your option 1 (do not enable dma-buf import on `VK_DRIVER_ID_NVIDIA_PROPRIETARY`) rather than option 2, so neither the probe nor the real imports run there. Implemented as #1329 (option 1: dma-buf import off on `VK_DRIVER_ID_NVIDIA_PROPRIETARY`, including the `Recorder` test device). Shout if you are already on a fix and I will drop it rather than cost you a review. Measured and written with AI assistance.
hashaam1217 commented 2026-10-08 02:25:17 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by hashaam1217 on 2026-10-08T02:25:17Z.


A machine where this does not reproduce, and the reason. Ubuntu 24.04.5, RTX 3060 Laptop, NVIDIA 595.91.07, main at df16c4c2: the full suite passes 408/408 with nothing skipped, because the probe never gets as far as an import:

[write-watch] dma-buf imports keep write protection: unknown (probe failed at open /dev/udmabuf, -1000072003); imported ranges are compared

On Ubuntu, /dev/udmabuf is root:kvm with mode 0660, and this user is not in kvm. So the failure only shows up for users who can open /dev/udmabuf (through kvm membership or a udev rule), presumably the case on both machines above. This result does not tell whether driver 595 is affected.

What I could check is the two fixes, each merged onto df16c4c2:

#1329 #1380
NVIDIA 595.91.07 dma-buf import off: the dma-buf imports probe line is gone same
Intel Iris Xe, Mesa 25.2.8 ANV probe runs as on main same
NVIDIA full suite 408/408, none skipped 408/408, none skipped

Both read the driver ID correctly on the proprietary driver and leave Mesa drivers alone. Whether they fix the failure itself cannot be checked here.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6050898411 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1289#issuecomment-6050898411). Originally posted by [hashaam1217](https://github.com/hashaam1217) on 2026-10-08T02:25:17Z. --- A machine where this does not reproduce, and the reason. Ubuntu 24.04.5, RTX 3060 Laptop, NVIDIA 595.91.07, main at df16c4c2: the full suite passes 408/408 with nothing skipped, because the probe never gets as far as an import: ``` [write-watch] dma-buf imports keep write protection: unknown (probe failed at open /dev/udmabuf, -1000072003); imported ranges are compared ``` On Ubuntu, `/dev/udmabuf` is `root:kvm` with mode 0660, and this user is not in `kvm`. So the failure only shows up for users who can open `/dev/udmabuf` (through `kvm` membership or a udev rule), presumably the case on both machines above. This result does not tell whether driver 595 is affected. What I could check is the two fixes, each merged onto df16c4c2: | | #1329 | #1380 | |---|---|---| | NVIDIA 595.91.07 | dma-buf import off: the `dma-buf imports` probe line is gone | same | | Intel Iris Xe, Mesa 25.2.8 ANV | probe runs as on main | same | | NVIDIA full suite | 408/408, none skipped | 408/408, none skipped | Both read the driver ID correctly on the proprietary driver and leave Mesa drivers alone. Whether they fix the failure itself cannot be checked here.
oneandonlydean commented 2026-10-08 08:25:58 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-08T08:25:58Z.


Fixed by #1329 (051d17dd5): dma-buf import, and with it the probe, is now off on the NVIDIA proprietary driver. If device creation still fails on current main, please comment here with the log and it can be reopened.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6055865200 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1289#issuecomment-6055865200). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-08T08:25:58Z. --- Fixed by #1329 (`051d17dd5`): dma-buf import, and with it the probe, is now off on the NVIDIA proprietary driver. If device creation still fails on current main, please comment here with the log and it can be reopened.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#1289
No description provided.