We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I am trying to optimize my OpenCL code running on a Samsung Galaxy S7 (SM-G930F) with an Exynos Octa 8890 and a Mali-T880 using Android. According to OpenCL-Z the gpu supports OpenCL 1.2 full profile. I have a lot of OpenCL code correctly compiling and running. However, I cannot use any of the half_* or native_* functions such as: half_sin or native_sin. As soon as I add one of them I get a CL_BUILD_FAILURE when compiling the kernel. This is one kernel where such behaviour happens:
#pragma OPENCL EXTENSION cl_khr_fp16 : enable half distancePointToEllipse(short2 point, half2 ecenter, half phi, half a, half b) { half2 t = convert_half2(point) - ecenter; half angle = atan2(t.y, t.x) - phi; half cos1, sin1; //cos1 = native_cos(angle); //sin1 = native_sin(angle); sin1 = sincos(angle, &cos1); half tx = a * a * cos1 * cos1; half ty = b * b * sin1 * sin1; //half c = native_sqrt(tx + ty); //half d = native_sqrt(t.x * t.x + t.y * t.y); half c = sqrt(tx + ty); half d = hypot(t.x, t.y); return fabs(d - c); }
And this is the code used to compile it:
auto program_RANSACEllipses = cl::Program(context, CL_RANSAC_ELLIPSES_KERNEL, true); program_RANSACEllipses.build("-cl-std=CL1.2"); Kernels::RANSACEllipses = cl::Kernel(program_RANSACEllipses, "RANSAC");
I have downloaded the headers for OpenCL 1.2 from khronos.
Do you know what am I doing wrong?
Thank you very much. But I already found the problem, I was getting a compiling error which actually makes sense but I wasn't displaying compiling errors... my bad. I will write back in a while with more details in case someone has the same problem in the future.