Search code examples
graphicsvulkan

What happens if different Vulkan devices contend for same queue family?


For example, I have a videocard with 16 QueueCount in first queue family and 1 QueueCount in second queue family. What happens if 2 different logical devices (e.g. from different applications) try to acquire (e.g. using vkGetDeviceQueue2) queues from same queue family that have QueueCount only 1?


Solution

  • If an implementation advertises something, it is required to actually provide what it advertises. If it advertises two queues in a family, it is required to provide that.

    If there is contention for the GPU between two applications, the implementation must not expose this contention to the user. Therefore, if there are only two physical command interfaces for the "family" in the GPU, the implementation must still act like the two applications each have two queues. This can be done by the implementation having a mutex shared among all users of the queue, such that vkQueueSubmit calls block if someone else is submitting to that physical queue. Or maybe the physical queue can process commands from arbitrarily many sources, with each process getting isolated into its own input space. Or something else.

    It is the implementation's job to work out the details.

    The only exception to this is device memory limitations; your program is not guaranteed to be able to allocate every byte of the pools of memory Vulkan advertises. Though many implementations can even handle this through virtual allocations.