KhronosGroup / KhronosGroup/Vulkan-Tools

vkcube should use the first available physical device

Open
#1,054 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
493
Forks
202
Avg merge
1h 37m
Merged PRs (30d)
4

Description

Highly related to #153

Code in question - https://github.com/KhronosGroup/Vulkan-Tools/blob/a2224abf350f61211462a33e5b540201fa17de0d/cube/cube.c#L4185

As a result of this logic, vkcube always picks a discrete GPU on multi-gpu systems. This is in conflict with the principle of vkEnumeratePhysicalDevice returning the adapters in a "preferred" order by the system (see https://github.com/KhronosGroup/Vulkan-Loader/issues/153#issuecomment-515007898 for context). If Vulkan loader is indeed trying to return the first adapter as the preferred, and/or there are applications expecting them, then I think vkcube should just pick the first (available) physical device instead of doing any kind of sorting. If you want to demonstrate a more comprehensive use of Vulkan, you could keep the sorting functionality behind an option.

The context here is - some systems returning Intel GPU as the first but actually failing to present with it. See https://gitlab.freedesktop.org/mesa/mesa/-/issues/4688 and https://gitlab.freedesktop.org/mesa/mesa/-/issues/12212 for examples. vkcube is often used to simply check "does Vulkan work on your system", and always returning the discrete GPU isn't actually providing this signal, which causes confusion.

Examples of confusion:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The selection logic is in cube/cube.c at the linked line. Read the physical-device enumeration and selection path first, then inspect or run vkcube on a multi-GPU system. Done means vkcube chooses the first available physical device instead of sorting for a discrete GPU; any retained sorting should be explicitly scoped behind an option.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
computer-graphics, devtools
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.