Dear all,
I know OpenCL on Qualcomm SoC has a device-host unified memory architecture.
Does it mean when I call clCreateBuffer API, I should set CL_MEM_USE_HOST_PTR no matter CL_MEM_READ_ONLY or CL_MEM_WRITE_ONLY is set?
Do I really need to use clEnqueueReadBuffer & clEnqueueWriteBuffer on Qualcomm SoC? What's the fastest way to access memory in OpenCL C Kernel?
Thank you.
Cathy.
Bump
You should be creating a buffer with CL_MEM_ALLOC_HOST_PTR and use clEnqueueMapBuffer and clEnqueueUnmapBuffer to access the buffer on the host cpu. This is regardless of read_only and write_only.
With this approach there is no data copy involved. clEnqueueReadBuffer and clEnqueueWrite buffer will incur the overhead of data copy and are not recommended. Similarly for CL_MEM_USE_HOST_PTR;
We would also encourage you to look at cl_qcom_ion_host_ptr and cl_qcom_android_native_buffer_host_ptr as these will let you share data between different components without copy.