-
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
Extend layer/driver JSON manifest to list library dependencies as a hint #1316
Comments
A couple of questions:
A clarification about driver manifests is that 'relative paths' are relative to the manifest file, so any use of relative paths that isn't relative to the manifest makes for a more confusing manifest. Not super important, but its the only 'quirk' I can think of happening. |
How exactly would this new field be tested? |
Dupllicating my comment on the GLVND instance of this issue, since I think this is the better venue to discuss the overall proposal: Not strongly opposed to this, but given it's a spin-off of the Chrome/pressure-vessel discussion, I want to point out that the combination of this + the Vulkan version won't be sufficient to address what that proposal does. Besides GLX, it doesn't cover CUDA, DLSS, optix, etc. Perhaps these hints combined with a "the other stuff" json file would address the whole problem space, but I'm a little worried about decentralizing the data. E.g., if someone intents API dispatcher and adds hints to it too, do we then say "Look at the 'other stuff' json file + GLVND json + Vulkan json unless you find API dispatcher json files, then look at those + 'other stuff' json + GLVND json." Alternatively, the "other stuff" json file could be a superset with tags of some sort to note which API(s) each file relates to, but then why duplicate that data into the GLVND/Vulkan ICD json files? Just extra work at that point. |
I think you could have tests that run CTS or some other set of test applications, create a very bare container mapping the files specified in to the json into that container, run the same tests in the container and assert the results are the same/pass in both.
Yes, I think this is a good question, and why a top-level json file with its own ordained locations in the filesystem, as proposed in the references, may be an easier lift for container maintainers. |
A standard JSON structure in a single standard location might be the easiest, since that way container managers wouldn't need to separately scan manifests from API-specific directories. As for distinguishing different sets of files, how much granularity do we need? Is something as broad as "graphics" and "compute" sufficient? Would we want to be able to select files based on specific APIs or features (e.g., egl, glx, Vulkan, DLSS, etc.)? If we only need a couple broad categories like "graphics", then just having separate file lists in the JSON file, or even separate JSON files might be good enough. Any files that are required for both would just be listed in both, and whatever parses the JSON files would be responsible for filtering out duplicates. Something like: {
"graphics": [
"libraries": [
"libEGL_nvidia.so.0",
"libGLX_nvidia.so.0"
],
"data": [
"/usr/share/glvnd/egl_vendor.d/10_nvidia.json",
"/usr/share/vulkan/icd.d/nvidia_icd.json"
]
],
"compute": [
"libraries": [
"libnvidia-opencl.so.1"
],
"data": [
"/etc/OpenCL/vendors/nvidia.icd"
]
]
} If we expect to have a lot of categories, though, then having duplicate filenames like that could get pretty unwieldy. In that case, it might be easier to do it the other way around, with a single list of files and then a set of feature tags for each file: {
"libraries": [
{
"name": "libEGL_nvidia.so.0",
"tags": ["egl"]
},
{
"name": "libGLX_nvidia.so.0",
"tags": ["egl", "vulkan"]
},
{
"name": "libnvidia-opencl.so.1",
"tags": ["compute"]
}
],
"data": [
{
"name": "/usr/share/glvnd/egl_vendor.d/10_nvidia.json",
"tags": ["egl"]
},
{
"name": "/usr/share/vulkan/icd.d/nvidia_icd.json",
"tags": ["vulkan"]
},
{
"name": "/etc/OpenCL/vendors/nvidia.icd",
"tags": ["compute"]
}
]
} |
I can certainly see the argument for making this discovery be something that happens "above" Vulkan/EGL/OpenXR/etc., so that new dispatchers that are "the same shape" as Vulkan can take part in this mechanism even if they have nothing to do with Vulkan specifically.
My intention was: no.
In at least pressure-vessel, we already need to know (and duplicate the knowledge of) how and where Vulkan, EGL, etc. loaders look for manifest files, because we already need to be able to:
So this would not be any additional burden for us. Similarly, I would expect that Chromium needs to find and parse the manifests, so that it can find the actual shared libraries, so that it can ensure that they get mirrored into its sandboxed namespace.
Yes, that's why I suggested each item in There is a difference between plain basenames that don't contain
Oh, I agree completely - that's why I suggested reusing the same interpretation as |
My stance is that if the changes do not affect how the loader interprets the JSON file, then I have very to say about the changes. Adding additional fields to the manifest is not against the file description. I'm happy to allow any/all discussion about additional fields in the manifests to occur here, I just wanted to clarify that I don't have a strong stake in these discussions beyond not desiring breaking back-compat. If there is a strong desire to use a new format, that wouldn't be a decision I get to make unilaterally, as it would have to go through the Vulkan Working Group (specifically the SI subgroup) before any decisions are made. (Not that anyone in this discussion isn't aware of that fact, again I'm just clarifying my position). |
What enhancement are you suggesting for the Vulkan Loader? Please describe in detail.
Some frameworks need to use Linux namespaces to run Vulkan programs in a container or sandbox:
It's not always straightforward to know what is considered to be part of the driver. When enumerating Vulkan drivers and layers, we know that we need the
library_path
. However, thelibrary_path
can have dependencies, either by ordinary dynamic linking (ELFDT_NEEDED
on Linux, which we can discover programmatically by parsing ELF headers) or dynamically at runtime (dlopen()
on Linux, which we cannot discover programmatically - currently the only way to know what is needed is to load the driver and let it run its arbitrary code).For Mesa, it's enough to load the Vulkan driver via its
library_path
and then follow theDT_NEEDED
tree; but the Nvidia proprietary driver usesdlopen()
to load parts of itself, so following theDT_NEEDED
tree is not necessarily sufficient. As a result, the Nvidia team have been in contact with Chrome and pressure-vessel developers about providing and parsing a manifest that would tell those tools what other libraries are needed.It occurs to me that for Vulkan and other driver-loaders that mimic its structure (like GLVND EGL) we already have a perfectly good manifest that describes the driver, so it might make sense to put library information into the Vulkan driver's JSON manifest instead of inventing a separate file?
A straw-man example:
The spec for
wants_libraries
could perhaps be something like this:Is this specific to a single platform?
I'm personally only interested in this for Linux, but it seems equally applicable to other Unix platforms like *BSD and Hurd, and it doesn't seem as though there's any reason this couldn't be generalized to macOS and Windows too.
Additional context
cc @cubanismo - does this seem like a reasonable solution?
The text was updated successfully, but these errors were encountered: