This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

half_ and native_ functions not compiling in Samsung Galaxy S7

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:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#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);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

And this is the code used to compile it:

Fullscreen
1
2
3
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");
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I have downloaded the headers for OpenCL 1.2 from khronos.

Do you know what am I doing wrong?

0