hi,
i asked this question on khronos forum but i got no answer. So i decided to ask the question on this forum.
I used to do the following procces with openCL on Android.
Working with:
- Mali-G715-Immortalis MC11 r1p2
- OpenCL 3.0 v1.r38p1-01eac0.c1a71ccca2acf211eb87c5db5322f569
- SVM_COARSE_GRAIN_BUFFER supported
i create the platform,queu,devive. Create all my cl::buffer and compile all the kernel at the start of my application.
i get picture from my camera and send the byte data using JNI jbyteArray =>((uint8_t*)inPtr) to my c++ function.
i get the (uint8_t*)inPtr pointer than i use cl::buffer to feed the buffer with the camera picture data, using : bufferNV21 = cl::Buffer(gContext, CL_MEM_READ_ONLY|CL_MEM_USE_HOST_PTR , isize*sizeof(cl_uchar), inPtr , NULL); this take less than 1ms.
i process my kernel NV21toRGB than i do some staff with my output buffer.
i use enqueueMapBuffer to point the Buffer,buf, to my local program memory and that wil be used by pthread CPU processing. take less than 2ms
than i copy back the CPU result to the GPU buffer doing: bufferligne = cl::Buffer(gContext, CL_MEM_USE_HOST_PTR, (1024*1024)*sizeof(cl_uchar4), buf, NULL); // remplace enqueueWriteBuffer. this take less than 3ms
do some kernel on bufferligne cl::buffer
then send back the GPU buffer(bufferMMM) to Java out bitmap using gQueue.enqueueReadBuffer(bufferMMM, CL_TRUE, 0, osize*sizeof(cl_uchar4), out, 0, &arraySecondEvent); // pour openCL this last part take between 3 and 5ms, depends. Sometime less.
So it is relevant to use SVM with my cnfiguration and what should i change if i want to use SVM. Change at step 3,5,7 or 8.
And what does SVM that cl::buffer does not. I would like to anderstand Why to use.
i could improved the speed by using on the kernel.cl file
#pragma OPENCL EXTENSION cl_khr_priority_hints : enable // accelere openCL queue driver #pragma OPENCL EXTENSION CL_QUEUE_PRIORITY_HIGH_KHR : enable
and on the .cpp file
// Optional extension support #define CL_HPP_USE_IL_KHR #define CL_HPP_USE_CL_SUB_GROUPS_KHR #define CL_HPP_OPENCL_API_WRAPPER