Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a device sorting for all systems #657

Open
MarkY-LunarG opened this issue Aug 26, 2021 · 9 comments
Open

Implement a device sorting for all systems #657

MarkY-LunarG opened this issue Aug 26, 2021 · 9 comments
Assignees
Labels
drivers enhancement New feature or request

Comments

@MarkY-LunarG
Copy link
Collaborator

Implement a mechanism to sort devices based on some user preferences. These should include being able to prioritize most performant or most power-efficient devices. Also, it should be consistent from one run to another. A possible second alternative option might be to allow power adapter settings affect it in an "auto" mode (plugged in -> performance, battery -> power efficient). Experiment with this in a layer first.

@cubanismo
Copy link
Contributor

I'm curious how this will interact with the existing vendor-specific layers? Is there some guarantee that the LunarG layer will load below these vendor layers or vice-versa?

@MarkY-LunarG
Copy link
Collaborator Author

If we implement it as a layer, we are planning on this being lower (closer to the Implementation). But that will either take forcing the loading location in the loader for now or the implementation of #328. I have ideas for #328, but am only working on this part-time currently.

@Jason0214
Copy link

How is the plan for games that have their own selection criteria? For example, games that always grab the most performant device. Then any sorting being done at layer/loader is not going to affect them.
Does it mean some sort of filtering is still necessary?

@charles-lunarg
Copy link
Collaborator

This proposal is not to filter, only to sort. Any application that does extensive sorting on their own hand shouldn't be affected because this will only change the relative order of entries.

@MarkY-LunarG
Copy link
Collaborator Author

Actually, my proposal is to allow users to filter themselves. By default, it will not filter just sort. I plan to release a doc internal soon on my sorting algorithm proposal. Once that's reviewed I'll start making it more visible.

@Jason0214
Copy link

Hi @MarkY-LunarG glad to see #764. Thanks for doing the work!

Still, I want to kindly check with the “proposal is to allow users to filter themselves”. We would be more happier to see that in the loader : )

@MarkY-LunarG
Copy link
Collaborator Author

The option is there to force a device first using the new VK_LOADER_DEVICE_SELECT option which you set with vendorID hex value ":" deviceID hex value. Just like the Mesa device select layer. In fact, I also pay attention to the Mesa select option of MESA_VK_DEVICE_SELECT. I still plan on improving this even more in the future, but for now, I aimed for the easiest to get quorum from Khronos members.

@Jason0214
Copy link

Jason0214 commented Dec 9, 2021

The option is there to force a device first using the new VK_LOADER_DEVICE_SELECT option which you set with vendorID hex value ":" deviceID hex value. Just like the Mesa device select layer. In fact, I also pay attention to the Mesa select option of MESA_VK_DEVICE_SELECT. I still plan on improving this even more in the future, but for now, I aimed for the easiest to get quorum from Khronos members.

Got it. Thanks Mark

MarkY-LunarG added a commit that referenced this issue Jan 12, 2022
The loader ICD ordering could be random on Linux based on using readdir
to find ICD manifest files.  This can result in random behaviors as
applications that select only the first device can switch which device is
used.  To resolve this, we now sort based on device type and then
internally to the types based on PCI bus information.

This also introduces a VK_LOADER_DEFAULT_DEVICE environment variable
that can be used to force a specific PCI device.  This environment variable
is actually a duplicate of the MESA_VK_DEVICE_SELECT variable, which is
also looked for if the loader environment variable is not found.

Note, that at least one ICD must support it for the extension to be used at all.
So we only do the sorting if one ICD supports it.

Fixes part of #657
charles-lunarg pushed a commit that referenced this issue Jan 19, 2022
The loader ICD ordering could be random on Linux based on using readdir
to find ICD manifest files.  This can result in random behaviors as
applications that select only the first device can switch which device is
used.  To resolve this, we now sort based on device type and then
internally to the types based on PCI bus information.

This also introduces a VK_LOADER_DEFAULT_DEVICE environment variable
that can be used to force a specific PCI device.  This environment variable
is actually a duplicate of the MESA_VK_DEVICE_SELECT variable, which is
also looked for if the loader environment variable is not found.

Note, that at least one ICD must support it for the extension to be used at all.
So we only do the sorting if one ICD supports it.

Fixes part of #657
charles-lunarg pushed a commit that referenced this issue Jan 25, 2022
The loader ICD ordering could be random on Linux based on using readdir
to find ICD manifest files.  This can result in random behaviors as
applications that select only the first device can switch which device is
used.  To resolve this, we now sort based on device type and then
internally to the types based on PCI bus information.

This also introduces a VK_LOADER_DEFAULT_DEVICE environment variable
that can be used to force a specific PCI device.  This environment variable
is actually a duplicate of the MESA_VK_DEVICE_SELECT variable, which is
also looked for if the loader environment variable is not found.

Note, that at least one ICD must support it for the extension to be used at all.
So we only do the sorting if one ICD supports it.

Fixes part of #657
@MarkY-LunarG
Copy link
Collaborator Author

Linux consistent sorting enabled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
drivers enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants