.. currentmodule:: cuda.core
- TBD
- Added the :mod:`cuda.core.checkpoint` module for CUDA process checkpointing, including string process state queries, lock/checkpoint/restore/unlock operations, and GPU UUID remapping support for restore. (#1343)
Renamed :class:`~graph.GraphDef` to :class:`~graph.GraphDefinition` for consistency with the rest of the API, which spells words out (e.g.
TensorMapDescriptor, notTensorMapDesc). (#1950)Renamed
cuda.core.graph.Conditionto :class:`~graph.GraphCondition` to follow theGraph*prefix convention used byGraphBuilder,GraphDefinition,GraphNode. (#1945)Converted no-argument deterministic getters to properties for consistency with the rest of the API (#1945):
- :meth:`Buffer.get_ipc_descriptor` -> :attr:`Buffer.ipc_descriptor`
- :meth:`Event.get_ipc_descriptor` -> :attr:`Event.ipc_descriptor`
- :meth:`DeviceMemoryResource.get_allocation_handle` -> :attr:`DeviceMemoryResource.allocation_handle`
- :meth:`PinnedMemoryResource.get_allocation_handle` -> :attr:`PinnedMemoryResource.allocation_handle`
Renamed boolean / non-noun properties for clearer naming (#1945):
LaunchConfig.cooperative_launch-> :attr:`LaunchConfig.is_cooperative` (also renames the constructor keyword argument).Event.is_timing_disabled-> :attr:`Event.is_timing_enabled`.Event.is_sync_busy_waited-> :attr:`Event.is_blocking_sync`.EventOptions.enable_timing->EventOptions.timing_enabledandEventOptions.busy_waited_sync->EventOptions.blocking_sync.
Renamed graph allocation methods to match :meth:`MemoryResource.allocate` / :meth:`MemoryResource.deallocate` (#1945):
GraphDefinition.alloc-> :meth:`graph.GraphDefinition.allocate`GraphDefinition.free-> :meth:`graph.GraphDefinition.deallocate`GraphNode.alloc-> :meth:`graph.GraphNode.allocate`GraphNode.free-> :meth:`graph.GraphNode.deallocate`
Cross-API consistency for graph builders (#1945):
GraphBuilder.add_child-> :meth:`graph.GraphBuilder.embed` (matches :meth:`graph.GraphDefinition.embed` and :meth:`graph.GraphNode.embed`).GraphDefinition.record_event/wait_event-> :meth:`graph.GraphDefinition.record` / :meth:`graph.GraphDefinition.wait` and the same on :class:`~graph.GraphNode`, matching :meth:`Stream.record` / :meth:`Stream.wait`.
:class:`KernelAttributes` methods are now properties; per-device queries use indexing (#1945):
- The 17 attribute methods (
max_threads_per_block,num_regs,shared_size_bytes,cluster_scheduling_policy_preference, etc.) that previously took adevice_idargument are now properties on the view returned by :attr:`Kernel.attributes`. The view is bound to the current device by default;kernel.attributes[device]returns a view bound to a specific :class:`Device` or device ordinal. The cache is shared across views of the same kernel. - Old:
kernel.attributes.num_regs()andkernel.attributes.num_regs(some_dev) - New:
kernel.attributes.num_regsandkernel.attributes[some_dev].num_regs
- The 17 attribute methods (
Renamed :attr:`graph.HostCallbackNode.callback_fn` to :attr:`graph.HostCallbackNode.callback` to drop the redundant
_fnsuffix (#1945).Unified the conditional graph API on :class:`~graph.GraphCondition` and consistent verbs (#1945):
GraphBuilder.create_conditional_handle-> :meth:`graph.GraphBuilder.create_condition`. The new factory returns a :class:`~graph.GraphCondition` (matching :meth:`graph.GraphDefinition.create_condition`) instead of a rawCUgraphConditionalHandle. The four conditional builder methods (:meth:`~graph.GraphBuilder.if_then`, :meth:`~graph.GraphBuilder.if_else`, :meth:`~graph.GraphBuilder.while_loop`, :meth:`~graph.GraphBuilder.switch`) now accept a :class:`~graph.GraphCondition` instead of a raw handle.GraphBuilder.if_cond/GraphDefinition.if_cond/GraphNode.if_cond-> :meth:`graph.GraphBuilder.if_then` / :meth:`graph.GraphDefinition.if_then` / :meth:`graph.GraphNode.if_then`. The new name parallels the existingif_else,while_loop, andswitchmethods (verb describing the control-flow construct, not an abbreviation of "condition") and matches Python's ownif/then/elsevocabulary.- A :class:`~graph.GraphCondition` may be passed directly as a kernel
argument to
launch(); the launcher unwraps it to the underlyingCUgraphConditionalHandlevalue. Previously,.handlehad to be extracted explicitly.
:meth:`Linker.which_backend` is now a classmethod instead of the former
backendinstance property. Call sites must useLinker.which_backend()(with parentheses) instead oflinker.backend. This allows querying the linking backend without constructing aLinkerinstance — for example, to choose between PTX and LTOIR input before linking.:attr:`DeviceMemoryResource.peer_accessible_by` now returns a :class:`collections.abc.MutableSet` of :obj:`~_device.Device` objects instead of a sorted
tuple[int, ...]. The property setter is unchanged. (#2018)streamis now a required keyword-only argument on APIs that schedule work on a stream (#2001). Passdevice.default_stream(or any :class:`Stream`) explicitly to retain the previous behavior. Affected APIs:- :meth:`MemoryResource.allocate` / :meth:`MemoryResource.deallocate` and overrides on :class:`DeviceMemoryResource`, :class:`PinnedMemoryResource`, :class:`ManagedMemoryResource`, and :class:`graph.GraphMemoryResource`.
- :meth:`Device.allocate`.
- :meth:`GraphicsResource.map`.
- :meth:`KernelOccupancy.max_potential_cluster_size` and :meth:`KernelOccupancy.max_active_clusters`.
- :meth:`Buffer.from_ipc_descriptor` (no longer falls back to the default
stream when
stream=Noneis passed).
Synchronous memory resources are exempt: their allocate/deallocate methods accept an optional
stream(validated when non-None) but do not use it. This applies to :class:`LegacyPinnedMemoryResource` and :class:`VirtualMemoryResource`.Consistent naming of types annotation helpers (#2016): - :obj:`cuda.core.typing.DevicePointerT` -> :obj:`cuda.core.typing.DevicePointerType` - :obj:`cuda.core.typing.IsStreamT` -> :obj:`cuda.core.typing.IsStreamType`
:func:`args_viewable_as_strided_memory` and :class:`StridedMemoryView` are now longer at the top-level in :mod:`cuda.core`. They are available publicly from the :mod:`cuda.core.utils` module. (#2028)
- :class:`~utils.StridedMemoryView` now provides a fast path for
torch.Tensorobjects via PyTorch's AOT Inductor (AOTI) stable C ABI. When atorch.Tensoris passed to anyfrom_*classmethod (from_dlpack,from_cuda_array_interface,from_array_interface, orfrom_any_interface), tensor metadata is read directly from the underlying C struct, bypassing the DLPack and CUDA Array Interface protocol overhead. This yields ~7-20x fasterStridedMemoryViewconstruction for PyTorch tensors (depending on whether stream ordering is required). Proper CUDA stream ordering is established between PyTorch's current stream and the consumer stream, matching the DLPack synchronization contract. Requires PyTorch >= 2.3. (#749) - Enums are not available in places where a small number of string values are
accepted or returned. You may continue to use the string values, or use
enumerations for better linting and type-checking.
(#2016)
The new enums are:
- :class:`cuda.core.typing.CompilerBackendType`
- :class:`cuda.core.typing.GraphConditionalType`
- :class:`cuda.core.typing.GraphMemoryType`
- :class:`cuda.core.typing.ManagedMemoryLocationType`
- :class:`cuda.core.typing.ObjectCodeFormatType`
- :class:`cuda.core.typing.PCHStatusType`
- :class:`cuda.core.typing.SourceCodeType`
- :class:`cuda.core.typing.VirtualMemoryAccessType`
- :class:`cuda.core.typing.VirtualMemoryAllocationType`
- :class:`cuda.core.typing.VirtualMemoryGranularityType`
- :class:`cuda.core.typing.VirtualMemoryHandleType`
- :class:`cuda.core.typing.VirtualMemoryLocationType`