Skip to content

Commit fb80cce

Browse files
committed
docs(typing): fix RST bullet format, accuracy issues, and version notes in StrEnum docstrings
- Convert all enum member descriptions to RST bullet list format (* ``MEMBER`` -- description) so Sphinx renders them as a list rather than a run-on paragraph - Fix VirtualMemoryAllocationType.PINNED: remove incorrect "page-locked host memory" wording; backing location is device by default and controlled by VirtualMemoryLocationType - Fix CompilerBackendType class summary: backend is inferred from Program.code_type and exposed on Program.backend, not selected via ProgramOptions - Move CUDA 13+ version note from ManagedMemoryLocationType.HOST_NUMA to VirtualMemoryAllocationType.MANAGED (the actual 13+-gated member; ManagedMemoryResource already requires CUDA 13 so the HOST_NUMA note was misleading) - Fix ObjectCodeFormatType summary to mention Linker.link and Program.as_bytes alongside Program.compile
1 parent 88e5576 commit fb80cce

1 file changed

Lines changed: 41 additions & 41 deletions

File tree

cuda_core/cuda/core/typing.py

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@
4545
class SourceCodeType(StrEnum):
4646
"""Source language passed to :class:`~cuda.core.Program`.
4747
48-
``CXX`` selects CUDA C++, ``PTX`` selects PTX assembly text, and
49-
``NVVM`` selects NVVM IR (LLVM bitcode).
48+
* ``CXX`` — CUDA C++ source.
49+
* ``PTX`` — PTX assembly text.
50+
* ``NVVM`` — NVVM IR (LLVM bitcode).
5051
"""
5152

5253
CXX = "c++"
@@ -55,14 +56,14 @@ class SourceCodeType(StrEnum):
5556

5657

5758
class ObjectCodeFormatType(StrEnum):
58-
"""Output format produced by :meth:`~cuda.core.Program.compile`.
59-
60-
``PTX`` — PTX assembly text.
61-
``CUBIN`` — device-native CUDA binary.
62-
``LTOIR`` — LTO (link-time optimization) IR for later linking.
63-
``FATBIN`` — fat binary bundling multiple device images.
64-
``OBJECT`` — relocatable device object.
65-
``LIBRARY`` — device code library.
59+
"""Output format for :meth:`~cuda.core.Program.compile`, :meth:`~cuda.core.Linker.link`, and :meth:`~cuda.core.Program.as_bytes`.
60+
61+
* ``PTX`` — PTX assembly text.
62+
* ``CUBIN`` — device-native CUDA binary.
63+
* ``LTOIR`` — LTO (link-time optimization) IR for later linking.
64+
* ``FATBIN`` — fat binary bundling multiple device images.
65+
* ``OBJECT`` — relocatable device object.
66+
* ``LIBRARY`` — device code library.
6667
"""
6768

6869
PTX = "ptx"
@@ -74,12 +75,12 @@ class ObjectCodeFormatType(StrEnum):
7475

7576

7677
class CompilerBackendType(StrEnum):
77-
"""Compiler backend selected via :class:`~cuda.core.ProgramOptions`.
78+
"""Compiler backend inferred from the program's code type and exposed on :attr:`~cuda.core.Program.backend`.
7879
79-
``NVRTC`` — NVIDIA Runtime Compilation.
80-
``NVVM`` — NVVM LLVM backend.
81-
``NVJITLINK`` — nvJitLink device-side linker.
82-
``DRIVER`` — CUDA driver PTX JIT compiler.
80+
* ``NVRTC`` — NVIDIA Runtime Compilation.
81+
* ``NVVM`` — NVVM LLVM backend.
82+
* ``NVJITLINK`` — nvJitLink device-side linker.
83+
* ``DRIVER`` — CUDA driver PTX JIT compiler.
8384
"""
8485

8586
NVRTC = "NVRTC"
@@ -91,10 +92,9 @@ class CompilerBackendType(StrEnum):
9192
class PCHStatusType(StrEnum):
9293
"""Precompiled-header (PCH) outcome reported by :meth:`~cuda.core.Program.compile`.
9394
94-
``CREATED`` — PCH was successfully written.
95-
``NOT_ATTEMPTED`` — PCH creation was skipped (backend does not support it or
96-
the option was not requested).
97-
``FAILED`` — PCH creation was attempted but failed.
95+
* ``CREATED`` — PCH was successfully written.
96+
* ``NOT_ATTEMPTED`` — PCH creation was skipped (backend does not support it or the option was not requested).
97+
* ``FAILED`` — PCH creation was attempted but failed.
9898
"""
9999

100100
CREATED = "created"
@@ -105,9 +105,9 @@ class PCHStatusType(StrEnum):
105105
class GraphConditionalType(StrEnum):
106106
"""Conditional node flavor for :class:`~cuda.core.graph.GraphBuilder`.
107107
108-
``IF`` — body graph executes at most once based on a condition.
109-
``WHILE`` — body graph loops while the condition is true.
110-
``SWITCH`` — selects one child graph by an integer index.
108+
* ``IF`` — body graph executes at most once based on a condition.
109+
* ``WHILE`` — body graph loops while the condition is true.
110+
* ``SWITCH`` — selects one child graph by an integer index.
111111
"""
112112

113113
IF = "if"
@@ -118,9 +118,9 @@ class GraphConditionalType(StrEnum):
118118
class GraphMemoryType(StrEnum):
119119
"""Memory space for a graph memory-allocation or free node.
120120
121-
``DEVICE`` — GPU device memory.
122-
``HOST`` — pinned host memory.
123-
``MANAGED`` — CUDA managed (unified) memory.
121+
* ``DEVICE`` — GPU device memory.
122+
* ``HOST`` — pinned host memory.
123+
* ``MANAGED`` — CUDA managed (unified) memory.
124124
"""
125125

126126
DEVICE = "device"
@@ -131,9 +131,9 @@ class GraphMemoryType(StrEnum):
131131
class ManagedMemoryLocationType(StrEnum):
132132
"""Destination type for managed-memory prefetch and advise operations.
133133
134-
``DEVICE`` — target a GPU device.
135-
``HOST`` — target the CPU host (any NUMA node).
136-
``HOST_NUMA`` — target a specific host NUMA node (CUDA 13+ only).
134+
* ``DEVICE`` — target a GPU device.
135+
* ``HOST`` — target the CPU host (any NUMA node).
136+
* ``HOST_NUMA`` — target a specific host NUMA node.
137137
"""
138138

139139
DEVICE = "device"
@@ -144,9 +144,9 @@ class ManagedMemoryLocationType(StrEnum):
144144
class VirtualMemoryHandleType(StrEnum):
145145
"""OS handle type for exporting virtual memory allocations across processes.
146146
147-
``POSIX_FD`` — POSIX file descriptor (Linux).
148-
``WIN32_KMT`` — Win32 kernel-mode handle (Windows).
149-
``FABRIC`` — NVLink/NVSwitch fabric handle for multi-node topologies.
147+
* ``POSIX_FD`` — POSIX file descriptor (Linux).
148+
* ``WIN32_KMT`` — Win32 kernel-mode handle (Windows).
149+
* ``FABRIC`` — NVLink/NVSwitch fabric handle for multi-node topologies.
150150
"""
151151

152152
POSIX_FD = "posix_fd"
@@ -157,10 +157,10 @@ class VirtualMemoryHandleType(StrEnum):
157157
class VirtualMemoryLocationType(StrEnum):
158158
"""Physical backing location for a virtual memory allocation.
159159
160-
``DEVICE`` — GPU device memory.
161-
``HOST`` — pinned host memory.
162-
``HOST_NUMA`` — host memory pinned to a specific NUMA node.
163-
``HOST_NUMA_CURRENT`` — host memory on the calling thread's NUMA node.
160+
* ``DEVICE`` — GPU device memory.
161+
* ``HOST`` — pinned host memory.
162+
* ``HOST_NUMA`` — host memory pinned to a specific NUMA node.
163+
* ``HOST_NUMA_CURRENT`` — host memory on the calling thread's NUMA node.
164164
"""
165165

166166
DEVICE = "device"
@@ -172,8 +172,8 @@ class VirtualMemoryLocationType(StrEnum):
172172
class VirtualMemoryGranularityType(StrEnum):
173173
"""Granularity query type for virtual memory allocations.
174174
175-
``MINIMUM`` — smallest allocation size supported by the device.
176-
``RECOMMENDED`` — granularity that yields best performance on the device.
175+
* ``MINIMUM`` — smallest allocation size supported by the device.
176+
* ``RECOMMENDED`` — granularity that yields best performance on the device.
177177
"""
178178

179179
MINIMUM = "minimum"
@@ -183,8 +183,8 @@ class VirtualMemoryGranularityType(StrEnum):
183183
class VirtualMemoryAccessType(StrEnum):
184184
"""Access permissions for a virtual memory mapping.
185185
186-
``READ_WRITE`` — both read and write access.
187-
``READ`` — read-only access.
186+
* ``READ_WRITE`` — both read and write access.
187+
* ``READ`` — read-only access.
188188
"""
189189

190190
READ_WRITE = "rw"
@@ -194,8 +194,8 @@ class VirtualMemoryAccessType(StrEnum):
194194
class VirtualMemoryAllocationType(StrEnum):
195195
"""Physical memory type for a virtual memory backing allocation.
196196
197-
``PINNED`` — page-locked (pinned) host memory.
198-
``MANAGED`` — CUDA managed (unified) memory.
197+
* ``PINNED`` — pinned/non-migratable physical allocation (placement via :class:`VirtualMemoryLocationType`).
198+
* ``MANAGED`` — CUDA managed (unified) memory (CUDA 13+ only).
199199
"""
200200

201201
PINNED = "pinned"

0 commit comments

Comments
 (0)