Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
leofang opened this issue Jan 9, 2025 · 0 comments
Open
Labels
breaking Breaking changes are introduced cuda.core Everything related to the cuda.core module enhancement Any code-related improvements P0 High priority - Must do!

Comments

@leofang
Copy link
Member

leofang commented Jan 9, 2025

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.

@leofang leofang added breaking Breaking changes are introduced cuda.core Everything related to the cuda.core module enhancement Any code-related improvements P0 High priority - Must do! labels Jan 9, 2025
@leofang leofang added this to the cuda.core beta 3 milestone Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Breaking changes are introduced cuda.core Everything related to the cuda.core module enhancement Any code-related improvements P0 High priority - Must do!
Projects
None yet
Development

No branches or pull requests

1 participant