-
Notifications
You must be signed in to change notification settings - Fork 286
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
Multilib and layer names on Linux #155
Comments
Any progress on this? |
We don't currently have an official mechanism to support both 32 and 64 bit copies of the layers or ICDs. That being said, it is possible to use both architectures for ICDs because the loader will just hit an error when loading the wrong ICD, and it will continue with the correct one. Based on the inital comment from @djdeath it sounds like that isn't working for layers. I would guess this is because the loader has logic to remove duplicate layers, so the loader is probably only finding one of the JSON files for each layer. As far as adding support for both 64 and 32 bit layers co-existing, I think that sounds like a good thing, but it's been low priority (particularly as Linux 32-bit has never had the level of support of other configurations) and I haven't given it much thought. I see a few basic ways of accomplishing this:
"library_path": {
"i686": "some/path.so",
"x86_64": "another/path.so"
} I think I'd lean towards some variation of the last bullet point. Also, if anyone wants to drive this forward, this is the kind of thing that is probably worth bringing to the Vulkan SI group. I don't know if there's other people who are interested in this, but the same basic pattern applies to both layers and drivers. |
As I explained here: https://bugs.freedesktop.org/show_bug.cgi?id=109807 At least providing a specific one to the loader can be a way to do it, until a more general solution is available. I.e. something like I think in general, support for this can be useful not for 32-bit Linux, but for 32-bit games on Linux, that would rely on 32-bit Vulkan driver (mostly for Wine+dxvk/d9vk case for older 32-bit Windows games, since it's highly unlikely anyone would make native 32-bit games for Linux these days, and old native ones aren't using Vulkan). |
Maybe I misunderstood the problem, but I don't have one on Linux w/ multilib and a single Vulkan layer name. Anyway, if this will help someone, I use the following options: Installation
For my own needs I have the ConfigureSo, when libraries are installed into one of mentioned paths, I can use single Vulkan layer manifest file. Just not specifying the path, neither full nor relative, just library name.
Paths where loader looking for manifests are known
Now I have x86 and x86_64 libs named By running e.g. In addition
Actually, it set's the implicit meta-layer, so this thing (or similar) could be used directly: $XDG_DATA_HOME/vulkan/implicit_layer.d/VkLayer_override.json
With such example my fake |
Looks like this requires placing .so for layers in the fixed location though. Any customization already won't work. The idea is to allow for JSON to point to a specific location for .so, and to be able to use one JSON for 32-bit case, and one for 64-bit case. |
A couple of quick questions (based on example above), which maybe don't worth separate issues:
|
@shmerl export LD_LIBRARY_PATH="${PWD}/x86/path/:${PWD}/x86_64/path"
export VK_LAYER_PATH="/path/to/manifest/"
export VK_INSTANCE_LAYERS="VK_LAYER_YOUR_layer_name"
./run_any_bit should just work. (Note: |
I guess it might work, if you set LD_LIBRARY_PATH depending on 32-bit or 64-bit case. Mixing them up like that probably isn't a good idea. |
@pchome That works, but it's not a great general solution. If you install a layer (eg. vkBasalt), you shouldn't have to specify Usually you can store the libraries in the respective 32bit and 64bit library paths to avoid needing I've specifically run into this issue packaging vkBasalt on NixOS: NixOS/nixpkgs#92401. |
See also #524 and https://gitlab.steamos.cloud/steamrt/steam-runtime-tools/-/issues/39. It seems as though one simple way to avoid this would be to either stop removing duplicate layers at all (more like the behaviour seen for ICDs), or deduplicate by unique
This. In pressure-vessel (the container framework that the steam-runtime-tools issue talks about), we would prefer to be very careful about what we do and don't put on the Some layers like MangoHud bypass this by using glibc's special
I would suggest that this is a can of worms that Vulkan-Loader should try hard not to open, because it's a lot less simple than it appears at first glance. Every Linux distribution and every build system seems to have a subtly different vocabulary of names for architectures and ABIs, and unfortunately it's not valid to assume that CPU types map 1:1 to ABIs. Even if you assume GNU/Linux (as in Linux with glibc), 64-bit x86 CPUs have at least the x86_64 and x32 ABIs, 32-bit ARM CPUs have OABI, EABI softfloat and EABI hardfloat, and MIPS has lots. Here are some of the vocabularies I'm aware of:
If portability to non-GNU Linux (Android, musl, uclibc, etc.) is a goal, or if portability to non-Linux Unix platforms like *BSD is a goal, then it just gets worse. I think Debian multiarch is probably the most comprehensive and least ambiguous of the various ways to name ABIs, but perhaps that's just my Debian-developer bias showing. It certainly seems like a source of complexity that would be better avoided if possible! Following that proposal in, for example, Debian (which fully supports 9 ABIs and partially supports 13 more) would also require the JSON manifest to list 22 different library paths, because to avoid breaking the system when cross-compiling, files in |
Linux can support multiple ABIs, but Vulkan Layer manifest does not allow to specify different library paths, based on the ABI. As a solution, for ICDs, we can simply create multiple manifests, one per ABI, and the Loader will try them one by one until it finds the library that is compatible with the executable class. Instead, for Vulkan Layers, this method doesn't work because the Loader will discard the manifests that have a duplicated layer name. To add support for multiple ABIs to Vulkan Layers, and to make the behavior similar to the ICDs, with this commit we remove the duplicated layer name check. Fixes: KhronosGroup#155 Signed-off-by: Ludovico de Nittis <[email protected]>
Linux can support multiple ABIs, but Vulkan Layer manifest does not allow to specify different library paths, based on the ABI. As a solution, for ICDs, we can simply create multiple manifests, one per ABI, and the Loader will try them one by one until it finds the library that is compatible with the executable class. Instead, for Vulkan Layers, this method doesn't work because the Loader will discard the manifests that have a duplicated layer name. To add support for multiple ABIs to Vulkan Layers, and to make the behavior similar to the ICDs, with this commit we remove the duplicated layer name check. Instead we add to the output list all the Vulkan Layers that we find, and only when we are actually going to dlopen them, we discard the layers with the same name that we already successfully opened. Fixes: KhronosGroup#155 Signed-off-by: Ludovico de Nittis <[email protected]>
Linux can support multiple ABIs, but Vulkan Layer manifest does not allow to specify different library paths, based on the ABI. As a solution, for ICDs, we can simply create multiple manifests, one per ABI, and the Loader will try them one by one until it finds the library that is compatible with the executable class. Instead, for Vulkan Layers, this method doesn't work because the Loader will discard the manifests that have a duplicated layer name. To add support for multiple ABIs to Vulkan Layers, and to make the behavior similar to the ICDs, with this commit we remove the duplicated layer name check. Instead we add to the output list all the Vulkan Layers that we find, and only when we are actually going to dlopen them, we discard the layers with the same name that we already successfully opened. Fixes: KhronosGroup#155 Signed-off-by: Ludovico de Nittis <[email protected]>
Linux can support multiple ABIs, but Vulkan Layer manifest does not allow to specify different library paths, based on the ABI. As a solution, for ICDs, we can simply create multiple manifests, one per ABI, and the Loader will try them one by one until it finds the library that is compatible with the executable class. Instead, for Vulkan Layers, this method doesn't work because the Loader will discard the manifests that have a duplicated layer name. To add support for multiple ABIs to Vulkan Layers, and to make the behavior similar to the ICDs, with this commit we remove the duplicated layer name check. Instead we add to the output list all the Vulkan Layers that we find, and only when we are actually going to dlopen them, we discard the layers with the same name that we already successfully opened. Fixes: #155 Signed-off-by: Ludovico de Nittis <[email protected]>
I couldn't find any guidance on this topic, maybe I didn't look hard enough.
On Linux multiple ABIs can be supported by a given system, the typical example is x86_64 (64bit x86) & i686 (32bit x86).
Quite a few games are running in 32bit and so a layer needs to be compiled twice for each ABI that a given binary might pick up.
My current problem is that I would like the name of the layer to remain the same for both ABIs and have the loader pick the right one.
As far as I can tell installing a
layer_x86_64.json
andlayer_i686.json
with each pointing to different library to load but with the same name doesn't work.Is there any guidance on what I can do to avoid having 2 different names for a layer that essentially the same just recompiled for a different architecture?
Is it a feature worth adding to the loader?
The text was updated successfully, but these errors were encountered: