diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 71be00007e2..3159fe2860a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -88,7 +88,7 @@ repos: files: ^cuda_core/cuda/.*\.(pyx|pxd)$ pass_filenames: false additional_dependencies: - - stubgen-pyx==0.2.19 + - stubgen-pyx==0.2.22 - Cython==3.2.9 # Link checking for authored documentation files diff --git a/cuda_core/cuda/core/_context.pyi b/cuda_core/cuda/core/_context.pyi index 67d202eaa23..46d01e75715 100644 --- a/cuda_core/cuda/core/_context.pyi +++ b/cuda_core/cuda/core/_context.pyi @@ -1,4 +1,4 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_context.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_context.pyx from collections.abc import Sequence from dataclasses import dataclass diff --git a/cuda_core/cuda/core/_device.pyi b/cuda_core/cuda/core/_device.pyi index 369f2b198d8..ab6bef5cbc1 100644 --- a/cuda_core/cuda/core/_device.pyi +++ b/cuda_core/cuda/core/_device.pyi @@ -1,4 +1,6 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_device.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_device.pyx + +import threading import cuda.core.system from cuda.core._context import Context, ContextOptions @@ -13,6 +15,8 @@ from cuda.core.texture import (MipmappedArray, MipmappedArrayOptions, ResourceDescriptor, SurfaceObject, TextureObject, TextureObjectOptions) +_tls = threading.local() +_lock = threading.Lock() __all__ = ['Device'] class DeviceProperties: diff --git a/cuda_core/cuda/core/_device_resources.pyi b/cuda_core/cuda/core/_device_resources.pyi index a6837e837e9..9d766502889 100644 --- a/cuda_core/cuda/core/_device_resources.pyi +++ b/cuda_core/cuda/core/_device_resources.pyi @@ -1,4 +1,4 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_device_resources.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_device_resources.pyx from collections.abc import Sequence as SequenceABC from dataclasses import dataclass diff --git a/cuda_core/cuda/core/_dlpack.pyi b/cuda_core/cuda/core/_dlpack.pyi index 37d65d9f0e4..d2e442776f7 100644 --- a/cuda_core/cuda/core/_dlpack.pyi +++ b/cuda_core/cuda/core/_dlpack.pyi @@ -1,10 +1,17 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_dlpack.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_dlpack.pyx from enum import IntEnum -from typing import Any, Callable, TypeAlias, TypedDict +from typing import Any, Callable, TypedDict + +from typing_extensions import TypeAlias _DLDeviceType: TypeAlias = int DLDataTypeCode: TypeAlias = int +DLPackManagedTensorAllocator: TypeAlias = Callable[[DLTensor, DLManagedTensorVersioned, Any, Callable[[Any, bytes, bytes], None]], int] +DLPackManagedTensorFromPyObjectNoSync: TypeAlias = Callable[[Any, DLManagedTensorVersioned], int] +DLPackManagedTensorToPyObjectNoSync: TypeAlias = Callable[[DLManagedTensorVersioned, Any], int] +DLPackDLTensorFromPyObjectNoSync: TypeAlias = Callable[[Any, DLTensor], int] +DLPackCurrentWorkStream: TypeAlias = Callable[[_DLDeviceType, int, Any], int] class DLDeviceType(IntEnum): kDLCPU = 1 @@ -22,7 +29,7 @@ class DLDataType(TypedDict): lanes: int class DLTensor(TypedDict): - data: None + data: Any device: DLDevice ndim: int dtype: DLDataType @@ -32,8 +39,8 @@ class DLTensor(TypedDict): class DLManagedTensor(TypedDict): dl_tensor: DLTensor - manager_ctx: None - deleter: Callable[..., Any] + manager_ctx: Any + deleter: Callable[[DLManagedTensor], None] class DLPackVersion(TypedDict): major: int @@ -41,8 +48,8 @@ class DLPackVersion(TypedDict): class DLManagedTensorVersioned(TypedDict): version: DLPackVersion - manager_ctx: None - deleter: Callable[..., Any] + manager_ctx: Any + deleter: Callable[[DLManagedTensorVersioned], None] flags: int dl_tensor: DLTensor @@ -52,11 +59,11 @@ class DLPackExchangeAPIHeader(TypedDict): class DLPackExchangeAPI(TypedDict): header: DLPackExchangeAPIHeader - managed_tensor_allocator: ... - managed_tensor_from_py_object_no_sync: ... - managed_tensor_to_py_object_no_sync: ... - dltensor_from_py_object_no_sync: ... - current_work_stream: ... + managed_tensor_allocator: DLPackManagedTensorAllocator + managed_tensor_from_py_object_no_sync: DLPackManagedTensorFromPyObjectNoSync + managed_tensor_to_py_object_no_sync: DLPackManagedTensorToPyObjectNoSync + dltensor_from_py_object_no_sync: DLPackDLTensorFromPyObjectNoSync + current_work_stream: DLPackCurrentWorkStream def classify_dl_device(buf: object) -> tuple[int, int]: """Classify a buffer into a DLPack (device_type, device_id) pair. diff --git a/cuda_core/cuda/core/_event.pyi b/cuda_core/cuda/core/_event.pyi index eb511efde72..3177b5fff0b 100644 --- a/cuda_core/cuda/core/_event.pyi +++ b/cuda_core/cuda/core/_event.pyi @@ -1,9 +1,9 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_event.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_event.pyx from dataclasses import dataclass -from typing import Any import cuda.bindings.driver +from _typeshed import Incomplete from cuda.core._context import Context from cuda.core._device import Device @@ -146,7 +146,7 @@ class IPCEventDescriptor: """Serializable object describing an event that can be shared between processes.""" def __init__(self, *arg, **kwargs) -> None: ... @staticmethod - def _init(reserved: bytes, is_blocking_sync: Any) -> IPCEventDescriptor: ... + def _init(reserved: bytes, is_blocking_sync: Incomplete) -> IPCEventDescriptor: ... def __eq__(self, other: object) -> bool: ... def __reduce__(self) -> tuple[object, ...]: ... diff --git a/cuda_core/cuda/core/_graphics.pyi b/cuda_core/cuda/core/_graphics.pyi index d985b042af7..b819d90a1b1 100644 --- a/cuda_core/cuda/core/_graphics.pyi +++ b/cuda_core/cuda/core/_graphics.pyi @@ -1,4 +1,4 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_graphics.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_graphics.pyx from typing import Sequence diff --git a/cuda_core/cuda/core/_kernel_arg_handler.pyi b/cuda_core/cuda/core/_kernel_arg_handler.pyi index 918548ef40c..f5ef040b8de 100644 --- a/cuda_core/cuda/core/_kernel_arg_handler.pyi +++ b/cuda_core/cuda/core/_kernel_arg_handler.pyi @@ -1,9 +1,13 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_kernel_arg_handler.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_kernel_arg_handler.pyx -from typing import Any, Sequence, TypeAlias, TypedDict +from typing import Any, Sequence, TypedDict -cpp_single_complex: TypeAlias = Any -cpp_double_complex: TypeAlias = Any +from _typeshed import Incomplete +from typing_extensions import TypeAlias + +cpp_single_complex: TypeAlias = Incomplete +cpp_double_complex: TypeAlias = Incomplete +voidptr: TypeAlias = Any class __half_raw(TypedDict): x: int diff --git a/cuda_core/cuda/core/_launch_config.pyi b/cuda_core/cuda/core/_launch_config.pyi index a731f2999ff..269fcff416e 100644 --- a/cuda_core/cuda/core/_launch_config.pyi +++ b/cuda_core/cuda/core/_launch_config.pyi @@ -1,4 +1,4 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_launch_config.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_launch_config.pyx from typing import Any diff --git a/cuda_core/cuda/core/_launcher.pyi b/cuda_core/cuda/core/_launcher.pyi index 72ba7c6c623..c74b30c4f10 100644 --- a/cuda_core/cuda/core/_launcher.pyi +++ b/cuda_core/cuda/core/_launcher.pyi @@ -1,4 +1,4 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_launcher.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_launcher.pyx from cuda.core._launch_config import LaunchConfig from cuda.core._module import Kernel diff --git a/cuda_core/cuda/core/_layout.pyi b/cuda_core/cuda/core/_layout.pyi index 0483a78b6ad..718aea0fcbc 100644 --- a/cuda_core/cuda/core/_layout.pyi +++ b/cuda_core/cuda/core/_layout.pyi @@ -1,6 +1,9 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_layout.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_layout.pyx -from typing import Any, TypeAlias, TypedDict +from typing import TypedDict + +from _typeshed import Incomplete +from typing_extensions import TypeAlias OrderFlag: TypeAlias = int Property: TypeAlias = int @@ -9,8 +12,8 @@ stride_t: TypeAlias = int axis_t: TypeAlias = int axes_mask_t: TypeAlias = int property_mask_t: TypeAlias = int -extents_strides_t: TypeAlias = Any -axis_vec_t: TypeAlias = Any +extents_strides_t: TypeAlias = Incomplete +axis_vec_t: TypeAlias = Incomplete class _StridedLayout: """ diff --git a/cuda_core/cuda/core/_linker.pyi b/cuda_core/cuda/core/_linker.pyi index d038bd50e89..4fed2399f7a 100644 --- a/cuda_core/cuda/core/_linker.pyi +++ b/cuda_core/cuda/core/_linker.pyi @@ -1,4 +1,4 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_linker.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_linker.pyx """Linking machinery for combining object codes. @@ -13,9 +13,11 @@ import cuda.bindings.driver import cuda.bindings.nvjitlink from cuda.core._module import ObjectCode from cuda.core.typing import CompilerBackendType, ObjectCodeFormatType +from typing_extensions import TypeAlias _keep_driver_in_stub: cuda.bindings.driver.CUlinkState _keep_nvjitlink_in_stub: cuda.bindings.nvjitlink.nvJitLinkHandle +const_char_ptr: TypeAlias = bytes __all__ = ['Linker', 'LinkerOptions'] LinkerHandleT = Union['cuda.bindings.nvjitlink.nvJitLinkHandle', 'cuda.bindings.driver.CUlinkState'] _driver = None diff --git a/cuda_core/cuda/core/_memory/_buffer.pyi b/cuda_core/cuda/core/_memory/_buffer.pyi index 616d62060da..7b7a58e9558 100644 --- a/cuda_core/cuda/core/_memory/_buffer.pyi +++ b/cuda_core/cuda/core/_memory/_buffer.pyi @@ -1,4 +1,4 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_memory/_buffer.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_memory/_buffer.pyx from typing import TypedDict diff --git a/cuda_core/cuda/core/_memory/_copy_attributes.pyi b/cuda_core/cuda/core/_memory/_copy_attributes.pyi index 93b9a97aa2b..5eaf371b8c4 100644 --- a/cuda_core/cuda/core/_memory/_copy_attributes.pyi +++ b/cuda_core/cuda/core/_memory/_copy_attributes.pyi @@ -1 +1 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_memory/_copy_attributes.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_memory/_copy_attributes.pyx diff --git a/cuda_core/cuda/core/_memory/_copy_ops.pyi b/cuda_core/cuda/core/_memory/_copy_ops.pyi index f3439732230..ff76140d2ba 100644 --- a/cuda_core/cuda/core/_memory/_copy_ops.pyi +++ b/cuda_core/cuda/core/_memory/_copy_ops.pyi @@ -1,4 +1,4 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_memory/_copy_ops.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_memory/_copy_ops.pyx from collections.abc import Sequence diff --git a/cuda_core/cuda/core/_memory/_device_memory_resource.pyi b/cuda_core/cuda/core/_memory/_device_memory_resource.pyi index 897e1d03302..337d03baf4a 100644 --- a/cuda_core/cuda/core/_memory/_device_memory_resource.pyi +++ b/cuda_core/cuda/core/_memory/_device_memory_resource.pyi @@ -1,4 +1,4 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_memory/_device_memory_resource.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_memory/_device_memory_resource.pyx import uuid from dataclasses import dataclass diff --git a/cuda_core/cuda/core/_memory/_graph_memory_resource.pyi b/cuda_core/cuda/core/_memory/_graph_memory_resource.pyi index 5801490f8fb..fd23fec5833 100644 --- a/cuda_core/cuda/core/_memory/_graph_memory_resource.pyi +++ b/cuda_core/cuda/core/_memory/_graph_memory_resource.pyi @@ -1,4 +1,4 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_memory/_graph_memory_resource.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_memory/_graph_memory_resource.pyx from cuda.core._device import Device from cuda.core._memory._buffer import Buffer, MemoryResource diff --git a/cuda_core/cuda/core/_memory/_ipc.pyi b/cuda_core/cuda/core/_memory/_ipc.pyi index 4855b3c0f7b..ef8f4110f3f 100644 --- a/cuda_core/cuda/core/_memory/_ipc.pyi +++ b/cuda_core/cuda/core/_memory/_ipc.pyi @@ -1,4 +1,4 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_memory/_ipc.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_memory/_ipc.pyx import uuid diff --git a/cuda_core/cuda/core/_memory/_location.pyi b/cuda_core/cuda/core/_memory/_location.pyi index fa1467c3432..1a10ac85487 100644 --- a/cuda_core/cuda/core/_memory/_location.pyi +++ b/cuda_core/cuda/core/_memory/_location.pyi @@ -1 +1 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_memory/_location.pxd +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_memory/_location.pxd diff --git a/cuda_core/cuda/core/_memory/_managed_memory_ops.pyi b/cuda_core/cuda/core/_memory/_managed_memory_ops.pyi index 4523a39d728..8327e154f70 100644 --- a/cuda_core/cuda/core/_memory/_managed_memory_ops.pyi +++ b/cuda_core/cuda/core/_memory/_managed_memory_ops.pyi @@ -1,4 +1,4 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_memory/_managed_memory_ops.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_memory/_managed_memory_ops.pyx from collections.abc import Sequence diff --git a/cuda_core/cuda/core/_memory/_managed_memory_resource.pyi b/cuda_core/cuda/core/_memory/_managed_memory_resource.pyi index 44523ae0f53..8659a7f5933 100644 --- a/cuda_core/cuda/core/_memory/_managed_memory_resource.pyi +++ b/cuda_core/cuda/core/_memory/_managed_memory_resource.pyi @@ -1,4 +1,4 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_memory/_managed_memory_resource.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_memory/_managed_memory_resource.pyx from dataclasses import dataclass diff --git a/cuda_core/cuda/core/_memory/_memory_pool.pyi b/cuda_core/cuda/core/_memory/_memory_pool.pyi index 9e6a11ca009..8d5e56d9f26 100644 --- a/cuda_core/cuda/core/_memory/_memory_pool.pyi +++ b/cuda_core/cuda/core/_memory/_memory_pool.pyi @@ -1,4 +1,4 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_memory/_memory_pool.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_memory/_memory_pool.pyx import uuid diff --git a/cuda_core/cuda/core/_memory/_peer_access_utils.pyi b/cuda_core/cuda/core/_memory/_peer_access_utils.pyi index 2c38debd2de..83dde54945e 100644 --- a/cuda_core/cuda/core/_memory/_peer_access_utils.pyi +++ b/cuda_core/cuda/core/_memory/_peer_access_utils.pyi @@ -1,12 +1,13 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_memory/_peer_access_utils.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_memory/_peer_access_utils.pyx -from collections.abc import Iterable, Iterator, Set +from collections.abc import Callable, Iterable, Iterator, MutableSet, Set from dataclasses import dataclass -from typing import Any, Callable +from typing import Any, TypeVar from cuda.core._device import Device from cuda.core._memory._device_memory_resource import DeviceMemoryResource +_S = TypeVar('_S') @dataclass(frozen=True) class PeerAccessPlan: @@ -15,7 +16,7 @@ class PeerAccessPlan: to_add: tuple[int, ...] to_remove: tuple[int, ...] -class PeerAccessibleBySetProxy: +class PeerAccessibleBySetProxy(MutableSet['Device']): """Live driver-backed view of the peer devices granted access to a memory pool. Reads (``__contains__``, ``__iter__``, ``len(...)``) call ``cuMemPoolGetAccess``; @@ -33,11 +34,11 @@ class PeerAccessibleBySetProxy: is updated, so coalescing into a single driver call lets the toolkit handle the mappings in parallel. """ - __slots__ = '_mr' + __slots__ = ('_mr',) def __init__(self, mr: DeviceMemoryResource) -> None: ... @classmethod - def _from_iterable(cls, it: Iterable[Device]) -> set[Device]: ... + def _from_iterable(cls, it: Iterable[_S]) -> set[_S]: ... def __contains__(self, value: object) -> bool: ... def __iter__(self) -> Iterator[Device]: ... def __len__(self) -> int: ... @@ -55,10 +56,12 @@ class PeerAccessibleBySetProxy: """Restrict peer access to the intersection in a single driver call.""" def symmetric_difference_update(self, other: Iterable[Device | int]) -> None: """Toggle peer access for every device in ``other`` in one driver call.""" - def __ior__(self, other: Set[Any]) -> PeerAccessibleBySetProxy: ... + def __ior__(self, other: Set[Any]) -> PeerAccessibleBySetProxy: # type: ignore[misc] + ... def __iand__(self, other: Set[Any]) -> PeerAccessibleBySetProxy: ... def __isub__(self, other: Set[Any]) -> PeerAccessibleBySetProxy: ... - def __ixor__(self, other: Set[Any]) -> PeerAccessibleBySetProxy: ... + def __ixor__(self, other: Set[Any]) -> PeerAccessibleBySetProxy: # type: ignore[misc] + ... def __repr__(self) -> str: ... def _apply(self, additions, removals) -> None: """Compute the diff and issue a single ``cuMemPoolSetAccess``. diff --git a/cuda_core/cuda/core/_memory/_peer_access_utils.pyx b/cuda_core/cuda/core/_memory/_peer_access_utils.pyx index 36b55aeee86..21f88258f57 100644 --- a/cuda_core/cuda/core/_memory/_peer_access_utils.pyx +++ b/cuda_core/cuda/core/_memory/_peer_access_utils.pyx @@ -6,7 +6,9 @@ from __future__ import annotations from collections.abc import Callable, Iterable, Iterator, MutableSet, Set from dataclasses import dataclass -from typing import TYPE_CHECKING, Any +from typing import TYPE_CHECKING, Any, TypeVar + +_S = TypeVar("_S") from cuda.bindings cimport cydriver from cuda.core._memory._device_memory_resource cimport DeviceMemoryResource @@ -235,7 +237,7 @@ class PeerAccessibleBySetProxy(MutableSet["Device"]): self._mr = mr @classmethod - def _from_iterable(cls, it: Iterable[Device]) -> set[Device]: # type: ignore[override] + def _from_iterable(cls, it: Iterable[_S]) -> set[_S]: # Binary set operators (&, |, -, ^) collect their result through # _from_iterable. Returning a plain set lets the user reason about # the result independently of any pool's driver state. @@ -354,7 +356,7 @@ class PeerAccessibleBySetProxy(MutableSet["Device"]): if to_add or to_remove: self._apply(to_add, to_remove) - def __ior__(self, other: Set[Any]) -> PeerAccessibleBySetProxy: + def __ior__(self, other: Set[Any]) -> PeerAccessibleBySetProxy: # type: ignore[misc] self.update(other) return self @@ -369,7 +371,7 @@ class PeerAccessibleBySetProxy(MutableSet["Device"]): self.difference_update(other) return self - def __ixor__(self, other: Set[Any]) -> PeerAccessibleBySetProxy: + def __ixor__(self, other: Set[Any]) -> PeerAccessibleBySetProxy: # type: ignore[misc] self.symmetric_difference_update(other) return self diff --git a/cuda_core/cuda/core/_memory/_pinned_memory_resource.pyi b/cuda_core/cuda/core/_memory/_pinned_memory_resource.pyi index 76a7010dbc4..7c9aa1f6ecd 100644 --- a/cuda_core/cuda/core/_memory/_pinned_memory_resource.pyi +++ b/cuda_core/cuda/core/_memory/_pinned_memory_resource.pyi @@ -1,4 +1,4 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_memory/_pinned_memory_resource.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_memory/_pinned_memory_resource.pyx import uuid from dataclasses import dataclass diff --git a/cuda_core/cuda/core/_memoryview.pyi b/cuda_core/cuda/core/_memoryview.pyi index 8cd5b7547c3..6084734d037 100644 --- a/cuda_core/cuda/core/_memoryview.pyi +++ b/cuda_core/cuda/core/_memoryview.pyi @@ -1,7 +1,8 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_memoryview.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_memoryview.pyx import functools -from typing import Any, Callable, TypedDict +from collections.abc import Callable +from typing import Any, TypedDict import numpy from cuda.core._layout import _StridedLayout @@ -11,10 +12,9 @@ from cuda.core._tensor_map import TensorMapDescriptorOptions from ._dlpack import * -_SMV_DLPACK_EXCHANGE_API_CAPSULE = ... class PyTypeObject(TypedDict): - tp_dict: None + tp_dict: Any class StridedMemoryView: """A class holding metadata of a strided dense array/tensor. diff --git a/cuda_core/cuda/core/_module.pyi b/cuda_core/cuda/core/_module.pyi index 9fb502920ad..e73c47f471f 100644 --- a/cuda_core/cuda/core/_module.pyi +++ b/cuda_core/cuda/core/_module.pyi @@ -1,7 +1,7 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_module.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_module.pyx +from collections import namedtuple from os import PathLike -from typing import Any from cuda.core._device import Device from cuda.core._launch_config import LaunchConfig @@ -9,6 +9,8 @@ from cuda.core._stream import Stream from cuda.core._utils.cuda_utils import driver __all__ = ['Kernel', 'ObjectCode'] +MaxPotentialBlockSizeOccupancyResult = namedtuple('MaxPotentialBlockSizeOccupancyResult', ('min_grid_size', 'max_block_size')) +ParamInfo = namedtuple('ParamInfo', ['offset', 'size']) CodeTypeT = bytes | bytearray | str class KernelAttributes: @@ -126,7 +128,7 @@ class KernelOccupancy: theoretical multiprocessor utilization (occupancy). """ - def max_potential_block_size(self, dynamic_shared_memory_needed: int | driver.CUoccupancyB2DSize, block_size_limit: int) -> Any: + def max_potential_block_size(self, dynamic_shared_memory_needed: int | driver.CUoccupancyB2DSize, block_size_limit: int) -> MaxPotentialBlockSizeOccupancyResult: """MaxPotentialBlockSizeOccupancyResult: Suggested launch configuration for reasonable occupancy. Returns the minimum grid size needed to achieve the maximum occupancy and @@ -230,7 +232,7 @@ class Kernel: def num_arguments(self) -> int: """int : The number of arguments of this function""" @property - def arguments_info(self) -> list[Any]: + def arguments_info(self) -> list[ParamInfo]: """list[ParamInfo]: (offset, size) for each argument of this function""" @property def occupancy(self) -> KernelOccupancy: diff --git a/cuda_core/cuda/core/_program.pyi b/cuda_core/cuda/core/_program.pyi index ca18850e3b5..2af6f6f8f62 100644 --- a/cuda_core/cuda/core/_program.pyi +++ b/cuda_core/cuda/core/_program.pyi @@ -1,4 +1,4 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_program.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_program.pyx """Compilation machinery for CUDA programs. diff --git a/cuda_core/cuda/core/_resource_handles.pyi b/cuda_core/cuda/core/_resource_handles.pyi index 457e2921047..66cbf80761a 100644 --- a/cuda_core/cuda/core/_resource_handles.pyi +++ b/cuda_core/cuda/core/_resource_handles.pyi @@ -1,29 +1,43 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_resource_handles.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_resource_handles.pyx -from typing import Any, TypeAlias +from typing import Callable -ContextHandle: TypeAlias = Any -GreenCtxHandle: TypeAlias = Any -StreamHandle: TypeAlias = Any -EventHandle: TypeAlias = Any -MemoryPoolHandle: TypeAlias = Any -DevicePtrHandle: TypeAlias = Any -LibraryHandle: TypeAlias = Any -KernelHandle: TypeAlias = Any -GraphHandle: TypeAlias = Any -GraphExecHandle: TypeAlias = Any -GraphNodeHandle: TypeAlias = Any -GraphicsResourceHandle: TypeAlias = Any -NvrtcProgramHandle: TypeAlias = Any -NvvmProgramHandle: TypeAlias = Any -NvJitLinkHandle: TypeAlias = Any -CuLinkHandle: TypeAlias = Any -FileDescriptorHandle: TypeAlias = Any -OpaqueArrayHandle: TypeAlias = Any -MipmappedArrayHandle: TypeAlias = Any -TexObjectHandle: TypeAlias = Any -SurfObjectHandle: TypeAlias = Any -OpaqueHandle: TypeAlias = Any -PreparedAttachment: TypeAlias = Any -PreparedChildGraphUpdate: TypeAlias = Any -PreparedExecAttachment: TypeAlias = Any +from _typeshed import Incomplete +from cuda.bindings import cydriver +from typing_extensions import TypeAlias + +ContextHandle: TypeAlias = Incomplete +GreenCtxHandle: TypeAlias = Incomplete +StreamHandle: TypeAlias = Incomplete +EventHandle: TypeAlias = Incomplete +MemoryPoolHandle: TypeAlias = Incomplete +DevicePtrHandle: TypeAlias = Incomplete +LibraryHandle: TypeAlias = Incomplete +KernelHandle: TypeAlias = Incomplete +GraphHandle: TypeAlias = Incomplete +GraphExecHandle: TypeAlias = Incomplete +GraphNodeHandle: TypeAlias = Incomplete +GraphicsResourceHandle: TypeAlias = Incomplete +NvrtcProgramHandle: TypeAlias = Incomplete +NvvmProgramHandle: TypeAlias = Incomplete +NvJitLinkHandle: TypeAlias = Incomplete +CuLinkHandle: TypeAlias = Incomplete +FileDescriptorHandle: TypeAlias = Incomplete +OpaqueArrayHandle: TypeAlias = Incomplete +MipmappedArrayHandle: TypeAlias = Incomplete +TexObjectHandle: TypeAlias = Incomplete +SurfObjectHandle: TypeAlias = Incomplete +OpaqueHandle: TypeAlias = Incomplete +PreparedAttachment: TypeAlias = Incomplete +PreparedChildGraphUpdate: TypeAlias = Incomplete +PreparedExecAttachment: TypeAlias = Incomplete +MRDeallocCallback: TypeAlias = Callable[[object, cydriver.CUdeviceptr, int, StreamHandle], None] +NvvmProgramValue: TypeAlias = Incomplete +NvJitLinkValue: TypeAlias = Incomplete +TexObjectValue: TypeAlias = Incomplete +SurfObjectValue: TypeAlias = Incomplete +PreparedAttachmentState: TypeAlias = Incomplete +PreparedAttachmentDeleter: TypeAlias = Incomplete +PreparedChildGraphUpdateState: TypeAlias = Incomplete +PreparedExecAttachmentState: TypeAlias = Incomplete +PreparedExecAttachmentDeleter: TypeAlias = Incomplete diff --git a/cuda_core/cuda/core/_stream.pyi b/cuda_core/cuda/core/_stream.pyi index 91321f0d060..eba5458d862 100644 --- a/cuda_core/cuda/core/_stream.pyi +++ b/cuda_core/cuda/core/_stream.pyi @@ -1,9 +1,10 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_stream.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_stream.pyx from dataclasses import dataclass -from typing import Any, Protocol +from typing import Protocol import cuda.bindings.driver +from _typeshed import Incomplete from cuda.core._context import Context from cuda.core._device import Device from cuda.core._device_resources import DeviceResources @@ -27,7 +28,7 @@ class StreamOptions: higher priority. (Default to lowest priority) """ - nonblocking: Any = True + nonblocking: Incomplete = True priority: int | None = None class IsStreamType(Protocol): diff --git a/cuda_core/cuda/core/_tensor_bridge.pyi b/cuda_core/cuda/core/_tensor_bridge.pyi index 25c13c6458c..3afb8ee33ff 100644 --- a/cuda_core/cuda/core/_tensor_bridge.pyi +++ b/cuda_core/cuda/core/_tensor_bridge.pyi @@ -1,4 +1,4 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_tensor_bridge.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_tensor_bridge.pyx """Tensor bridge: extract PyTorch tensor metadata via the AOTI stable C ABI. @@ -46,12 +46,15 @@ Credit: Emilio Castillo (ecastillo@nvidia.com) – original tensor-bridge POC. ``torch._C`` has been re-opened with ``RTLD_GLOBAL`` *before* importing this module so that the AOTI symbols are visible. """ -from typing import TypeAlias, TypedDict +from typing import Any, Callable, TypedDict import numpy from cuda.core._memoryview import StridedMemoryView +from typing_extensions import TypeAlias AOTITorchError: TypeAlias = int +AtenTensorHandle: TypeAlias = AtenTensorOpaque +_get_cuda_stream_fn_t: TypeAlias = Callable[[int, Any], AOTITorchError] class PyObject(TypedDict): ... diff --git a/cuda_core/cuda/core/_tensor_map.pyi b/cuda_core/cuda/core/_tensor_map.pyi index 2a3dc8a48a3..e1f0685bde9 100644 --- a/cuda_core/cuda/core/_tensor_map.pyi +++ b/cuda_core/cuda/core/_tensor_map.pyi @@ -1,5 +1,6 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_tensor_map.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_tensor_map.pyx +import enum from dataclasses import dataclass import numpy @@ -23,7 +24,7 @@ _TMA_DT_TFLOAT32_FTZ: int = int(cydriver.CU_TENSOR_MAP_DATA_TYPE_TFLOAT32_FTZ) _NUMPY_DTYPE_TO_TMA = {numpy.dtype(numpy.uint8): _TMA_DT_UINT8, numpy.dtype(numpy.uint16): _TMA_DT_UINT16, numpy.dtype(numpy.uint32): _TMA_DT_UINT32, numpy.dtype(numpy.int32): _TMA_DT_INT32, numpy.dtype(numpy.uint64): _TMA_DT_UINT64, numpy.dtype(numpy.int64): _TMA_DT_INT64, numpy.dtype(numpy.float16): _TMA_DT_FLOAT16, numpy.dtype(numpy.float32): _TMA_DT_FLOAT32, numpy.dtype(numpy.float64): _TMA_DT_FLOAT64} _TMA_DATA_TYPE_SIZE = {_TMA_DT_UINT8: 1, _TMA_DT_UINT16: 2, _TMA_DT_UINT32: 4, _TMA_DT_INT32: 4, _TMA_DT_UINT64: 8, _TMA_DT_INT64: 8, _TMA_DT_FLOAT16: 2, _TMA_DT_FLOAT32: 4, _TMA_DT_FLOAT64: 8, _TMA_DT_BFLOAT16: 2, _TMA_DT_FLOAT32_FTZ: 4, _TMA_DT_TFLOAT32: 4, _TMA_DT_TFLOAT32_FTZ: 4} -class TensorMapDataType: +class TensorMapDataType(enum.IntEnum): """Data types for tensor map descriptors. These correspond to the ``CUtensorMapDataType`` driver enum values. @@ -42,7 +43,7 @@ class TensorMapDataType: TFLOAT32 = cydriver.CU_TENSOR_MAP_DATA_TYPE_TFLOAT32 TFLOAT32_FTZ = cydriver.CU_TENSOR_MAP_DATA_TYPE_TFLOAT32_FTZ -class TensorMapInterleave: +class TensorMapInterleave(enum.IntEnum): """Interleave layout for tensor map descriptors. These correspond to the ``CUtensorMapInterleave`` driver enum values. @@ -51,7 +52,7 @@ class TensorMapInterleave: INTERLEAVE_16B = cydriver.CU_TENSOR_MAP_INTERLEAVE_16B INTERLEAVE_32B = cydriver.CU_TENSOR_MAP_INTERLEAVE_32B -class TensorMapSwizzle: +class TensorMapSwizzle(enum.IntEnum): """Swizzle mode for tensor map descriptors. These correspond to the ``CUtensorMapSwizzle`` driver enum values. @@ -61,7 +62,7 @@ class TensorMapSwizzle: SWIZZLE_64B = cydriver.CU_TENSOR_MAP_SWIZZLE_64B SWIZZLE_128B = cydriver.CU_TENSOR_MAP_SWIZZLE_128B -class TensorMapL2Promotion: +class TensorMapL2Promotion(enum.IntEnum): """L2 promotion mode for tensor map descriptors. These correspond to the ``CUtensorMapL2promotion`` driver enum values. @@ -71,7 +72,7 @@ class TensorMapL2Promotion: L2_128B = cydriver.CU_TENSOR_MAP_L2_PROMOTION_L2_128B L2_256B = cydriver.CU_TENSOR_MAP_L2_PROMOTION_L2_256B -class TensorMapOOBFill: +class TensorMapOOBFill(enum.IntEnum): """Out-of-bounds fill mode for tensor map descriptors. These correspond to the ``CUtensorMapFloatOOBfill`` driver enum values. @@ -79,7 +80,7 @@ class TensorMapOOBFill: NONE = cydriver.CU_TENSOR_MAP_FLOAT_OOB_FILL_NONE NAN_REQUEST_ZERO_FMA = cydriver.CU_TENSOR_MAP_FLOAT_OOB_FILL_NAN_REQUEST_ZERO_FMA -class TensorMapIm2ColWideMode: +class TensorMapIm2ColWideMode(enum.IntEnum): """Im2col wide mode for tensor map descriptors. This enum is always defined for API stability, but the diff --git a/cuda_core/cuda/core/_utils/_weak_handles.pyi b/cuda_core/cuda/core/_utils/_weak_handles.pyi index a795a180504..7facc12b267 100644 --- a/cuda_core/cuda/core/_utils/_weak_handles.pyi +++ b/cuda_core/cuda/core/_utils/_weak_handles.pyi @@ -1,4 +1,4 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_utils/_weak_handles.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_utils/_weak_handles.pyx """Test-only weak handles for resource-handle lifetime checks. @@ -20,6 +20,11 @@ handle field (see ``*.pxd``), assigns to :ctype:`OpaqueHandle`, and extend the Python owners via ``make_opaque_py`` are not covered here -- use :class:`weakref.ref` on a weak-referenceable owner object in tests instead. """ +from _typeshed import Incomplete +from typing_extensions import TypeAlias + +OpaqueWeakHandle: TypeAlias = Incomplete + class WeakHandle: """Non-owning weak handle for a resource's shared control block. diff --git a/cuda_core/cuda/core/_utils/_wsl_locale.pyi b/cuda_core/cuda/core/_utils/_wsl_locale.pyi index 790ae71b99d..ecee8bc773c 100644 --- a/cuda_core/cuda/core/_utils/_wsl_locale.pyi +++ b/cuda_core/cuda/core/_utils/_wsl_locale.pyi @@ -1,4 +1,10 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_utils/_wsl_locale.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_utils/_wsl_locale.pyx + +from typing import Any + +from typing_extensions import TypeAlias + +locale_t: TypeAlias = Any class c_locale_guard: """Context manager that pins the calling thread to the "C" locale. diff --git a/cuda_core/cuda/core/_utils/cuda_utils.pyi b/cuda_core/cuda/core/_utils/cuda_utils.pyi index 545b9a9073c..51f992fa238 100644 --- a/cuda_core/cuda/core/_utils/cuda_utils.pyi +++ b/cuda_core/cuda/core/_utils/cuda_utils.pyi @@ -1,4 +1,4 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_utils/cuda_utils.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_utils/cuda_utils.pyx from typing import Any, Callable, NamedTuple diff --git a/cuda_core/cuda/core/_utils/version.pyi b/cuda_core/cuda/core/_utils/version.pyi index 021d86f1aec..db2e27a57d0 100644 --- a/cuda_core/cuda/core/_utils/version.pyi +++ b/cuda_core/cuda/core/_utils/version.pyi @@ -1,4 +1,4 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_utils/version.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/_utils/version.pyx import functools diff --git a/cuda_core/cuda/core/graph/_adjacency_set_proxy.pyi b/cuda_core/cuda/core/graph/_adjacency_set_proxy.pyi index a434c6d8108..850e231a3b0 100644 --- a/cuda_core/cuda/core/graph/_adjacency_set_proxy.pyi +++ b/cuda_core/cuda/core/graph/_adjacency_set_proxy.pyi @@ -1,20 +1,24 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/graph/_adjacency_set_proxy.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/graph/_adjacency_set_proxy.pyx """Mutable-set proxy for graph node predecessors and successors.""" -from collections.abc import Iterator, Set -from typing import Any +from collections.abc import Iterable, Iterator, MutableSet, Set +from typing import Any, Callable, TypeVar +from cuda.bindings import cydriver from cuda.core.graph._graph_node import GraphNode +from typing_extensions import TypeAlias +_S = TypeVar('_S') +_adj_fn_t: TypeAlias = Callable[[cydriver.CUgraphNode, cydriver.CUgraphNode, int], cydriver.CUresult] -class AdjacencySetProxy: +class AdjacencySetProxy(MutableSet[GraphNode]): """Mutable set proxy for a node's predecessors or successors. Mutations write through to the underlying CUDA graph.""" - __slots__ = '_core' + __slots__ = ('_core',) def __init__(self, node: GraphNode, is_fwd: bool) -> None: ... @classmethod - def _from_iterable(cls, it) -> set[GraphNode]: ... + def _from_iterable(cls, it: Iterable[_S]) -> set[_S]: ... def __contains__(self, x: object) -> bool: ... def __iter__(self) -> Iterator[GraphNode]: ... def __len__(self) -> int: ... @@ -26,7 +30,7 @@ class AdjacencySetProxy: """Remove edges to all nodes in *it* in a single driver call.""" def update(self, *others) -> None: """Add edges to multiple nodes at once.""" - def __ior__(self, it: Set[Any]) -> AdjacencySetProxy: + def __ior__(self, it: Set[Any]) -> AdjacencySetProxy: # type: ignore[misc] """Add edges to all nodes in *it* in a single driver call.""" def __repr__(self) -> str: ... diff --git a/cuda_core/cuda/core/graph/_adjacency_set_proxy.pyx b/cuda_core/cuda/core/graph/_adjacency_set_proxy.pyx index 6ec36b2ceca..8919067d0b0 100644 --- a/cuda_core/cuda/core/graph/_adjacency_set_proxy.pyx +++ b/cuda_core/cuda/core/graph/_adjacency_set_proxy.pyx @@ -15,8 +15,10 @@ from cuda.core._resource_handles cimport ( graph_node_get_graph, ) from cuda.core._utils.cuda_utils cimport HANDLE_RETURN -from collections.abc import Iterator, MutableSet, Set -from typing import Any +from collections.abc import Iterable, Iterator, MutableSet, Set +from typing import Any, TypeVar + +_S = TypeVar("_S") # ---- Python MutableSet wrapper ---------------------------------------------- @@ -32,7 +34,7 @@ class AdjacencySetProxy(MutableSet[GraphNode]): # Used by operators such as &|^ to create non-proxy views when needed. @classmethod - def _from_iterable(cls, it) -> set[GraphNode]: + def _from_iterable(cls, it: Iterable[_S]) -> set[_S]: return set(it) # --- abstract methods required by MutableSet --- @@ -105,7 +107,7 @@ class AdjacencySetProxy(MutableSet[GraphNode]): if new: (<_AdjacencySetCore>self._core).add_edges(new) - def __ior__(self, it: Set[Any]) -> "AdjacencySetProxy": + def __ior__(self, it: Set[Any]) -> "AdjacencySetProxy": # type: ignore[misc] """Add edges to all nodes in *it* in a single driver call.""" self.update(it) return self diff --git a/cuda_core/cuda/core/graph/_graph_builder.pyi b/cuda_core/cuda/core/graph/_graph_builder.pyi index b8dd23167eb..732bc291036 100644 --- a/cuda_core/cuda/core/graph/_graph_builder.pyi +++ b/cuda_core/cuda/core/graph/_graph_builder.pyi @@ -1,13 +1,13 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/graph/_graph_builder.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/graph/_graph_builder.pyx from dataclasses import dataclass -from typing import TypeAlias from cuda.core._stream import Stream from cuda.core._utils.cuda_utils import driver from cuda.core.graph._graph_definition import GraphCondition, GraphDefinition from cuda.core.graph._graph_node import GraphNode from cuda.core.graph._subclasses import ExecutableGraphNode +from typing_extensions import TypeAlias _BuilderKind: TypeAlias = int _CaptureState: TypeAlias = int diff --git a/cuda_core/cuda/core/graph/_graph_definition.pyi b/cuda_core/cuda/core/graph/_graph_definition.pyi index 915d21a8a4d..cfdd1a14d17 100644 --- a/cuda_core/cuda/core/graph/_graph_definition.pyi +++ b/cuda_core/cuda/core/graph/_graph_definition.pyi @@ -1,4 +1,4 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/graph/_graph_definition.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/graph/_graph_definition.pyx """GraphDefinition: explicit CUDA graph definition.""" from cuda.core._device import Device diff --git a/cuda_core/cuda/core/graph/_graph_node.pyi b/cuda_core/cuda/core/graph/_graph_node.pyi index 10d4714ba65..effb5799c0f 100644 --- a/cuda_core/cuda/core/graph/_graph_node.pyi +++ b/cuda_core/cuda/core/graph/_graph_node.pyi @@ -1,4 +1,4 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/graph/_graph_node.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/graph/_graph_node.pyx """GraphNode base class — factory, properties, and builder methods.""" import weakref diff --git a/cuda_core/cuda/core/graph/_host_callback.pyi b/cuda_core/cuda/core/graph/_host_callback.pyi index 60674fcedc2..cc48abf95a1 100644 --- a/cuda_core/cuda/core/graph/_host_callback.pyi +++ b/cuda_core/cuda/core/graph/_host_callback.pyi @@ -1,4 +1,4 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/graph/_host_callback.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/graph/_host_callback.pyx import sys diff --git a/cuda_core/cuda/core/graph/_subclasses.pyi b/cuda_core/cuda/core/graph/_subclasses.pyi index 7a46b2969b8..e207e05eaca 100644 --- a/cuda_core/cuda/core/graph/_subclasses.pyi +++ b/cuda_core/cuda/core/graph/_subclasses.pyi @@ -1,4 +1,4 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/graph/_subclasses.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/graph/_subclasses.pyx """GraphNode subclasses — EmptyNode through SwitchNode.""" from cuda.core._event import Event diff --git a/cuda_core/cuda/core/system/_device.pyi b/cuda_core/cuda/core/system/_device.pyi index b2faecc5bb1..137f405038b 100644 --- a/cuda_core/cuda/core/system/_device.pyi +++ b/cuda_core/cuda/core/system/_device.pyi @@ -1,4 +1,4 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/system/_device.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/system/_device.pyx from typing import Iterable, TypedDict @@ -19,21 +19,22 @@ _CLOCK_TYPE_MAPPING = {ClockType.GRAPHICS: nvml.ClockType.CLOCK_GRAPHICS, ClockT _COOLER_CONTROL_MAPPING = {nvml.CoolerControl.THERMAL_COOLER_SIGNAL_TOGGLE: CoolerControl.TOGGLE, nvml.CoolerControl.THERMAL_COOLER_SIGNAL_VARIABLE: CoolerControl.VARIABLE} _COOLER_TARGET_MAPPING = {nvml.CoolerTarget.THERMAL_NONE: CoolerTarget.NONE, nvml.CoolerTarget.THERMAL_GPU: CoolerTarget.GPU, nvml.CoolerTarget.THERMAL_MEMORY: CoolerTarget.MEMORY, nvml.CoolerTarget.THERMAL_POWER_SUPPLY: CoolerTarget.POWER_SUPPLY} _EVENT_TYPE_MAPPING = {nvml.EventType.NONE: EventType.NONE, nvml.EventType.SINGLE_BIT_ECC_ERROR: EventType.SINGLE_BIT_ECC_ERROR, nvml.EventType.DOUBLE_BIT_ECC_ERROR: EventType.DOUBLE_BIT_ECC_ERROR, nvml.EventType.PSTATE: EventType.PSTATE, nvml.EventType.XID_CRITICAL_ERROR: EventType.XID_CRITICAL_ERROR, nvml.EventType.CLOCK: EventType.CLOCK, nvml.EventType.POWER_SOURCE_CHANGE: EventType.POWER_SOURCE_CHANGE, nvml.EventType.MIG_CONFIG_CHANGE: EventType.MIG_CONFIG_CHANGE, nvml.EventType.SINGLE_BIT_ECC_ERROR_STORM: EventType.SINGLE_BIT_ECC_ERROR_STORM, nvml.EventType.DRAM_RETIREMENT_EVENT: EventType.DRAM_RETIREMENT_EVENT, nvml.EventType.DRAM_RETIREMENT_FAILURE: EventType.DRAM_RETIREMENT_FAILURE, nvml.EventType.NON_FATAL_POISON_ERROR: EventType.NON_FATAL_POISON_ERROR, nvml.EventType.FATAL_POISON_ERROR: EventType.FATAL_POISON_ERROR, nvml.EventType.GPU_UNAVAILABLE_ERROR: EventType.GPU_UNAVAILABLE_ERROR, nvml.EventType.GPU_RECOVERY_ACTION: EventType.GPU_RECOVERY_ACTION} -_EVENT_TYPE_INV_MAPPING = ... +_EVENT_TYPE_INV_MAPPING = {v: k for k, v in _EVENT_TYPE_MAPPING.items()} _FAN_CONTROL_POLICY_MAPPING = {nvml.FanControlPolicy.TEMPERATURE_CONTINUOUS_SW: FanControlPolicy.TEMPERATURE_CONTROLLED, nvml.FanControlPolicy.MANUAL: FanControlPolicy.MANUAL} _INFOROM_OBJECT_MAPPING = {InforomObject.OEM: nvml.InforomObject.INFOROM_OEM, InforomObject.ECC: nvml.InforomObject.INFOROM_ECC, InforomObject.POWER: nvml.InforomObject.INFOROM_POWER, InforomObject.DEN: nvml.InforomObject.INFOROM_DEN} _NVLINK_VERSION_MAPPING = {nvml.NvlinkVersion.VERSION_1_0: (1, 0), nvml.NvlinkVersion.VERSION_2_0: (2, 0), nvml.NvlinkVersion.VERSION_2_2: (2, 2), nvml.NvlinkVersion.VERSION_3_0: (3, 0), nvml.NvlinkVersion.VERSION_3_1: (3, 1), nvml.NvlinkVersion.VERSION_4_0: (4, 0), nvml.NvlinkVersion.VERSION_5_0: (5, 0)} +_NVLINK_VERSION_6_0 = getattr(nvml.NvlinkVersion, 'VERSION_6_0', None) _TEMPERATURE_THRESHOLD_MAPPING = {TemperatureThresholds.SHUTDOWN: nvml.TemperatureThresholds.TEMPERATURE_THRESHOLD_SHUTDOWN, TemperatureThresholds.SLOWDOWN: nvml.TemperatureThresholds.TEMPERATURE_THRESHOLD_SLOWDOWN, TemperatureThresholds.MEM_MAX: nvml.TemperatureThresholds.TEMPERATURE_THRESHOLD_MEM_MAX, TemperatureThresholds.GPU_MAX: nvml.TemperatureThresholds.TEMPERATURE_THRESHOLD_GPU_MAX, TemperatureThresholds.ACOUSTIC_MIN: nvml.TemperatureThresholds.TEMPERATURE_THRESHOLD_ACOUSTIC_MIN, TemperatureThresholds.ACOUSTIC_CURR: nvml.TemperatureThresholds.TEMPERATURE_THRESHOLD_ACOUSTIC_CURR, TemperatureThresholds.ACOUSTIC_MAX: nvml.TemperatureThresholds.TEMPERATURE_THRESHOLD_ACOUSTIC_MAX, TemperatureThresholds.GPS_CURR: nvml.TemperatureThresholds.TEMPERATURE_THRESHOLD_GPS_CURR} _THERMAL_CONTROLLER_MAPPING = {nvml.ThermalController.GPU_INTERNAL: ThermalController.GPU_INTERNAL, nvml.ThermalController.ADM1032: ThermalController.ADM1032, nvml.ThermalController.ADT7461: ThermalController.ADT7461, nvml.ThermalController.MAX6649: ThermalController.MAX6649, nvml.ThermalController.MAX1617: ThermalController.MAX1617, nvml.ThermalController.LM99: ThermalController.LM99, nvml.ThermalController.LM89: ThermalController.LM89, nvml.ThermalController.LM64: ThermalController.LM64, nvml.ThermalController.G781: ThermalController.G781, nvml.ThermalController.ADT7473: ThermalController.ADT7473, nvml.ThermalController.SBMAX6649: ThermalController.SBMAX6649, nvml.ThermalController.VBIOSEVT: ThermalController.VBIOSEVT, nvml.ThermalController.OS: ThermalController.OS, nvml.ThermalController.NVSYSCON_CANOAS: ThermalController.NVSYSCON_CANOAS, nvml.ThermalController.NVSYSCON_E551: ThermalController.NVSYSCON_E551, nvml.ThermalController.MAX6649R: ThermalController.MAX6649R, nvml.ThermalController.ADT7473S: ThermalController.ADT7473S, nvml.ThermalController.UNKNOWN: ThermalController.UNKNOWN} _THERMAL_TARGET_MAPPING = {nvml.ThermalTarget.NONE: ThermalTarget.NONE, nvml.ThermalTarget.GPU: ThermalTarget.GPU, nvml.ThermalTarget.MEMORY: ThermalTarget.MEMORY, nvml.ThermalTarget.POWER_SUPPLY: ThermalTarget.POWER_SUPPLY, nvml.ThermalTarget.BOARD: ThermalTarget.BOARD, nvml.ThermalTarget.VCD_BOARD: ThermalTarget.VCD_BOARD, nvml.ThermalTarget.VCD_INLET: ThermalTarget.VCD_INLET, nvml.ThermalTarget.VCD_OUTLET: ThermalTarget.VCD_OUTLET, nvml.ThermalTarget.ALL: ThermalTarget.ALL} -_THERMAL_TARGET_INV_MAPPING = ... +_THERMAL_TARGET_INV_MAPPING = {v: k for k, v in _THERMAL_TARGET_MAPPING.items()} _ADDRESSING_MODE_MAPPING = {nvml.DeviceAddressingModeType.DEVICE_ADDRESSING_MODE_HMM: AddressingMode.HMM, nvml.DeviceAddressingModeType.DEVICE_ADDRESSING_MODE_ATS: AddressingMode.ATS} _AFFINITY_SCOPE_MAPPING = {AffinityScope.NODE: nvml.AffinityScope.NODE, AffinityScope.SOCKET: nvml.AffinityScope.SOCKET} _BRAND_TYPE_MAPPING = {nvml.BrandType.BRAND_UNKNOWN: 'Unknown', nvml.BrandType.BRAND_QUADRO: 'Quadro', nvml.BrandType.BRAND_TESLA: 'Tesla', nvml.BrandType.BRAND_NVS: 'NVS', nvml.BrandType.BRAND_GRID: 'GRID', nvml.BrandType.BRAND_GEFORCE: 'GeForce', nvml.BrandType.BRAND_TITAN: 'Titan', nvml.BrandType.BRAND_NVIDIA_VAPPS: 'NVIDIA vApps', nvml.BrandType.BRAND_NVIDIA_VPC: 'NVIDIA VPC', nvml.BrandType.BRAND_NVIDIA_VCS: 'NVIDIA VCS', nvml.BrandType.BRAND_NVIDIA_VWS: 'NVIDIA VWS', nvml.BrandType.BRAND_NVIDIA_CLOUD_GAMING: 'NVIDIA Cloud Gaming', nvml.BrandType.BRAND_NVIDIA_VGAMING: 'NVIDIA vGaming', nvml.BrandType.BRAND_QUADRO_RTX: 'Quadro RTX', nvml.BrandType.BRAND_NVIDIA_RTX: 'NVIDIA RTX', nvml.BrandType.BRAND_NVIDIA: 'NVIDIA', nvml.BrandType.BRAND_GEFORCE_RTX: 'GeForce RTX', nvml.BrandType.BRAND_TITAN_RTX: 'Titan RTX'} _GPU_P2P_CAPS_INDEX_MAPPING = {GpuP2PCapsIndex.READ: nvml.GpuP2PCapsIndex.P2P_CAPS_INDEX_READ, GpuP2PCapsIndex.WRITE: nvml.GpuP2PCapsIndex.P2P_CAPS_INDEX_WRITE, GpuP2PCapsIndex.NVLINK: nvml.GpuP2PCapsIndex.P2P_CAPS_INDEX_NVLINK, GpuP2PCapsIndex.ATOMICS: nvml.GpuP2PCapsIndex.P2P_CAPS_INDEX_ATOMICS, GpuP2PCapsIndex.PCI: nvml.GpuP2PCapsIndex.P2P_CAPS_INDEX_PCI, GpuP2PCapsIndex.PROP: nvml.GpuP2PCapsIndex.P2P_CAPS_INDEX_PROP, GpuP2PCapsIndex.UNKNOWN: nvml.GpuP2PCapsIndex.P2P_CAPS_INDEX_UNKNOWN} _GPU_P2P_STATUS_MAPPING = {nvml.GpuP2PStatus.P2P_STATUS_OK: GpuP2PStatus.OK, nvml.GpuP2PStatus.P2P_STATUS_CHIPSET_NOT_SUPPORTED: GpuP2PStatus.CHIPSET_NOT_SUPPORTED, nvml.GpuP2PStatus.P2P_STATUS_GPU_NOT_SUPPORTED: GpuP2PStatus.GPU_NOT_SUPPORTED, nvml.GpuP2PStatus.P2P_STATUS_IOH_TOPOLOGY_NOT_SUPPORTED: GpuP2PStatus.IOH_TOPOLOGY_NOT_SUPPORTED, nvml.GpuP2PStatus.P2P_STATUS_DISABLED_BY_REGKEY: GpuP2PStatus.DISABLED_BY_REGKEY, nvml.GpuP2PStatus.P2P_STATUS_NOT_SUPPORTED: GpuP2PStatus.NOT_SUPPORTED, nvml.GpuP2PStatus.P2P_STATUS_UNKNOWN: GpuP2PStatus.UNKNOWN} _GPU_TOPOLOGY_LEVEL_MAPPING = {GpuTopologyLevel.INTERNAL: nvml.GpuTopologyLevel.TOPOLOGY_INTERNAL, GpuTopologyLevel.SINGLE: nvml.GpuTopologyLevel.TOPOLOGY_SINGLE, GpuTopologyLevel.MULTIPLE: nvml.GpuTopologyLevel.TOPOLOGY_MULTIPLE, GpuTopologyLevel.HOSTBRIDGE: nvml.GpuTopologyLevel.TOPOLOGY_HOSTBRIDGE, GpuTopologyLevel.NODE: nvml.GpuTopologyLevel.TOPOLOGY_NODE, GpuTopologyLevel.SYSTEM: nvml.GpuTopologyLevel.TOPOLOGY_SYSTEM} -_GPU_TOPOLOGY_LEVEL_INV_MAPPING = ... +_GPU_TOPOLOGY_LEVEL_INV_MAPPING = {v: k for k, v in _GPU_TOPOLOGY_LEVEL_MAPPING.items()} __all__ = ['Device', 'get_p2p_status', 'get_topology_common_ancestor', 'NvlinkInfo'] class _GpuDynamicPstatesUtilization(TypedDict): diff --git a/cuda_core/cuda/core/system/_nvml_context.pyi b/cuda_core/cuda/core/system/_nvml_context.pyi index d61f31ddf40..7650f28003a 100644 --- a/cuda_core/cuda/core/system/_nvml_context.pyi +++ b/cuda_core/cuda/core/system/_nvml_context.pyi @@ -1,8 +1,11 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/system/_nvml_context.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/system/_nvml_context.pyx -from typing import TypeAlias +import threading + +from typing_extensions import TypeAlias _NVMLState: TypeAlias = int +_lock = threading.Lock() def _get_nvml_state() -> _NVMLState: ... def _initialize() -> None: diff --git a/cuda_core/cuda/core/system/_system.pyi b/cuda_core/cuda/core/system/_system.pyi index 0584101fa96..b29b16f16aa 100644 --- a/cuda_core/cuda/core/system/_system.pyi +++ b/cuda_core/cuda/core/system/_system.pyi @@ -1,4 +1,4 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/system/_system.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/system/_system.pyx CUDA_BINDINGS_NVML_IS_COMPATIBLE: bool __all__ = ['get_driver_branch', 'get_kernel_mode_driver_version', 'get_user_mode_driver_version', 'get_nvml_version', 'get_num_devices', 'get_process_name', 'CUDA_BINDINGS_NVML_IS_COMPATIBLE'] diff --git a/cuda_core/cuda/core/system/_system_events.pyi b/cuda_core/cuda/core/system/_system_events.pyi index b1721146c3e..b8950ecc340 100644 --- a/cuda_core/cuda/core/system/_system_events.pyi +++ b/cuda_core/cuda/core/system/_system_events.pyi @@ -1,4 +1,4 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/system/_system_events.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/system/_system_events.pyx from cuda.bindings import nvml from cuda.core.system.typing import SystemEventType @@ -6,7 +6,7 @@ from cuda.core.system.typing import SystemEventType from . import _device _SYSTEM_EVENT_TYPE_MAPPING = {nvml.SystemEventType.GPU_DRIVER_UNBIND: SystemEventType.UNBIND, nvml.SystemEventType.GPU_DRIVER_BIND: SystemEventType.BIND} -_SYSTEM_EVENT_TYPE_INV_MAPPING = ... +_SYSTEM_EVENT_TYPE_INV_MAPPING = {v: k for k, v in _SYSTEM_EVENT_TYPE_MAPPING.items()} __all__ = ['register_events'] class SystemEvent: diff --git a/cuda_core/cuda/core/texture/_array.pyi b/cuda_core/cuda/core/texture/_array.pyi index 1b48b8afc82..17cebc48963 100644 --- a/cuda_core/cuda/core/texture/_array.pyi +++ b/cuda_core/cuda/core/texture/_array.pyi @@ -1,13 +1,14 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/texture/_array.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/texture/_array.pyx from dataclasses import dataclass +import numpy from cuda.bindings import cydriver from cuda.core.typing import ArrayFormatType _ARRAYFORMAT_TO_CU = {ArrayFormatType.UINT8: int(cydriver.CU_AD_FORMAT_UNSIGNED_INT8), ArrayFormatType.UINT16: int(cydriver.CU_AD_FORMAT_UNSIGNED_INT16), ArrayFormatType.UINT32: int(cydriver.CU_AD_FORMAT_UNSIGNED_INT32), ArrayFormatType.INT8: int(cydriver.CU_AD_FORMAT_SIGNED_INT8), ArrayFormatType.INT16: int(cydriver.CU_AD_FORMAT_SIGNED_INT16), ArrayFormatType.INT32: int(cydriver.CU_AD_FORMAT_SIGNED_INT32), ArrayFormatType.FLOAT16: int(cydriver.CU_AD_FORMAT_HALF), ArrayFormatType.FLOAT32: int(cydriver.CU_AD_FORMAT_FLOAT)} -_CU_TO_ARRAYFORMAT = ... -_NUMPY_DTYPE_TO_ARRAYFORMAT = ... +_CU_TO_ARRAYFORMAT = {cu: fmt for fmt, cu in _ARRAYFORMAT_TO_CU.items()} +_NUMPY_DTYPE_TO_ARRAYFORMAT = {numpy.dtype(fmt.value): fmt for fmt in ArrayFormatType} _FORMAT_ELEM_SIZE = {_ARRAYFORMAT_TO_CU[ArrayFormatType.UINT8]: 1, _ARRAYFORMAT_TO_CU[ArrayFormatType.INT8]: 1, _ARRAYFORMAT_TO_CU[ArrayFormatType.UINT16]: 2, _ARRAYFORMAT_TO_CU[ArrayFormatType.INT16]: 2, _ARRAYFORMAT_TO_CU[ArrayFormatType.FLOAT16]: 2, _ARRAYFORMAT_TO_CU[ArrayFormatType.UINT32]: 4, _ARRAYFORMAT_TO_CU[ArrayFormatType.INT32]: 4, _ARRAYFORMAT_TO_CU[ArrayFormatType.FLOAT32]: 4} @dataclass diff --git a/cuda_core/cuda/core/texture/_mipmapped_array.pyi b/cuda_core/cuda/core/texture/_mipmapped_array.pyi index e4ec707b458..d4fc1be1888 100644 --- a/cuda_core/cuda/core/texture/_mipmapped_array.pyi +++ b/cuda_core/cuda/core/texture/_mipmapped_array.pyi @@ -1,4 +1,4 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/texture/_mipmapped_array.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/texture/_mipmapped_array.pyx from dataclasses import dataclass diff --git a/cuda_core/cuda/core/texture/_surface.pyi b/cuda_core/cuda/core/texture/_surface.pyi index b153ff31fed..7b509771213 100644 --- a/cuda_core/cuda/core/texture/_surface.pyi +++ b/cuda_core/cuda/core/texture/_surface.pyi @@ -1,4 +1,4 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/texture/_surface.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/texture/_surface.pyx class SurfaceObject: """A bindless surface handle for kernel-side typed load/store. diff --git a/cuda_core/cuda/core/texture/_texture.pyi b/cuda_core/cuda/core/texture/_texture.pyi index 16508003091..865f982916b 100644 --- a/cuda_core/cuda/core/texture/_texture.pyi +++ b/cuda_core/cuda/core/texture/_texture.pyi @@ -1,4 +1,4 @@ -# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/texture/_texture.pyx +# This file was generated by stubgen-pyx v0.2.22 from cuda_core/cuda/core/texture/_texture.pyx from dataclasses import dataclass diff --git a/cuda_core/pyproject.toml b/cuda_core/pyproject.toml index e536f2bbf52..3eac3a4c0af 100644 --- a/cuda_core/pyproject.toml +++ b/cuda_core/pyproject.toml @@ -146,20 +146,6 @@ implicit_reexport = true # Ignore missing imports for now (you can tighten this later) ignore_missing_imports = true -[[tool.mypy.overrides]] -# cpdef functions with Cython-native tuple return types can't carry type args -# through stubgen-pyx; suppress the resulting type-arg error for this module. -module = "cuda.core._utils.cuda_utils" -disable_error_code = ["type-arg"] - -[[tool.mypy.overrides]] -# stubgen-pyx can't resolve DLPackExchangeAPI's C function-pointer typedef -# fields and emits bare "..." as their annotation, which is invalid outside -# a Callable[...] context. Suppress until upstream is fixed: -# https://github.com/jon-edward/stubgen-pyx/issues (report pending) -module = "cuda.core._dlpack" -disable_error_code = ["misc"] - [tool.cibuildwheel] skip = "*-musllinux_*" build-verbosity = 1