-
Notifications
You must be signed in to change notification settings - Fork 894
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
Add to_dlpack/from_dlpack APIs to pylibcudf #17055
base: branch-24.12
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like PyCapsule
s are used to handle raw C pointers in Python? So it makes sense to me to type from_dlpack
and to_dlpack
withobject
. I'd like to see what @vyasr thinks because I'm not sure.
Table with a copy of the tensor data. | ||
""" | ||
cdef unique_ptr[table] c_result | ||
cdef DLManagedTensor* dlpack_tensor = <DLManagedTensor*>PyCapsule_GetPointer( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add some of the safety checks from https://dmlc.github.io/dlpack/latest/python_spec.html#implementation to ensure that we don't try to consume an already deleted capsule or anything like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added one check, lmk if you were thinking of any others
Description
Contributes to #15162
Could use some advice how to type the input of
from_dlpack
and outut ofto_dlpack
which are PyCapsule objects.EDIT: I notice Cython just types them as object https://github.com/cython/cython/blob/master/Cython/Includes/cpython/pycapsule.pxd. Stylistically do we want add
object var_name
or just leave untyped?Checklist