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 in creating TensorGPU when stream key is None in CUDA array interface #5423

Open
1 task done
tadejsv opened this issue Apr 11, 2024 · 2 comments
Open
1 task done
Assignees
Labels
bug Something isn't working

Comments

@tadejsv
Copy link

tadejsv commented Apr 11, 2024

Version

1.36.0

Describe the bug.

A TensorGPU can be created from any object conforming to a CUDA Array Interface. Version 3 of this interface (accodring to numba docs) has a stream property, which can be either an integer or None.

DALI, however, always assumes that it will be an integer - which can lead to bugs in some cases, like in the example where I am trying to convert a gpuarray from pycuda package.

The code responsible for this bug is

if (cu_a_interface.contains("stream")) {
auto order = AccessOrder(cudaStream_t(PyLong_AsVoidPtr(cu_a_interface["stream"].ptr())));
batch->set_order(order);
}

and the bug was introduced with #5125, which was released in 1.32.0

Minimum reproducible example

import numpy as np
import nvidia.dali.backend as backend
import pycuda.autoinit  # noqa
import pycuda.gpuarray as gpuarray

test_input = np.random.randn(4, 4).astype(np.float32)
g = gpuarray.to_gpu(test_input)
print(g.__cuda_array_interface__)
# {'shape': (4, 4), 'strides': (16, 4), 'data': (139775629590528, False), 'typestr': '<f4', 'stream': None, 'version': 3}
backend.TensorGPU(g)

Relevant log output

SystemError: <built-in method __init__ of PyCapsule object at 0x7f3cca6db060> returned a result with an exception set

Other/Misc.

No response

Check for duplicates

  • I have searched the open bugs/issues and have found no duplicates for this bug report
@tadejsv tadejsv added the bug Something isn't working label Apr 11, 2024
@JanuszL JanuszL assigned mzient and unassigned klecki Apr 11, 2024
@mzient
Copy link
Contributor

mzient commented Apr 11, 2024

@tadejsv Thanks for reporting. It looks indeed like an omission. We'll look into that.

@JanuszL
Copy link
Contributor

JanuszL commented Apr 12, 2024

I think #5425 should fix the issue. Please check the nightly build after it is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants