-
Notifications
You must be signed in to change notification settings - Fork 279
Move enum explanations and health checks from cuda_core to cuda_bindings #1805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 8 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
85d9e66
Copy enum explanation dicts and health-check tests to cuda_bindings (…
rwgk f35670a
Remove enum explanation health tests from cuda_core (#1712)
rwgk d6b3e78
cuda_core: prefer enum explanations from cuda.bindings, keep local fa…
rwgk b54ec83
Add _CTK_MAJOR_MINOR_PATCH version guards and DRY up explanation test…
rwgk 3f6c30f
Clean up test code: parametrize bindings health tests, drop no-op f-s…
rwgk b1645c0
Update pathfinder descriptor catalogs for cusparseLt release 0.9.0
rwgk fb12195
Merge branch 'main' into move_enum_explanations
rwgk 47e9c2d
Merge branch 'main' into move_enum_explanations
rwgk 89a2052
Merge branch 'main' into move_enum_explanations
rwgk 6fc77b7
Delete cuda_core fallback explanation copies, import from cuda.bindin…
rwgk 112fb41
Merge branch 'main' into move_enum_explanations
rwgk 914ffd6
Revert to original dict names and drop _CTK_MAJOR_MINOR_PATCH (#1712)
rwgk 07d522d
Merge branch 'main' into move_enum_explanations
rwgk 76efdf6
cuda_bindings: compare explanation dicts to CUresult/cudaError_t __doc__
rwgk 86e9488
cuda_bindings: add clean_enum_member_docstring helper in enum explana…
rwgk f4094c5
cuda_bindings: compare explanation dicts to cleaned enum __doc__ in h…
rwgk 4adec22
cuda_bindings: improve dict/__doc__ parity test (Doxygen :: strip, de…
rwgk 1ce9bc8
cuda_bindings: collapse wrapped hyphen spaces in clean_enum_member_do…
rwgk cbebba0
cuda_bindings: fix Interactions __doc__ workaround and CUDART_DRIVER …
rwgk ba2f65a
cuda_bindings: skip cudaErrorLaunchTimeout in dict vs cleaned __doc__…
rwgk 2d14279
Merge branch 'main' into move_enum_explanations
rwgk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE |
359 changes: 359 additions & 0 deletions
359
cuda_bindings/cuda/bindings/_utils/driver_cu_result_explanations.py
Large diffs are not rendered by default.
Oops, something went wrong.
552 changes: 552 additions & 0 deletions
552
cuda_bindings/cuda/bindings/_utils/runtime_cuda_error_explanations.py
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE | ||
|
|
||
| import importlib | ||
| import importlib.metadata | ||
|
|
||
| import pytest | ||
|
|
||
| from cuda.bindings import driver, runtime | ||
|
|
||
| _EXPLANATION_MODULES = [ | ||
| ("driver_cu_result_explanations", driver.CUresult), | ||
| ("runtime_cuda_error_explanations", runtime.cudaError_t), | ||
| ] | ||
|
|
||
|
|
||
| def _get_binding_version(): | ||
| try: | ||
| major_minor = importlib.metadata.version("cuda-bindings").split(".")[:2] | ||
| except importlib.metadata.PackageNotFoundError: | ||
| major_minor = importlib.metadata.version("cuda-python").split(".")[:2] | ||
| return tuple(int(v) for v in major_minor) | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("module_name,enum_type", _EXPLANATION_MODULES) | ||
| def test_explanations_health(module_name, enum_type): | ||
| mod = importlib.import_module(f"cuda.bindings._utils.{module_name}") | ||
| expl_dict = mod._EXPLANATIONS | ||
|
|
||
| known_codes = set() | ||
| for error in enum_type: | ||
| code = int(error) | ||
| assert code in expl_dict | ||
| known_codes.add(code) | ||
|
|
||
| if _get_binding_version() >= (13, 0): | ||
| extra_expl = sorted(set(expl_dict.keys()) - known_codes) | ||
| assert not extra_expl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have to duplicate this error text list? Can we hoist it into a central location?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally my proposal was to avoid this copy (see the #1712 issue description, Backward compatibility section), but @leofang argued for vendoring (see issue comments).
Not if we want future cuda-core releases to produce the enhanced error messages even if used in combination with cuda-binding releases made before this PR was merged.
On balance, I still feel the better compromise is to delete this copy, and to change
cuda_core/cuda/core/_utils/cuda_utils.pyxto skip enhancing the error messages if the dict is not in cuda-bindings. It's really only a nice-to-have that will be easy to get back by using the latest cuda-bindings.