[Bug] NDArray::IsAligned Can't Work for OpenCL, Vulkan Device API, should it is removed? #16753
Labels
needs-triage
PRs or issues that need to be investigated by maintainers to find the right assignees to address it
type: bug
When using OpenCL + Graph Executor + set_input_zero_copy, we found below code will raise exception, actually we know the NDArray is allocated by the OpenCL device API, it should satisfy the alignment requirement.
After browsing some code of OpenCL device API, we found that OpenCL device API finally will return a pointer of host structure
BufferDescriptor
, and this pointer is convert tovoid*
, and store in thedata
field ofDLTensor
.This is the reason why the 1st figure alignment check failed, the vulkan device API use the same mechanism, so it have the same problem.
Why Relay VM haven't meet this failed check?
Acturally Relay VM is impacted by this issue too, the different is Relay VM won't raise exception, but do a non-need copy.
Even through we will pass the aligement argument to the interface
virtual void* AllocDataSpace(Device dev, size_t nbytes, size_t alignment, DLDataType type_hint) = 0;
of classDeviceAPI
, but I found except CPU, it seems all of other device can't avoid to specify aligment when alloc data through their runtime API.So why we need this alignment? can we deleted these checks?
The text was updated successfully, but these errors were encountered: