Uh oh!
There was an error while loading. Please reload this page.
[OpenCL] Skip opencl memory operations on empty tensors - #7672
Conversation
masahi
commented
Mar 16, 2021
Since this is not a opencl specific problem, ideally we should think about how to handle this case in all backends. For now I think we should have the same change for cuda, rocm, and vk as well. |
mbrookhart
commented
Mar 16, 2021
I don't think cuda has this issue, I this cudamalloc does this under the hood, as does standard C malloc. I agree, though, it looks like we need it for rocm and vulkan. |
tmoreau89
commented
Mar 16, 2021
Can the runtime attempt to free a buffer that was allocated that is of size 0? Could that trigger a segfault? |
mbrookhart
commented
Mar 16, 2021
Feasibly. I didn't see such an issue with opencl, but indeed memory freeing doesn't pass in size, so I can't do the same check: tvm/src/runtime/opencl/opencl_device_api.cc Lines 129 to 136 in e697f03 |
mbrookhart
commented
Mar 16, 2021
But it would be easy to check for null before freeing |
masahi
commented
Mar 16, 2021
Maybe we can implement all book keeping stuff in |
mbrookhart
commented
Mar 16, 2021
It's messy, but we could write a default method that checks for these things and then calls a helper function. We then mark the default function as final and change ALL of the device classes to override the helper functions. |
mbrookhart
commented
Mar 18, 2021
Closing in favor of #7691 |
cc @masahi@tmoreau89