Skip to content

Fix the function name in the get_minimal_required_cuda_ver_from_ptx_ver examples - #2556

Open
LeSingh1 wants to merge 1 commit into
NVIDIA:mainfrom
LeSingh1:ptx-utils-doctest-name
Open

Fix the function name in the get_minimal_required_cuda_ver_from_ptx_ver examples#2556
LeSingh1 wants to merge 1 commit into
NVIDIA:mainfrom
LeSingh1:ptx-utils-doctest-name

Conversation

@LeSingh1

@LeSingh1 LeSingh1 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

The Examples section of get_minimal_required_cuda_ver_from_ptx_ver() calls a function
that does not exist:

    Examples
    --------
    >>> get_minimal_required_driver_ver_from_ptx_ver("8.8")
    12090
    >>> get_minimal_required_driver_ver_from_ptx_ver("7.0")
    11000

get_minimal_required_**driver**_ver_from_ptx_ver appears nowhere else in the repo — I
grepped every .py, .pyx, .rst and .md; these two lines are the only hits. The
export in cuda/bindings/utils/__init__.py, the test in tests/test_utils.py,
docs/source/module/utils.rst and both release-notes files all use the ..._cuda_ver_...
spelling. It is a rename that missed its own docstring.

These are doctests, and autodoc renders this docstring into the public API docs, so users
are shown two calls that raise:

NameError: name 'get_minimal_required_driver_ver_from_ptx_ver' is not defined.
Did you mean: 'get_minimal_required_cuda_ver_from_ptx_ver'?

Nothing caught it because pytest is not run with --doctest-modules
(cuda_bindings/pyproject.toml sets addopts = "--benchmark-disable --showlocals").

Test

test_ptx_utils_docstring_examples runs doctest.testmod() over the module, next to the
existing test_ptx_utils. It reports 2 failures on main and 0 with this change, and
needs no GPU and no toolkit — _ptx_utils imports only re. It also covers the
get_ptx_ver example, which is correct today and now stays that way.

I scoped the test to this one module rather than turning on --doctest-modules repo-wide;
that is a bigger decision and would pull in the Cython modules' docstrings too.

Note: #2541 and #2551 also touch cuda_bindings/tests/test_utils.py — at the end of the
file and around line 117 respectively. This one lands next to test_ptx_utils near the
top, so the three are independent. Happy to rebase whichever lands last.

…er examples

The docstring's Examples section calls
get_minimal_required_driver_ver_from_ptx_ver, which exists nowhere in the
repo -- the function is get_minimal_required_cuda_ver_from_ptx_ver. The two
docstring lines are the only occurrences of the "driver" spelling; the
export in utils/__init__.py, tests/test_utils.py, docs/source/module/utils.rst
and the release notes all use the "cuda" spelling, so this is a rename that
missed its own docstring.

The examples are doctests, and they are rendered into the public API docs
via autodoc, so users are shown two calls that raise NameError. Nothing
caught it because pytest is not run with --doctest-modules.

Adds a test that runs doctest.testmod() over the module. It reports 2
failures before this change and 0 after, and needs no GPU or toolkit --
_ptx_utils imports only `re`.
@copy-pr-bot

copy-pr-bot Bot commented Aug 9, 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.

@github-actions github-actions Bot added the cuda.bindings Everything related to the cuda.bindings module label Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda.bindings Everything related to the cuda.bindings module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant