cuda.core: add docstrings to Host properties and public StrEnum types#2134
cuda.core: add docstrings to Host properties and public StrEnum types#2134aryanputta wants to merge 3 commits into
Conversation
Each StrEnum class in cuda.core.typing now has a class-level docstring that states its purpose and briefly describes every member value. Sphinx and help() now show meaningful descriptions for CompilerBackendType, GraphConditionalType, GraphMemoryType, ManagedMemoryLocationType, ObjectCodeFormatType, PCHStatusType, SourceCodeType, VirtualMemory*. No logic changes.
…urrent Host is a new 1.1.0 API. The class-level docstring is complete but the two public properties had no docstrings, leaving them blank in generated API docs and in help().
|
@leofang @rwgk — flagging this for your awareness in the context of #2131. This is a doc-only contribution to
Happy to split into two PRs if that's easier to review, or adjust wording on any of the docstrings. |
|
@Andy-Jost — one style question before this is review-ready. For the class ObjectCodeFormatType(StrEnum):
"""Output format produced by :meth:`~cuda.core.Program.compile`.
``PTX`` — PTX assembly text.
``CUBIN`` — device-native CUDA binary.
``LTOIR`` — LTO (link-time optimization) IR for later linking.
``FATBIN`` — fat binary bundling multiple device images.
``OBJECT`` — relocatable device object.
``LIBRARY`` — device code library.
"""The question is whether that level of detail is right for members that are fairly self-explanatory from their name and string value ( A) Keep per-member descriptions i tried to keep it consistent across all 11 types, useful in B) Class-level summary only, drop the member list for this i led to a shorter approach which avoids redundancy for obvious members. Something like: class ObjectCodeFormatType(StrEnum):
"""Output format produced by :meth:`~cuda.core.Program.compile`.
Accepted values: ``PTX``, ``CUBIN``, ``LTOIR``, ``FATBIN``, ``OBJECT``, ``LIBRARY``.
"""Happy to go either way — just want to match the preferred convention here before this gets reviewed. |
- is_numa_current: lead with return type (``True`` if ...) to match bool-property docstring convention; keep :meth:`numa_current` cross-ref - WIN32_KMT: drop "D3DKMT" (DirectX-specific); CU_MEM_HANDLE_TYPE_WIN32_KMT maps to a general WDDM kernel-mode handle, not a D3D handle
8d2960a to
88e5576
Compare
Summary
Contributes to the doc-finalization step of #2131.
Two doc-only changes to
cuda.core, touching no logic:cuda/core/_host.py— Host property docstringsHostis a new 1.1.0 API (release notes: #2131 checklist item "Finalize the doc update"). The class-level docstring is already complete, butnuma_idandis_numa_currenthad no docstrings, leaving them blank in generated API docs andhelp():cuda/core/typing.py— StrEnum class docstringsAll 12 public
StrEnumsubclasses (SourceCodeType,ObjectCodeFormatType,CompilerBackendType,PCHStatusType,GraphConditionalType,GraphMemoryType,ManagedMemoryLocationType,VirtualMemoryHandleType,VirtualMemoryLocationType,VirtualMemoryGranularityType,VirtualMemoryAccessType,VirtualMemoryAllocationType) previously had zero class-level docstrings. Each now has a short description and a one-liner per member sohelp()and Sphinx show meaningful output.Checklist
cuda.coreonly — nocuda.bindingsfiles touchedHost.numa_current,ManagedBuffermethods)