Repository navigation
fix(nvjitlink-sys): find libnvJitLink under lib/ as well as lib64/ - #1333
Merged
Merged
Conversation
nvjitlink-sys probed only `<root>/lib64/libnvJitLink.so` under each CUDA root. conda environments ship the library under `<root>/lib/` and have no `lib64/`, so the probe fell through to loading by SONAME. A library found that way cannot be tied to an exact file, and `--materialize-cubin` then refused to run with CUDA_HOME set to the environment. libNVVM, under `<root>/nvvm/lib64/`, was found in the same layout. Probe `lib64/` then `lib/` under each root, and say in the materialization error that a library found only by SONAME has no exact file, and how to point at one. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Zihua Wu <13583761+lucifer1004@users.noreply.github.com>
Hoist the per-root probe loop out of open_library into open_library_under_roots, which takes the roots as a slice. The LIBNVJITLINK_PATH override and the SONAME fallback stay in open_library, so a developer's environment cannot short-circuit a test of the loop. Add three Linux tests that build the probe DSO under a temp root: a lib/-only root is found and its retained identity is the lib/ file, lib64/ wins when both directories exist, and an empty root reports both candidates in the tried list. The first and the third fail against the lib64-only probe that main had. Name conda-forge and nixpkgs as the lib/ layouts in the crate docs, list the discovery order there, and record that only the unversioned libnvJitLink.so is probed under a root. Signed-off-by: nihalpasham <nihalp@nvidia.com>
…n refusal The refusal fires whenever either tool has no exact file: after a SONAME load, but also when the /proc/self/fd load falls back to a pathname load, when the digest is missing, or when the file changed. Call the SONAME load the usual cause rather than the only one, and list CUDA_TOOLKIT_PATH before CUDA_HOME, as the sys crates' own errors do. Signed-off-by: nihalpasham <nihalp@nvidia.com>
The nvjitlink-sys README, the cuda-host ltoir module docs and the cargo oxide doctor hint still said lib64 only. State the lib64-then-lib order, name conda-forge and nixpkgs as the lib/ layouts, and record that only the unversioned libnvJitLink.so is probed under a root, with LIBNVJITLINK_PATH as the way to name a versioned file. Signed-off-by: nihalpasham <nihalp@nvidia.com>
Collaborator
|
/ok to test a00a3da |
Collaborator
|
Thanks, this is the right fix: the probe loop is the one place every consumer reaches nvJitLink through, and lib64 stays first. On top:
I reproduced both sides here: with the system toolkit hidden and |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
nvjitlink-sys now probes
<root>/lib/libnvJitLink.soafter<root>/lib64/libnvJitLink.sounder each CUDA root, so a toolkit laid out withlib/(conda-forge, and nixpkgs as the in-tree flake joins it) gives the finalizer an exact file to fingerprint andcargo oxide build --materialize-cubinworks on such machines. Installer layouts keeplib64/first and behave as before. The materialization refusal now says which variables to set.What we fixed
open_libraryjoined onlylib64/libnvJitLink.sounder each root. A root laid out withlib/fell through to the SONAME branch, which carries no file identity, so the materializer handshake isNoneand both thecargo oxidehelper and the backend refuse materialization.CUDA_HOMEat alib/root,mainsilently took the system nvJitLink while libNVVM came from the configured root. Both now come from the configured root.LIBNVVM_PATH,LIBNVJITLINK_PATH,CUDA_TOOLKIT_PATHandCUDA_HOME, and calls the SONAME load the usual cause.Implementation
library_candidates(roots)yields<root>/lib64/libnvJitLink.sothen<root>/lib/libnvJitLink.soper root.open_libraryiterates it through the unchangedopen_library_path(canonicalize, retained/proc/self/fdload, identity capture), so alib/hit is fingerprinted the same way alib64hit is, and a missing or unloadable file falls through to the next candidate.LIBNVJITLINK_PATHfirst and the SONAME fallback last are unchanged. libnvvm-sys is untouched because these layouts keepnvvm/lib64/.open_library_under_rootsseam that loads a probe DSO from<root>/lib/with nolib64/and checks the retained identity, lib64-first precedence and the empty-root negative case.ltoirdiscovery docs and thecargo oxide doctorhint describe the new order and the unversioned-name limit.Verification
Checked at
a00a3da13(nightly-2026-10-11, RTX 5090):cargo test -p nvjitlink-sys(16 passed, 3 ignored toolkit tests, doctest passed),-p cargo-oxide(255),-p cuda-artifact-finalizer(33),-p cuda-host(108); clippy and rustdoc with warnings as errors; fmt; the lock check; all 18 guards./usr/local/cuda-13.4and-13.3hidden andCUDA_HOMEat a conda-style root (lib/libnvJitLink.so.13.4.92,nvvm/lib64/libnvvm.so, nolib64/):mainexits 2 with the refusal; this branch printsOutput format: materialized cubinandSUCCESS: All 1024 elements correct!, with the root'slib/copy as the fingerprinted file. memcheck on the materializedvecadd: 0 errors.CUDA_HOMEunset gives byte-identical handshakes before and after; a root with both directories still pickslib64/; a brokenlib/candidate falls through to the next root; plainvecadd.ptxidentical tomain.CUDA_HOME=$CONDA_PREFIX,mainfails with the refusal and this branch materializes and runs on an RTX PRO 6000.Caveats
libnvJitLink.sois probed under a root. A runtime-only conda env or a pip wheel that ships onlylibnvJitLink.so.13still takes the SONAME route and is refused for materialization;LIBNVJITLINK_PATHat the versioned file works and is what the message now says.lib/libnvJitLink.sois older than the toolkit's libNVVM now fails loudly in nvJitLink wheremainused the system copy by accident.