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

[BUG] DLPack implementation doesn't handle nullptr for strides #2095

Closed
kkraus14 opened this issue Mar 12, 2019 · 3 comments · Fixed by #2097
Closed

[BUG] DLPack implementation doesn't handle nullptr for strides #2095

kkraus14 opened this issue Mar 12, 2019 · 3 comments · Fixed by #2097

Comments

@kkraus14
Copy link

According to DLPack spec if the strides attribute is NULL it indicates a dense tensor (https://github.com/dmlc/dlpack/blob/master/include/dlpack/dlpack.h#L142).

The current implementation in cupy will cause a segfault if mem.dlm_tensor.dl_tensor.strides is null as it will try to index into it (https://github.com/cupy/cupy/blob/v6.0.0b3/cupy/core/dlpack.pyx#L236).

@kmaehashi
Copy link
Member

Thanks for pointing this out!
Just out of curiosity, do you know any framework that uses strides == NULL?

@kkraus14
Copy link
Author

Thanks for pointing this out!
Just out of curiosity, do you know any framework that uses strides == NULL?

We recently added support for DLPack in rapidsai/cudf#1159 and originally used null pointers for dense buffers which is what led to us discovering this issue. We switched it accordingly, but I imagine others implementing DLPack based on the spec could make the same issue.

@crcrpar
Copy link
Contributor

crcrpar commented Mar 21, 2019

Thank you for your response very much and kudos to

We switched it accordingly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants