Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cuda_core/cuda/core/_context.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 5 additions & 1 deletion cuda_core/cuda/core/_device.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion cuda_core/cuda/core/_device_resources.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand Down
31 changes: 19 additions & 12 deletions cuda_core/cuda/core/_dlpack.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -22,7 +29,7 @@ class DLDataType(TypedDict):
lanes: int

class DLTensor(TypedDict):
data: None
data: Any
device: DLDevice
ndim: int
dtype: DLDataType
Expand All @@ -32,17 +39,17 @@ 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
minor: int

class DLManagedTensorVersioned(TypedDict):
version: DLPackVersion
manager_ctx: None
deleter: Callable[..., Any]
manager_ctx: Any
deleter: Callable[[DLManagedTensorVersioned], None]
flags: int
dl_tensor: DLTensor

Expand All @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions cuda_core/cuda/core/_event.pyi
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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, ...]: ...

Expand Down
2 changes: 1 addition & 1 deletion cuda_core/cuda/core/_graphics.pyi
Original file line number Diff line number Diff line change
@@ -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

Expand Down
12 changes: 8 additions & 4 deletions cuda_core/cuda/core/_kernel_arg_handler.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion cuda_core/cuda/core/_launch_config.pyi
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion cuda_core/cuda/core/_launcher.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand Down
11 changes: 7 additions & 4 deletions cuda_core/cuda/core/_layout.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
"""
Expand Down
4 changes: 3 additions & 1 deletion cuda_core/cuda/core/_linker.pyi
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cuda_core/cuda/core/_memory/_buffer.pyi
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion cuda_core/cuda/core/_memory/_copy_attributes.pyi
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion cuda_core/cuda/core/_memory/_copy_ops.pyi
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion cuda_core/cuda/core/_memory/_device_memory_resource.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion cuda_core/cuda/core/_memory/_graph_memory_resource.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion cuda_core/cuda/core/_memory/_ipc.pyi
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion cuda_core/cuda/core/_memory/_location.pyi
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion cuda_core/cuda/core/_memory/_managed_memory_ops.pyi
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion cuda_core/cuda/core/_memory/_managed_memory_resource.pyi
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion cuda_core/cuda/core/_memory/_memory_pool.pyi
Original file line number Diff line number Diff line change
@@ -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

Expand Down
19 changes: 11 additions & 8 deletions cuda_core/cuda/core/_memory/_peer_access_utils.pyi
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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``;
Expand All @@ -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: ...
Expand All @@ -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``.
Expand Down
10 changes: 6 additions & 4 deletions cuda_core/cuda/core/_memory/_peer_access_utils.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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

Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion cuda_core/cuda/core/_memory/_pinned_memory_resource.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 4 additions & 4 deletions cuda_core/cuda/core/_memoryview.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
Expand Down
Loading
Loading