Skip to content

Commit da79d63

Browse files
leofangclaude
andauthored
Expose type aliases and protocols via cuda.core.typing (#1827)
* Expose type aliases and protocols via cuda.core.typing Add a public cuda.core.typing module that re-exports type aliases and protocols used in cuda.core API signatures (IsStreamT, DevicePointerT, VirtualMemory*T). These were previously only accessible via private module paths, which broke in v0.5.0. Closes #1419 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Update copyright headers to 2026 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Remove VMM type aliases, keep only IsStreamT and DevicePointerT Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 8204668 commit da79d63

File tree

3 files changed

+44
-2
lines changed

3 files changed

+44
-2
lines changed

cuda_core/cuda/core/typing.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
"""Public type aliases and protocols used in cuda.core API signatures."""
6+
7+
from cuda.core._memory._buffer import DevicePointerT
8+
from cuda.core._stream import IsStreamT
9+
10+
__all__ = [
11+
"DevicePointerT",
12+
"IsStreamT",
13+
]

cuda_core/docs/source/api_private.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ CUDA runtime
1616
.. autosummary::
1717
:toctree: generated/
1818

19-
_memory._buffer.DevicePointerT
19+
typing.DevicePointerT
2020
_memory._virtual_memory_resource.VirtualMemoryAllocationTypeT
2121
_memory._virtual_memory_resource.VirtualMemoryLocationTypeT
2222
_memory._virtual_memory_resource.VirtualMemoryGranularityT
@@ -50,4 +50,4 @@ CUDA protocols
5050
:toctree: generated/
5151
:template: protocol.rst
5252

53-
_stream.IsStreamT
53+
typing.IsStreamT
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
"""Tests for cuda.core.typing public type aliases and protocols."""
6+
7+
8+
def test_typing_module_imports():
9+
"""All type aliases and protocols are importable from cuda.core.typing."""
10+
from cuda.core.typing import (
11+
DevicePointerT,
12+
IsStreamT,
13+
)
14+
15+
assert DevicePointerT is not None
16+
assert IsStreamT is not None
17+
18+
19+
def test_typing_matches_private_definitions():
20+
"""cuda.core.typing re-exports match the original private definitions."""
21+
from cuda.core._memory._buffer import DevicePointerT as _DevicePointerT
22+
from cuda.core._stream import IsStreamT as _IsStreamT
23+
from cuda.core.typing import (
24+
DevicePointerT,
25+
IsStreamT,
26+
)
27+
28+
assert DevicePointerT is _DevicePointerT
29+
assert IsStreamT is _IsStreamT

0 commit comments

Comments
 (0)