Skip to content

Retain the underlying object types when retrieving the .handle attribute #370

Closed
@leofang

Description

@leofang

Today we always return a Python int and erase the type information, e.g.

@property
def handle(self) -> int:
"""Return the underlying cudaStream_t pointer address as Python int."""
return int(self._mnff.handle)

However, it could be possible that users want to retain the underlying cuda.binding type so that it can be consumed in, say, Cython:

from cuda.core.experimental import Device

from cuda.bindings.runtime cimport cudaStream_t

s = Device().create_stream()

cdef cudaStream_t s_cy = s.handle

We should keep .handle's type, and add .ptr that returns the type-erased pointer address as Python int.

Metadata

Metadata

Assignees

Labels

P0High priority - Must do!breakingBreaking changes are introducedcuda.coreEverything related to the cuda.core moduleenhancementAny code-related improvements

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions