Skip to content

[FEA]: Add CUDA driver version query to cuda.pathfinder (private API)#1953

Merged
rwgk merged 16 commits intoNVIDIA:mainfrom
rwgk:pathfinder_driver_info
Apr 24, 2026
Merged

[FEA]: Add CUDA driver version query to cuda.pathfinder (private API)#1953
rwgk merged 16 commits intoNVIDIA:mainfrom
rwgk:pathfinder_driver_info

Conversation

@rwgk
Copy link
Copy Markdown
Contributor

@rwgk rwgk commented Apr 19, 2026

xref: #1038, #1936

  • add a small cuda.pathfinder._utils.driver_info helper backed by cuDriverGetVersion() so cuda.pathfinder can query the CUDA-facing driver version
  • introduce DriverCudaVersion, QueryDriverCudaVersionError, and cached query_driver_cuda_version(), with naming and docstrings that make it explicit this matches nvidia-smi's CUDA Version
  • re-export the new API from cuda.pathfinder, document it in cuda_pathfinder/docs/source/api.rst, and add focused unit, real-driver, and public-import regression tests

All new INFO lines are identical across all CI test logs:

https://github.com/NVIDIA/cuda-python/actions/runs/24639785901/attempts/1?pr=1953

INFO test_real_query_driver_cuda_version: driver_version=13.0 (encoded=13000)

rwgk added 11 commits April 19, 2026 11:04
Break out CUDA driver version querying into a standalone internal utility so it can be reused independently from compatibility checks, and cover the ctypes loader paths with focused tests.

Made-with: Cursor
Treat the Windows WinDLL path as the normal runtime case and keep the focused tests aligned with the stricter driver-loader invariants.

Made-with: Cursor
Wrap the encoded cuDriverGetVersion() result in a DriverVersion dataclass so callers can use major and minor fields directly while retaining a low-level integer helper for loader-focused tests.

Made-with: Cursor
Cover query_driver_version() alongside the driver library loading tests and reuse the existing strictness mode so host-specific failures still surface cleanly in all_must_work mode.

Made-with: Cursor
Drop the non-Windows loader mock now that a real driver-version test covers the Linux success path, while keeping the Windows branch and failure-path unit coverage.

Made-with: Cursor
Use DriverCudaVersion for clearer pairing with the planned release-version type while keeping the existing driver info API behavior unchanged.

Made-with: Cursor
Query nvmlSystemGetDriverVersion() through pathfinder's driver library loading path and add a minimal real test so the implementation is preserved as a future reference.

Made-with: Cursor
Step back from the exploratory NVML-based release-version query for now because it adds non-trivial complexity and a new dependency surface without a current pathfinder need, while keeping the reference implementation in history if we need it later.

Made-with: Cursor
Document that DriverCudaVersion matches the CUDA Version shown by nvidia-smi rather than the graphics driver release, so the dataclass name reads clearly in context.

Made-with: Cursor
Expose DriverCudaVersion, QueryDriverCudaVersionError, and query_driver_cuda_version publicly, and align the internal naming, caching, docs, and test coverage around the CUDA-specific driver version query.

Made-with: Cursor
Protect the new top-level driver-info re-exports so internal-only test coverage does not miss a broken `cuda.pathfinder` plumbing layer.

Made-with: Cursor
@rwgk rwgk added this to the cuda.pathfinder next milestone Apr 19, 2026
@rwgk rwgk self-assigned this Apr 19, 2026
@rwgk rwgk added P0 High priority - Must do! feature New feature or request cuda.pathfinder Everything related to the cuda.pathfinder module labels Apr 19, 2026
@copy-pr-bot
Copy link
Copy Markdown
Contributor

copy-pr-bot Bot commented Apr 19, 2026

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@rwgk
Copy link
Copy Markdown
Contributor Author

rwgk commented Apr 19, 2026

/ok to test

@github-actions

This comment has been minimized.

@rwgk rwgk marked this pull request as ready for review April 20, 2026 03:54
@rwgk rwgk requested a review from mdboom April 21, 2026 04:09
Comment thread cuda_pathfinder/cuda/pathfinder/__init__.py
rwgk added 3 commits April 21, 2026 10:35
Stop exposing the new driver info helper through cuda.pathfinder while keeping the internal implementation and internal test coverage in place.

Made-with: Cursor
@rwgk
Copy link
Copy Markdown
Contributor Author

rwgk commented Apr 21, 2026

/ok to test

@rwgk
Copy link
Copy Markdown
Contributor Author

rwgk commented Apr 21, 2026

Oh, I forgot to remove the change in api.rst. Sec.

@rwgk rwgk changed the title [FEA]: Add public CUDA driver version query to cuda.pathfinder [FEA]: Add CUDA driver version query to cuda.pathfinder (private API) Apr 21, 2026
Copy link
Copy Markdown
Member

@leofang leofang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Comment on lines +26 to +28
The name ``DriverCudaVersion`` is intentionally specific: this dataclass
models the version shown as ``CUDA Version`` in ``nvidia-smi``, not the
graphics driver release shown as ``Driver Version``.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In other words, this class records the UMD version, not the KMD version

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I added commit 0d7c8f8 to add that information on.

Spell out that `cuDriverGetVersion()` reports the CUDA-facing user-mode driver (UMD) version rather than the kernel-mode driver (KMD) package version so the `nvidia-smi` comparison is less ambiguous.

Made-with: Cursor
@rwgk rwgk enabled auto-merge (squash) April 24, 2026 20:58
rwgk added a commit to rwgk/cuda-python that referenced this pull request Apr 24, 2026
@rwgk rwgk merged commit 9eec539 into NVIDIA:main Apr 24, 2026
75 of 76 checks passed
@rwgk rwgk deleted the pathfinder_driver_info branch April 24, 2026 21:54
@github-actions
Copy link
Copy Markdown

Doc Preview CI
Preview removed because the pull request was closed or merged.

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

Labels

cuda.pathfinder Everything related to the cuda.pathfinder module feature New feature or request P0 High priority - Must do!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants