Skip to content

Commit a37c10a

Browse files
committed
cuda.core: keep the NVML constant's stub annotation-only; finish the text sweep (NVIDIA#2783)
The API check gates "Check job status", so the stub of CUDA_BINDINGS_NVML_IS_COMPATIBLE must keep the bare `bool` annotation it had: the constant is declared with the annotation and assigned in a runtime-only block, which the stub generator does not record. It is always True and no longer called deprecated. DeviceArch is a plain enum.IntEnum instead of subclassing cuda-bindings' private FastEnum. Remaining text that named cuda-bindings versions as feature requirements now names the driver and the CUDA 13 build: the copy-options messages and docstrings in _buffer.pyx and _copy_ops.pyx, the graph node update docstrings, api.rst, the checkpoint section and module docstring, install.rst on conda-forge, DESIGN.md's summary, AGENTS.md's path to it, and the test helpers. The hasattr/getattr probes for NVML members present at both floors are gone, as is the probe-derived allow-list in test_enum_coverage.py.
1 parent 194f9ea commit a37c10a

20 files changed

Lines changed: 83 additions & 85 deletions

File tree

‎cuda_core/cuda/core/_cpp/rt/DESIGN.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,8 @@ The resource handle design:
467467
2. **Encodes lifetimes structurally** via embedded handle dependencies.
468468
3. **Uses Cython's `cimport` mechanism** to share C++ code across modules without
469469
duplicate static/thread-local state.
470-
4. **Resolves CUDA driver symbols** dynamically through cuda-bindings' `__pyx_capi__` capsules.
470+
4. **Resolves CUDA driver symbols** through the driver entry points cuda-bindings resolves
471+
(`_inspect_function_pointers()`), filled lazily by `ensure_fn_table()` on first use.
471472
5. **Provides overloaded accessors** (`as_cu`, `as_intptr`, `as_py`) since handles cannot
472473
have attributes without unnecessary Python object wrappers.
473474

‎cuda_core/cuda/core/_memory/_buffer.pyi‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ class Buffer:
171171
asynchronous copy
172172
options : :class:`~utils.CopyOptions`, optional
173173
Transfer hints (source access order, location hints, overlap mode).
174-
Honored when cuda.bindings and the driver are both CUDA 13.2 or
175-
newer. Not accepted with ``LEGACY_DEFAULT_STREAM``; use
174+
Honored on the CUDA 13 build of ``cuda.core`` with a driver of CUDA
175+
13.2 or newer. Not accepted with ``LEGACY_DEFAULT_STREAM``; use
176176
``PER_THREAD_DEFAULT_STREAM`` instead. Not accepted with a
177177
capturing stream either, since a graph cannot represent these
178178
attributes; use :meth:`graph.GraphNode.memcpy` for a plain,
@@ -205,8 +205,8 @@ class Buffer:
205205
asynchronous copy
206206
options : :class:`~utils.CopyOptions`, optional
207207
Transfer hints (source access order, location hints, overlap mode).
208-
Honored when cuda.bindings and the driver are both CUDA 13.2 or
209-
newer. Not accepted with ``LEGACY_DEFAULT_STREAM``; use
208+
Honored on the CUDA 13 build of ``cuda.core`` with a driver of CUDA
209+
13.2 or newer. Not accepted with ``LEGACY_DEFAULT_STREAM``; use
210210
``PER_THREAD_DEFAULT_STREAM`` instead. Not accepted with a
211211
capturing stream either, since a graph cannot represent these
212212
attributes; use :meth:`graph.GraphNode.memcpy` for a plain,

‎cuda_core/cuda/core/_memory/_buffer.pyx‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ cdef void _dispatch_buffer_copy(
225225
else:
226226
_reject_unsupported_during_api_call(
227227
options.src_access_order,
228-
"cuda.bindings and the driver to both report CUDA 13.2 or newer "
228+
"the CUDA 13 build of cuda.core and a driver reporting CUDA 13.2 or newer "
229229
"(cuMemcpyWithAttributesAsync is unavailable here)",
230230
)
231231
# STREAM and ANY never require access sooner than stream order, so
@@ -498,8 +498,8 @@ cdef class Buffer:
498498
asynchronous copy
499499
options : :class:`~utils.CopyOptions`, optional
500500
Transfer hints (source access order, location hints, overlap mode).
501-
Honored when cuda.bindings and the driver are both CUDA 13.2 or
502-
newer. Not accepted with ``LEGACY_DEFAULT_STREAM``; use
501+
Honored on the CUDA 13 build of ``cuda.core`` with a driver of CUDA
502+
13.2 or newer. Not accepted with ``LEGACY_DEFAULT_STREAM``; use
503503
``PER_THREAD_DEFAULT_STREAM`` instead. Not accepted with a
504504
capturing stream either, since a graph cannot represent these
505505
attributes; use :meth:`graph.GraphNode.memcpy` for a plain,
@@ -554,8 +554,8 @@ cdef class Buffer:
554554
asynchronous copy
555555
options : :class:`~utils.CopyOptions`, optional
556556
Transfer hints (source access order, location hints, overlap mode).
557-
Honored when cuda.bindings and the driver are both CUDA 13.2 or
558-
newer. Not accepted with ``LEGACY_DEFAULT_STREAM``; use
557+
Honored on the CUDA 13 build of ``cuda.core`` with a driver of CUDA
558+
13.2 or newer. Not accepted with ``LEGACY_DEFAULT_STREAM``; use
559559
``PER_THREAD_DEFAULT_STREAM`` instead. Not accepted with a
560560
capturing stream either, since a graph cannot represent these
561561
attributes; use :meth:`graph.GraphNode.memcpy` for a plain,

‎cuda_core/cuda/core/_memory/_copy_ops.pyi‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,8 @@ def copy_batch(stream: Stream, srcs: Sequence[Buffer], dsts: Sequence[Buffer], *
6868
6969
Notes
7070
-----
71-
Batching through ``cuMemcpyBatchAsync`` requires all three of:
72-
``cuda.core`` built against CUDA 13 headers, ``cuda.bindings`` 13.0 or
73-
newer, and a driver reporting CUDA 13.0 or newer
71+
Batching through ``cuMemcpyBatchAsync`` requires both the CUDA 13 build of
72+
``cuda.core`` and a driver reporting CUDA 13.0 or newer
7473
(``cuDriverGetVersion() >= 13000``). ``cuda.bindings`` binds only the
7574
CUDA 13.0 revision of the entry point, so a driver that predates it is
7675
refused even where it implements the earlier CUDA 12.8 signature.

‎cuda_core/cuda/core/_memory/_copy_ops.pyx‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,8 @@ def copy_batch(
143143

144144
Notes
145145
-----
146-
Batching through ``cuMemcpyBatchAsync`` requires all three of:
147-
``cuda.core`` built against CUDA 13 headers, ``cuda.bindings`` 13.0 or
148-
newer, and a driver reporting CUDA 13.0 or newer
146+
Batching through ``cuMemcpyBatchAsync`` requires both the CUDA 13 build of
147+
``cuda.core`` and a driver reporting CUDA 13.0 or newer
149148
(``cuDriverGetVersion() >= 13000``). ``cuda.bindings`` binds only the
150149
CUDA 13.0 revision of the entry point, so a driver that predates it is
151150
refused even where it implements the earlier CUDA 12.8 signature.
@@ -241,8 +240,8 @@ cdef void _reject_during_api_call_fallback(tuple attr_tuple):
241240
for i in range(len(attr_tuple)):
242241
_reject_unsupported_during_api_call(
243242
(<object>attr_tuple[i]).src_access_order,
244-
"cuda.core built against CUDA 13 headers and cuda.bindings/driver "
245-
"13.0 or newer (cuMemcpyBatchAsync is unavailable here)",
243+
"the CUDA 13 build of cuda.core and a driver reporting CUDA 13.0 or newer "
244+
"(cuMemcpyBatchAsync is unavailable here)",
246245
index=i,
247246
)
248247

‎cuda_core/cuda/core/_memory/_managed_memory_ops.pyx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,9 @@ IF CUDA_CORE_BUILD_MAJOR >= 13:
369369
ELSE:
370370
def _read_preferred_location_v2(Buffer buf) -> Device | Host | None:
371371
# Symbols exist so _managed_buffer.py can import the v2 readers
372-
# unconditionally. Their properties gate on both binding_version()
373-
# and driver_version() >= (13, 0, 0), so these paths are unreachable
374-
# on a CUDA 12 build.
372+
# unconditionally. Their properties gate on the CUDA 13 build and
373+
# driver_version() >= (13, 0, 0), so these paths are unreachable on a
374+
# CUDA 12 build.
375375
raise NotImplementedError(
376376
"_read_preferred_location_v2 requires a CUDA 13 build of cuda.core"
377377
)

‎cuda_core/cuda/core/checkpoint.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5+
"""CUDA process checkpointing (Linux).
6+
7+
Requires the CUDA 13 build of cuda.core (the driver structures it uses are
8+
CUDA 13 types) and a CUDA driver of version 12.8 or newer with checkpoint API
9+
support.
10+
"""
11+
512
import ctypes as _ctypes
613
from collections.abc import Mapping
714
from typing import Any

‎cuda_core/cuda/core/graph/_subclasses.pyi‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,10 @@ class MemsetNode(GraphNode):
137137
Omitted parameters preserve their current values. ``dst_owner`` may
138138
only accompany a raw-address ``dst``.
139139
140-
With CUDA 12.2 through 13.1, the node's intended CUDA context must be
141-
current when this method is called. CUDA driver and ``cuda.bindings``
142-
versions 13.2 and newer preserve the recorded context automatically.
140+
With drivers from CUDA 12.2 through 13.1, the node's intended CUDA
141+
context must be current when this method is called. With the CUDA 13
142+
build of ``cuda.core`` and a driver of CUDA 13.2 or newer, the recorded
143+
context is preserved automatically.
143144
144145
.. warning::
145146
@@ -188,9 +189,10 @@ class MemcpyNode(GraphNode):
188189
Multidimensional, pitched, offset, and array-backed memcpy nodes are
189190
not supported.
190191
191-
With CUDA 12.2 through 13.1, the node's intended CUDA context must be
192-
current when this method is called. CUDA driver and ``cuda.bindings``
193-
versions 13.2 and newer preserve the recorded context automatically.
192+
With drivers from CUDA 12.2 through 13.1, the node's intended CUDA
193+
context must be current when this method is called. With the CUDA 13
194+
build of ``cuda.core`` and a driver of CUDA 13.2 or newer, the recorded
195+
context is preserved automatically.
194196
195197
.. warning::
196198

‎cuda_core/cuda/core/graph/_subclasses.pyx‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -650,9 +650,10 @@ cdef class MemsetNode(GraphNode):
650650
Omitted parameters preserve their current values. ``dst_owner`` may
651651
only accompany a raw-address ``dst``.
652652

653-
With CUDA 12.2 through 13.1, the node's intended CUDA context must be
654-
current when this method is called. CUDA driver and ``cuda.bindings``
655-
versions 13.2 and newer preserve the recorded context automatically.
653+
With drivers from CUDA 12.2 through 13.1, the node's intended CUDA
654+
context must be current when this method is called. With the CUDA 13
655+
build of ``cuda.core`` and a driver of CUDA 13.2 or newer, the recorded
656+
context is preserved automatically.
656657

657658
.. warning::
658659

@@ -839,9 +840,10 @@ cdef class MemcpyNode(GraphNode):
839840
Multidimensional, pitched, offset, and array-backed memcpy nodes are
840841
not supported.
841842

842-
With CUDA 12.2 through 13.1, the node's intended CUDA context must be
843-
current when this method is called. CUDA driver and ``cuda.bindings``
844-
versions 13.2 and newer preserve the recorded context automatically.
843+
With drivers from CUDA 12.2 through 13.1, the node's intended CUDA
844+
context must be current when this method is called. With the CUDA 13
845+
build of ``cuda.core`` and a driver of CUDA 13.2 or newer, the recorded
846+
context is preserved automatically.
845847

846848
.. warning::
847849

‎cuda_core/cuda/core/system/_clock.pxi‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ _CLOCKS_EVENT_REASONS_MAPPING = {
2020
nvml.ClocksEventReasons.THROTTLE_REASON_HW_THERMAL_SLOWDOWN: ClocksEventReasons.HW_THERMAL_SLOWDOWN,
2121
nvml.ClocksEventReasons.THROTTLE_REASON_HW_POWER_BRAKE_SLOWDOWN: ClocksEventReasons.HW_POWER_BRAKE_SLOWDOWN,
2222
nvml.ClocksEventReasons.EVENT_REASON_DISPLAY_CLOCK_SETTING: ClocksEventReasons.DISPLAY_CLOCK_SETTING,
23-
getattr(nvml.ClocksEventReasons, "EVENT_REASON_BOARD_LIMIT", 0x200): ClocksEventReasons.BOARD_LIMIT,
24-
getattr(nvml.ClocksEventReasons, "EVENT_REASON_RELIABILITY", 0x400): ClocksEventReasons.RELIABILITY,
23+
nvml.ClocksEventReasons.EVENT_REASON_BOARD_LIMIT: ClocksEventReasons.BOARD_LIMIT,
24+
nvml.ClocksEventReasons.EVENT_REASON_RELIABILITY: ClocksEventReasons.RELIABILITY,
2525
}
2626

2727

0 commit comments

Comments
 (0)