In c++ opencl API. How to let gpu "DLTensor *x" get the input cpu data using mali gpu?

When the device_type = kDLCPU. these code run ok.

TVMArrayAlloc(in_shape, in_ndim, dtype_code, dtype_bits, dtype_lanes, device_type, device_id, &x);
// load image data saved in binary
std::ifstream data_fin("cat.bin", std::ios::binary);<char*>(x->data), 3 * 224 * 224 * 4);

But when device_type = kDLOpenCL.these code is not work.Does anyone know how to use is right? Thank you very much!


I don’t think you need to request GPU memory while setting the inputs.
While executing each TVM operator, based on target (CPU/GPU) it copies to respective target allocated area.



see my answer here