-
Notifications
You must be signed in to change notification settings - Fork 83
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] SetVals failed on tensors that are created from user pointers #175
Comments
I'm not sure this is a bug. You can't call SetVals on non managed memory as it runs on the host. Can you change cudaMalloc to cudaMallocManaged instead? |
there are two options here: we can throw an exception and shut down, or we can detect it's not managed memory and do a cudaMemcpy. I tend to think the latter is better since it should be more consistent. |
@ZJUGuoShuai the issue with passing a device pointer and doing a cudaMemcpy is that you're technically allowed to do something like:
In this example we set partial values per row and leave the rest unitialized. Obviously we can't do a bulk cudaMemcpy in that case. The other option is we launch a cudaMemcpy for every single value. This will be extremely inefficient, but users of Either way, this also has to be blocking on stream 0 since we can't make this asynchronous at the moment. |
I think this is just an invalid usage of the APIs and not a bug. Detecting all cases of invalid memory accesses is not a requirement that any library/SDK should take on. We can clean up documentation to make it clear that wrapping existing memory may be limited if it is not addressable from the host and device. |
@ZJUGuoShuai we closed it and print an error now for the reasons above. Please reopen if you have suggestions on how to improve it. |
Describe the bug
When using
SetVals
on tensors that are created from user pointers, a SegmentFault is thrown.To Reproduce
VSCode Debug Error:
Expected behavior
The
SetVals
should work for tensors created from user pointers.System details (please complete the following information):
The text was updated successfully, but these errors were encountered: