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

Vulkan issue with egpu systems. #229

Open
Emimendoza opened this issue Apr 1, 2024 · 0 comments
Open

Vulkan issue with egpu systems. #229

Emimendoza opened this issue Apr 1, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@Emimendoza
Copy link

When the nvidia driver is installed but the nvidia gpu is not attached (common scenario in egpu systems), apps will still try to use the nvidia vulkan driver. For example, calling vulkaninfo causes it to lag for a couple seconds and then display the following:

ERROR: [Loader Message] Code 0 : loader_scanned_icd_add: Could not get 'vkCreateInstance' via 'vk_icdGetInstanceProcAddr' for ICD libGLX_nvidia.so.0
==========
VULKANINFO
==========

Vulkan Instance Version: 1.3.279


Instance Extensions: count = 22 ...

This doesn't cause any oblivious issues at first since a lot of programs seem to launch fine. But as soon as they use Vulkan they can crash. I have seen this happen with Firefox when loading PDFs or discord randomly crashing.

I have found a "fix" for this issue. We can tell the vulkan loader what ICDs to consider with the VK_ICD_FILENAME env var.

For my system the fix consisted of creating a script in /etc/profile.d/ with the following:

# Check if Nvidia GPU is present
if ! lspci | grep -i nvidia; then
    # Nvidia GPU is not present, set VK_ICD_FILENAMES to use Intel GPU
    export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/intel_icd.x86_64.json
fi

This fix has a couple issues. The first one is that the vulkan icd is hard coded to be intel. This could be fixed by just making it put all of the available ICDs except the Nvidia one. The second issue is not as easy to fix...
This works for me because I only boot with the egpu or without it, I never hot plug. But since this variable is set at login, if you login with/without nvidia gpus, programs will ignore the nvidia vulkan icd if you happen to hot plug/unplug the gpu while already logged in. While xorg doesn't support hot-plugging gpus, wayland does. So this would require relogging in for those who hotplug or hot unplug (though hot unplugging is very much not great rn but some have gotten it to work). So while it would be nice to include something like the script above in the built nvidia-tkg package, it would fix the vulkan issue but introduce another issue. I don't know if this is a reasonable tradeoff for users.

@Tk-Glitch Tk-Glitch added the enhancement New feature or request label May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants