Skip to content

cuda.core: consolidate driver version query functions#2040

Merged
leofang merged 8 commits intoNVIDIA:mainfrom
leofang:consolidate-driver-version
May 7, 2026
Merged

cuda.core: consolidate driver version query functions#2040
leofang merged 8 commits intoNVIDIA:mainfrom
leofang:consolidate-driver-version

Conversation

@leofang
Copy link
Copy Markdown
Member

@leofang leofang commented May 6, 2026

Summary

Consolidate get_driver_version() and get_driver_version_full() into a single get_driver_version() that returns (umd_version, kmd_version) — a pair of version tuples (UMD is a 2-tuple (MAJOR, MINOR), KMD is a 3-tuple (MAJOR, MINOR, PATCH)).

The function now requires NVML and raises RuntimeError if it is not available.

  • Removes the kernel_mode parameter and the separate get_driver_version_full function
  • Updates tests, docs, and 1.0.0 release notes

Merge the two separate driver version query functions into a single
get_driver_version() that returns (umd_version, kmd_version) — a pair
of version tuples. UMD is a 2-tuple (major, minor) and KMD is a
3-tuple (major, minor, patch). The function now requires NVML.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@copy-pr-bot
Copy link
Copy Markdown
Contributor

copy-pr-bot Bot commented May 6, 2026

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.

@github-actions github-actions Bot added the cuda.core Everything related to the cuda.core module label May 6, 2026
@leofang leofang self-assigned this May 6, 2026
@leofang leofang requested a review from mdboom May 6, 2026 21:18
@leofang leofang added enhancement Any code-related improvements P0 High priority - Must do! breaking Breaking changes are introduced labels May 6, 2026
@leofang leofang added this to the cuda.core v1.0.0 milestone May 6, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@leofang
Copy link
Copy Markdown
Member Author

leofang commented May 6, 2026

/ok to test bfd9ab9

@leofang leofang marked this pull request as ready for review May 6, 2026 21:33
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

Windows driver version strings only have two components, so
nvmlSystemGetDriverVersion returns X.Y on WSL instead of X.Y.Z.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@leofang
Copy link
Copy Markdown
Member Author

leofang commented May 6, 2026

/ok to test d2d387e

Comment thread cuda_core/tests/system/test_system_system.py Outdated
Comment thread cuda_core/tests/system/test_system_system.py
@rparolin
Copy link
Copy Markdown
Collaborator

rparolin commented May 6, 2026

Nit: the file-level comment at _system.pyx#L6-L8 still states that functions must "fall back to non-NVML-based methods for backward compatibility" when cuda.bindings.nvml isn't available. After this PR, get_driver_version() no longer follows that pattern (it raises RuntimeError instead), joining get_driver_branch() / get_nvml_version() which already required NVML. Worth tweaking the header to reflect that the file is now a mix — some functions fall back (e.g. get_num_devices), others require NVML.

Copy link
Copy Markdown
Collaborator

@rparolin rparolin left a comment

Choose a reason for hiding this comment

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

The changes are correct but some added context would make it obvious to reader why its correct. I've labeled them as nit to not block this PR.

@leofang
Copy link
Copy Markdown
Member Author

leofang commented May 6, 2026

Let me wait for @mdboom blessing before merging

Copy link
Copy Markdown
Contributor

@mdboom mdboom left a comment

Choose a reason for hiding this comment

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

I don't think we can make NVML a hard requirement, because it means we now require cuda_bindings >=12.9.6 or cuda_bindings >= 13.2.0. Don't we make broader guarantees in general for that?

To resolve that, maybe we just have two separate functions for kernel and cuda version, but remove the "_full" distinction (which was just there for backward compat).

leofang and others added 5 commits May 7, 2026 13:45
…rsion

Per review feedback, split the consolidated get_driver_version() into
two separate functions so each returns a simple tuple[int, ...]:

- get_user_mode_driver_version(): works with or without NVML (falls
  back to cuDriverGetVersion), returns (major, minor)
- get_kernel_mode_driver_version(): requires NVML, returns
  (major, minor, patch) or (major, minor) on WSL

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@leofang
Copy link
Copy Markdown
Member Author

leofang commented May 7, 2026

/ok to test f57003a

@leofang leofang requested a review from mdboom May 7, 2026 14:03
Copy link
Copy Markdown
Contributor

@mdboom mdboom left a comment

Choose a reason for hiding this comment

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

LGTM

@leofang leofang enabled auto-merge (squash) May 7, 2026 14:31
@leofang leofang merged commit 57a538c into NVIDIA:main May 7, 2026
94 checks passed
Copy link
Copy Markdown
Contributor

@rwgk rwgk left a comment

Choose a reason for hiding this comment

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

Ah, looks like I was too slow.

"get_kernel_mode_driver_version",
"get_num_devices",
"get_process_name",
"get_user_mode_driver_version",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For the cuda-pathfinder guard rails that I'm adding in pending PR #1977, I need both functions, too:

https://github.com/NVIDIA/cuda-python/pull/1977/changes#diff-e4eb8e0d6231c5ab21d8993a187523d4ef49b2b6eba39ee84b606968ea726722

Currently I have different naming. It might be good to keep the names aligned.

I was going with what nvidia-smi is showing, but that's changing. In the future it'll look like this:

+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI NNN.NN                 KMD Version: NNN.NN        CUDA UMD Version: NN.N     |
+-----------------------------------------+------------------------+----------------------+

So

get_driver_kmd_version
get_driver_cuda_umd_version

would be most aligned.

@leofang leofang deleted the consolidate-driver-version branch May 7, 2026 15:06
github-actions Bot pushed a commit that referenced this pull request May 8, 2026
Removed preview folders for the following PRs:
- PR #2040
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Breaking changes are introduced cuda.core Everything related to the cuda.core module enhancement Any code-related improvements P0 High priority - Must do!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants