-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
cudaPackages.cuda_compat: automatically discover libnvrm* on jetsons #273389
cudaPackages.cuda_compat: automatically discover libnvrm* on jetsons #273389
Conversation
b5831fd
to
66bd9f0
Compare
libcudaExtraNeeded = [ | ||
"libnvos.so" | ||
"libnvsocsys.so" | ||
"libnvrm_sync.so" | ||
"libnvos.so" | ||
"libnvsciipc.so" | ||
"libnvsocsys.so" | ||
"libnvrm_chip.so" | ||
"libnvrm_host1x.so" | ||
"libstdc++.so" | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quoting the message from matrix:
I'm wondering if we could somehow move this to nixglhost (e.g. as LD_PRELOAD) or maybe we could write and link a library that would scan /usr/lib/aarch-blahblaah/tegra and dlopen stuff in the correct order.
...presumably, this list might change at any time, i.e. our current nixpkgs revision might not be compatible with the future jetpacks
My approach so far has been to add the CUDA drivers from jetpack-nixos to the As jetpack-nixos is not part of Nixpkgs, it may be worth developing this approach into an external tool like NixGL. It's also useful for OpenGL and Vulkan, for that matter. I'm not too sure that system paths like this belong in Nixpkgs. We don't seem to make any accommodations for non-NixOS x86_64 distributions, after all. Using a launcher in place of |
We're yet to see how reliable that is: if your Ubuntu came with a different l4t-core release than the nixos-jetpack you're taking the package from, your EDIT: to reiterate, that's not an issue when using jetpack-nixos instead of ubuntu, because then we just know which kernel we're using
This accommodates for a specific device even, and it kind of makes sense because the package (cuda_compat) is also specific to these devices.
In a way we do, we allow LD_LIBRARY_PATH. In the future we might looking into even more tailored mechanisms (libc patches) to ease the use of Nixpks on FHS distributions All of that said, the present PR is definitely not the way to go, because this approach is unmaintainable. I just wanted to show that this particular hack does work (at the moment). |
jetpack-nixos is tied to specific JetPack versions. If we were to make a NixGL-like launcher, we could instruct users to make sure that they use the appropriate revision of jetpack-nixos for their host JetPack version. Mismatched configurations would be untested and not explicitly supported.
The recently released JetPack 6 Developer Preview has explicit support for upstream kernels. I don't think kernel versions will be of too much concern due to this, as NVIDIA would presumably need to keep ABIs between their kernel and userspace drivers fairly stable so that custom kernels don't constantly break.
That's a good point, but if Anduril are happy with it I'm not terribly concerned. This would be a separate tool, so no issues with Nixpkgs. |
I meant the kernel modules that libcuda and libnvrm* may be interacting with |
Marking this PR as draft since it sounds like it is intended to be a WIP for the time being. But feel free to adjust as appropriate |
66bd9f0
to
8873577
Compare
The wrapper approach (a la numtide/nix-gl-host#10) is preferable because if/when NVidia changes |
...in a very cursed way. PoC/not for merging. Related to #267247
This is arguably very much wrong but still up for a discussion.
CC @NixOS/cuda-maintainers @yannham @Kiskae
Description of changes
The approach is to add
libnvrm*
' impure location to the compat libcuda's RUNPATH. However, that doesn't work out of the box, becauselibnvrm*
have many dependencies, including libstdc++, and unless we preload them they're looked up in the fhs locations only to fail (in a few more words)Note that none of this is required with jetpack-nixos, because they control their
libnvrm*
and thus they can patchelf themThis seems to work sometimes:
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.