Skip to content

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

Closed

Description

@awake-devel

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 cea1ef1 (good) and 539cbd8 (bad) points at 00e6d07 ("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 539cbd8:

[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 539cbd8 plus fix(agc): release host imports before the device is destroyed #1239).
  • cea1ef1 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 815d274 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 815d274'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.

Activity

  1. Dextroid17 commented on Oct 7, 2026

    @Dextroid17
    Contributor

    Reproduced first-hand on a different NVIDIA stack — RTX 3080 Ti, driver 615.71.09, main at df16c4c. 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 815d274'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.

  2. hashaam1217 commented on Oct 8, 2026

    @hashaam1217
    Contributor

    A machine where this does not reproduce, and the reason. Ubuntu 24.04.5, RTX 3060 Laptop, NVIDIA 595.91.07, main at df16c4c: 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 df16c4c:

    #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.

  3. oneandonlydean commented on Oct 8, 2026

    @oneandonlydean
    Collaborator

    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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions