Skip to content

fix(cuda.core): fall back to driver when nvJitLink < 12.3 is installed#2409

Open
atiaomar1978-hub wants to merge 3 commits into
NVIDIA:mainfrom
atiaomar1978-hub:fix/linker-nvjitlink-fallback-2408
Open

fix(cuda.core): fall back to driver when nvJitLink < 12.3 is installed#2409
atiaomar1978-hub wants to merge 3 commits into
NVIDIA:mainfrom
atiaomar1978-hub:fix/linker-nvjitlink-fallback-2408

Conversation

@atiaomar1978-hub

@atiaomar1978-hub atiaomar1978-hub commented Jul 23, 2026

Copy link
Copy Markdown

Summary

Fixes #2408.

When nvJitLink 12.0–12.2 is installed, Linker.which_backend() and Linker construction raised FunctionNotFoundError: function nvJitLinkVersion is not found instead of warning and falling back to the driver (cuLink) backend.

This is a regression introduced in cuda-core 0.7.0. cuda-core 0.6.0 handled this correctly.

Root cause

nvJitLink 12.0–12.2 only export versioned symbols (__nvJitLink*_12_X); the unversioned nvJitLinkVersion export was added in 12.3.

Since cuda-core >= 0.7.0, _decide_nvjitlink_or_driver() probed availability via:

_optional_cuda_import(
    "cuda.bindings.nvjitlink",
    probe_function=lambda module: module.version(),
)

On nvJitLink 12.0–12.2, module.version() calls the missing unversioned symbol and raises FunctionNotFoundError. _optional_cuda_import() only treats DynamicLibNotFoundError as "unavailable", so the exception escapes instead of triggering driver fallback.

cuda-core 0.6.0 used _inspect_function_pointer("__nvJitLinkVersion") (symbol pointer inspection, no function call), which handled this correctly.

Fix

Stop probing via module.version(). Import cuda.bindings.nvjitlink without a probe function and rely on the existing _nvjitlink_has_version_symbol() helper for the >= 12.3 check.

Reproduction (before fix)

pip install "cuda-core==1.1.0" "cuda-bindings==12.9.7" "cuda-toolkit[nvjitlink]==12.0.1"
python -c "from cuda.core import Linker; print(Linker.which_backend())"

Result: FunctionNotFoundError: function nvJitLinkVersion is not found

Independently confirmed on Windows x86_64 (no NVIDIA GPU) with Python 3.12.10 and nvidia-nvjitlink-cu12==12.0.140.

Expected (and restored) behavior:

>>> Linker.which_backend()
RuntimeWarning: ... is too old (<12.3) ...
'driver'

Tests added

Test plan

  • Added unit/integration coverage for nvJitLink < 12.3 fallback path
  • Ran cuda_pathfinder/tests/test_optional_cuda_import.py locally (5 passed)
  • cuda_core tests require NVIDIA driver/GPU locally (nvcuda.dll); CI will run full suite
  • Manual repro with cuda-toolkit[nvjitlink]==12.0.1 returns "driver" with RuntimeWarning

CI note

The failing PR has assignee, labels, and milestone check is a metadata gate, not a code/test failure. External contributors cannot add the required bug label, assignee, or milestone. Could a maintainer please add:

  • Label: bug
  • Milestone: cuda.core 1.2.0 (or appropriate release)
  • Assignee: triage owner

Signed-off-by: Omar Atie atiaomar1978-hub@users.noreply.github.com

@copy-pr-bot

copy-pr-bot Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@atiaomar1978-hub

Copy link
Copy Markdown
Author

CI run 29979997352

The failing job \PR has assignee, labels, and milestone\ is a metadata gate (missing \�ug\ label, assignee, and milestone). I cannot set these as an external contributor.

Updates in latest push

  • Added regression coverage:
    • \ est_which_backend_falls_back_when_nvjitlink_too_old\
    • \ est_decide_nvjitlink_or_driver_falls_back_when_nvjitlink_too_old\
    • \ est_decide_nvjitlink_or_driver_selects_nvjitlink_when_version_symbol_present\
  • Local tests run:
    • \cuda_pathfinder/tests/test_optional_cuda_import.py: 5 passed
    • \cuda_core/tests/test_optional_dependency_imports.py: blocked locally by missing
      vcuda.dll\ (no GPU on this machine); CI should cover these

Could a maintainer please add the \�ug\ label, assignee, and milestone so the metadata check passes?

@atiaomar1978-hub

Copy link
Copy Markdown
Author

About me:
I’m Omar Atie, an open‑source contributor with experience building high‑performance integration systems, AI components, and modern data‑processing features in Apache Camel. My work spans distributed systems, API design, and component development, with a focus on reliability, performance, and clean architecture. I’m now expanding into CUDA open‑source development to contribute to GPU‑accelerated computing, improve developer experience, and help strengthen NVIDIA’s ecosystem through practical, high‑impact contributions.

Request:
I’d appreciate feedback from maintainers on how to best align this contribution with NVIDIA’s internal coding standards.
If workflow approvals, GitHub Actions permissions, or metadata updates are required, please guide me and I’ll make the necessary adjustments.
I’m also interested in becoming an active contributor in the CUDA ecosystem, so any guidance on how to integrate effectively with the team and contribution process would be greatly appreciated.

atiaomar1978-hub and others added 2 commits July 23, 2026 16:06
Stop probing nvJitLink availability via module.version(), which calls
the unversioned nvJitLinkVersion symbol missing in nvJitLink 12.0-12.2.
Use symbol pointer inspection via _nvjitlink_has_version_symbol()
instead, restoring cuda-core 0.6.0 fallback behavior.

Fixes NVIDIA#2408

Signed-off-by: Omar Atie <atiaomar1978-hub@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Add regression tests for Linker.which_backend() and
_decide_nvjitlink_or_driver() when the nvJitLinkVersion symbol is
missing (nvJitLink 12.0-12.2).

Related to NVIDIA#2408

Signed-off-by: Omar Atie <atiaomar1978-hub@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@atiaomar1978-hub
atiaomar1978-hub force-pushed the fix/linker-nvjitlink-fallback-2408 branch from f0c5775 to 7f6a534 Compare July 23, 2026 23:08
Document the NVIDIA#2408 regression fix in the cuda.core 1.2.0 release notes.

Related to NVIDIA#2408

Signed-off-by: Omar Atie <atiaomar1978-hub@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@atiaomar1978-hub

Copy link
Copy Markdown
Author

Added release notes entry

Pushed a follow-up commit adding a cuda.core 1.2.0 release note under Fixes and enhancements documenting the #2408 regression fix (cuda_core/docs/source/release/1.2.0-notes.rst).

All commits on this branch are signed and show as verified on GitHub.

Current branch

Commit Purpose Verified
4ee6ae0 Fix: fall back to driver when nvJitLink < 12.3
7f6a534 Tests: regression coverage
91a1f4f Docs: 1.2.0 release note

Still blocked only by maintainer metadata (assignee, \�ug\ label, milestone) and the external-contributor workflow approval (\copy-pr-bot). Happy to adjust anything on request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda.core Everything related to the cuda.core module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Linker raises FunctionNotFoundError instead of falling back to the driver when nvJitLink < 12.3 is installed

1 participant