Opengl 64bit error clSetKernelArg -51 at run time

I try to build my AKP under android using the 64bit openCL library. Coplilation and insrtallation are fine with 32 lib and 64 lib.
But at run time, using the 64 lib i got clSetKernelArg -51 error.

bufferNV21      = cl::Buffer(gContext, CL_MEM_READ_ONLY|CL_MEM_USE_HOST_PTR , isize*sizeof(cl_uchar), in, NULL); 
where isize is the size of NV21 format
        gNV21Kernel.setArg(0,0); // debug
        gNV21Kernel.setArg(1,0); // debugIdx
        gNV21Kernel.setArg(2,0); // GRAY
        gNV21Kernel.setArg(3,bufferRGBA); // output RGBA
        gNV21Kernel.setArg(4,0);  // HSV
        gNV21Kernel.setArg(5,0);  // HSL
        gNV21Kernel.setArg(6,0);  // HSI
        gNV21Kernel.setArg(7,0);  // MMM
        gNV21Kernel.setArg(8,bufferNV21); // input NV21
        gNV21Kernel.setArg(9,w);
        gNV21Kernel.setArg(10,h);
        gNV21Kernel.setArg(11,ligth);
__kernel void nv21torgba( __global    int*   debug,
                          __global    int*   debugIdx,
                          __global uchar4* Gray,
                          __global uchar4* RGBA,
                          __global uchar4* HSV,
                          __global uchar4* HSL,
                          __global uchar4* HSI,
                          __global uchar4* MMM,
                          __global uchar*  in,
                          int    im_width,
                          int    im_height,
                          int    im_ligth)

do not worry about the kernel name i remame it.

Where can come from the error ?

I still got error on another phonne where 32lib work but 64lib got error at linckage state (.rel.dyn). I read it is related to PIE security or somethings like that, i did not anderstoud the problem.

hi,

something sure on hauwei honnor play i can only use armeabi-v7a to run the APK. arm64-v8a got clSetKernelArg -51 error.

But strange thing append when i let the xiaomi libmigl installed on the hauwei APK getResources().getDisplayMetrics() have change and give also clSetKernelArg error only with openCL not with EGL.

So i think the problem comme from the size of the of the input camera and the size used by openCL buffer size. Not sure but if i chage the video surce size on armeabi-v7a i also got clSetKernelArg with

bufferNV21      = cl::Buffer(gContext, CL_MEM_READ_ONLY|CL_MEM_USE_HOST_PTR , isize*sizeof(cl_uchar), in, NULL); 

Strange.

PS:I think it is more an android studio problem. It behave very strangly when i am changing builld process NDK. The toolchain for build is not so good.

Anyway can run 64bit libraries neither on hauwei honnor play or xiaomi 13T pro. Only using armeabi-v7a.

It loock more and more that the problem provide from the compilater. A change to c++11 and got other kind of error from openCL. like

error: no member named ‘x’ in ‘cl_uchar4’
inter.x = 254;

Do you know what is the good way to compile 64bit library for OpenCL on android ?

this time i use

    LOCAL_CPP_EXTENSION := .cxx .cpp .cc
    LOCAL_CPPFLAGS += -DSUPPORT_OMP -march=armv8-a -fopenmp -fexceptions -fpermissive -Wl,--no-as-needed -std=c++14 -O3
    LOCAL_LDLIBS += -L./libs64
    LOCAL_LDLIBS += -lm -lz -lc -llog -pie -fPIE  -fopenmp
    LOCAL_LDLIBS += -fuse-ld=gold

I did this test:

>         gQueue.enqueueNDRangeKernel(gPrintTest, cl::NDRange(0,0), cl::NDRange(10,10), cl::NDRange(2,2),0,&arraySecondEvent);
>         arraySecondEvent.wait();

with this kernel

> __kernel void PrintTest()
> {
>     printf( "ceci est le kernel PrintTest \n");
> }

and i still got clSetKernelArg -51 = CL_INVALID_ARG_SIZE.

So in this case there is no arguments passed to the kernel. The kernel is just compiled with 64bit libc++. With 32libc++ compiler things work.

So it could be that the CL::Program how built the kernel can only be compiled with 32bit compiler but not with 64bit compiler.

What do you think of this possible error compiling kernel with 64bit compiler on phonne architecture.

Hi,

Nobody got any idea. It would be nice to be able to anderstand why this can append.