Skip to content

cuda.core: consolidate driver version query functions#2040

Open
leofang wants to merge 3 commits intoNVIDIA:mainfrom
leofang:consolidate-driver-version
Open

cuda.core: consolidate driver version query functions#2040
leofang wants to merge 3 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

from .conftest import skip_if_nvml_unsupported


@skip_if_nvml_unsupported
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why does nvml have to be supported to check the driver version?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Because this PR now uses NVML API calls exclusively.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yeah, I'd argue there should be more traces to the reader to make that obvious. That coupled with the incorrect header at the top of the file make it difficult to parse.

assert 0 <= ver_patch[0] <= 99
def test_driver_version_requires_nvml():
if system.CUDA_BINDINGS_NVML_IS_COMPATIBLE:
pytest.skip("NVML is available, cannot test the error path")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

More comments explaining why NVML being available prevents testing would be a good trace for the reader.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Because this test needs a negation for @skip_if_nvml_unsupported.

@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

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.

2 participants