Skip to content

Commit 0cd20d8

Browse files
committed
Merge branch 'path_finder_dev' into path_finder_review1
2 parents c409346 + ceff853 commit 0cd20d8

File tree

6 files changed

+43
-6
lines changed

6 files changed

+43
-6
lines changed

cuda_core/cuda/core/experimental/_event.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -164,5 +164,11 @@ def is_done(self) -> bool:
164164

165165
@property
166166
def handle(self) -> cuda.bindings.driver.CUevent:
167-
"""Return the underlying CUevent object."""
167+
"""Return the underlying CUevent object.
168+
169+
.. caution::
170+
171+
This handle is a Python object. To get the memory address of the underlying C
172+
handle, call ``int(Event.handle)``.
173+
"""
168174
return self._mnff.handle

cuda_core/cuda/core/experimental/_linker.py

+5
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,11 @@ def handle(self) -> LinkerHandleT:
503503
.. note::
504504
505505
The type of the returned object depends on the backend.
506+
507+
.. caution::
508+
509+
This handle is a Python object. To get the memory address of the underlying C
510+
handle, call ``int(Linker.handle)``.
506511
"""
507512
return self._mnff.handle
508513

cuda_core/cuda/core/experimental/_memory.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import abc
88
import weakref
9-
from typing import Optional, Tuple, TypeVar
9+
from typing import Optional, Tuple, TypeVar, Union
1010

1111
from cuda.core.experimental._dlpack import DLDeviceType, make_py_capsule
1212
from cuda.core.experimental._stream import default_stream
@@ -18,6 +18,9 @@
1818
# TODO: define a memory property mixin class and make Buffer and
1919
# MemoryResource both inherit from it
2020

21+
DevicePointerT = Union[driver.CUdeviceptr, int, None]
22+
"""A type union of `Cudeviceptr`, `int` and `None` for hinting Buffer.handle."""
23+
2124

2225
class Buffer:
2326
"""Represent a handle to allocated memory.
@@ -81,8 +84,14 @@ def close(self, stream=None):
8184
self._mnff.close(stream)
8285

8386
@property
84-
def handle(self):
85-
"""Return the buffer handle object."""
87+
def handle(self) -> DevicePointerT:
88+
"""Return the buffer handle object.
89+
90+
.. caution::
91+
92+
This handle is a Python object. To get the memory address of the underlying C
93+
handle, call ``int(Buffer.handle)``.
94+
"""
8695
return self._mnff.ptr
8796

8897
@property

cuda_core/cuda/core/experimental/_module.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -354,5 +354,11 @@ def code(self) -> CodeTypeT:
354354
@property
355355
@precondition(_lazy_load_module)
356356
def handle(self):
357-
"""Return the underlying handle object."""
357+
"""Return the underlying handle object.
358+
359+
.. caution::
360+
361+
This handle is a Python object. To get the memory address of the underlying C
362+
handle, call ``int(ObjectCode.handle)``.
363+
"""
358364
return self._handle

cuda_core/cuda/core/experimental/_program.py

+5
Original file line numberDiff line numberDiff line change
@@ -524,5 +524,10 @@ def handle(self) -> ProgramHandleT:
524524
.. note::
525525
526526
The type of the returned object depends on the backend.
527+
528+
.. caution::
529+
530+
This handle is a Python object. To get the memory address of the underlying C
531+
handle, call ``int(Program.handle)``.
527532
"""
528533
return self._mnff.handle

cuda_core/cuda/core/experimental/_stream.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,13 @@ def __cuda_stream__(self) -> Tuple[int, int]:
189189

190190
@property
191191
def handle(self) -> cuda.bindings.driver.CUstream:
192-
"""Return the underlying ``CUstream`` object."""
192+
"""Return the underlying ``CUstream`` object.
193+
194+
.. caution::
195+
196+
This handle is a Python object. To get the memory address of the underlying C
197+
handle, call ``int(Stream.handle)``.
198+
"""
193199
return self._mnff.handle
194200

195201
@property

0 commit comments

Comments
 (0)