cuda_core: derive error enum explanations from bindings docstrings#1860
Open
rwgk wants to merge 5 commits intoNVIDIA:mainfrom
Open
cuda_core: derive error enum explanations from bindings docstrings#1860rwgk wants to merge 5 commits intoNVIDIA:mainfrom
rwgk wants to merge 5 commits intoNVIDIA:mainfrom
Conversation
Use cleaned driver/runtime enum __doc__ text from cuda-bindings 13.2.0+ as the primary source for CUDA error explanations in cuda_core, while freezing the 13.1.1 explanation tables as fallback for older bindings. Centralize the version-gated selection and docstring cleanup helpers, update the driver/runtime explanation modules to use them, add tests that verify representative enums expose __doc__ and that cuda_utils attaches the explanation text, and remove the obsolete enum-reformat toolshed helper script. Made-with: Cursor
Contributor
|
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. |
Collaborator
Author
|
/ok to test |
|
Treat the 12.9.6 backport line as docstring-capable and reuse the same version predicate in tests so error explanations follow the bindings releases that already expose usable enum docs. Made-with: Cursor
Collaborator
Author
|
/ok to test |
Collaborator
Author
|
I manually reviewed the cleaned driver/runtime enum-doc output for both from __future__ import annotations
import cuda.bindings
from cuda.bindings import driver, runtime
from cuda.core._utils.enum_explanations_helpers import clean_enum_member_docstring
def dump_enum_docs(label, enum_type):
print(f"=== {label} ===")
for member in enum_type:
cleaned = clean_enum_member_docstring(member.__doc__)
print(f"{member.name} ({int(member)})")
print(cleaned if cleaned is not None else "<None>")
print()
def main():
print(f"cuda.bindings.__version__ = {cuda.bindings.__version__}")
print()
dump_enum_docs("driver.CUresult", driver.CUresult)
dump_enum_docs("runtime.cudaError_t", runtime.cudaError_t)
if __name__ == "__main__":
main()High-level result from the manual review:
|
Remove the old Doxygen ``::`` normalization path now that error explanations no longer depend on dict-vs-docstring parity checks. This keeps the helper focused on the cleanup rules that still affect user-facing CUDAError messages. Made-with: Cursor
Clarify that DocstringBackedExplanations is a compatibility shim for the existing ``.get(int(error))`` lookup shape, and trim a low-value implementation note from the docstring cleanup workaround comment. Made-with: Cursor
Remove redundant helper coverage now that DocstringBackedExplanations.get() and clean_enum_member_docstring() are already exercised elsewhere, and simplify the remaining test module imports. Made-with: Cursor
Collaborator
Author
|
/ok to test |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #1712
This PR grows out of the validation work under #1805. That work showed that driver/runtime error enums expose usable per-member
__doc__text once a small amount of normalization is applied. The enum docstrings are usable starting withcuda-bindings >= 13.2.0on the main branch, andcuda-bindings 12.9.6on the 12.9.x backport branch. See the comment below for a summary of a manual review of the cleaned enum docstrings.Summary
__doc__strings for driver/runtime error explanations incuda_corewhen12.9.6 <= cuda-bindings < 13.0.0orcuda-bindings >= 13.2.0__doc__enum_explanations_helpers.pycuda_utilscoverage to share the same version predicate and verify representative enums expose__doc__and that explanation text is attached to raisedCUDAErrorstoolshed/reformat_cuda_enums_as_py.py