I have a opencl program that composed of one .cl file and 16 .h files, it runs perfectly on Nvidia/Intel/Arm Mali device without any problem.
When I tried to port it to my Xiaomi Mi 10, the program crashed at clBuildProgram with SIGABRT.
I have tried the OpenCL.so from the device and the adreno_opencl_ml_sdk_v2.2, same phenomenon. Android version 12. Platform 31.
I can comfirm that sony's example https://www.lantronix.com/blog/running-opencl-sample-application-open-q-... works on my device.
After many days of debuging, I found that when I reduced my code from so many .h files into only 3, the build can be passed. Even more ridiculous, there seems to be a limitation of the code lines. In the 4th .h file, deleting some functions would make the build pass, based on it, however, adding a particular lines of code would bring the SIGABRT error , even it's just simple code like:
```
if (a>b) return 0;
```
At some point, this would fail:
```
if (a>0 || b>0 || c>0 || d>0) return 0;
```
This would pass:
```
if (a>0 || b>0) return 0;
```
This would fail:
```
if (a>0 || b>0) return 0;
if (c>0 || d>0) return 0;
```
As I delete some functions before this code block, they three would all pass the build.
Now I suspect there is a limitation of code in the Opencl linker. Anyone has the idea?
By the way, same thing happens to lib32 and lib64.
The stack:
update: I instantly succeed using Huwei P30 (Huawei chip) without changing any code, also succeed with Samsung phone.