CLAccumulateWeighted throws error while executing
Hi,
When trying to use CLAccumulateWeighted class, I am getting an error message. Please refer the attached log message to see the error details. A sample application code is also attached here for your reference.
Please let me know how to resolve this issue.
Thanks, Rohit
Hi @rohit-unnimadhavan , Can you provide some more information? What options do you use to build the library? What is your platform? Also, I see an error inside the file you provided: BC-src-code:126:86:{126:66-126:85}{126:89-126:94}: error: can't convert between vector values of different size. Where is this from? Is this from Compute library?
Hi @mpekatsoula ,
Were you able to recreate the issue at your end with the sample code given?
We are building the library in Ubuntu using a proprietary toolchain. I have added some prints to check where the error comes from. The modified code and the corresponding log is attached here for your reference. It can be seen from the log that the error is being thrown by the configure call from the Compute Library.
Please let us know if you require more details.
Thanks, Rohit cl_accumWtd_16x16log_with_print.txt cl_accumWtd.txt
Hi @rohit-unnimadhavan ,
I think this could be related to the toolchain you are using. Can you try casting 'shift' in /src/core/CL/cl_kernels/accumulate.cl and tell me if this works for you?
short16 res = convert_short16_sat(accu_data + convert_uint16((in_data * in_data) >> (short16)shift));
Hi @mpekatsoula ,
I tried casting the 'shift' variable in ComputeLibrary source file as you suggested and that resolved the issue.
What does it mean though? Could you please confirm whether this is an issue with the Compute Library itself (in which case, we can expect a patch release?) or with the toolchain we are using?
Thanks, Rohit
It looks like your toolchain doesn't support the shift operation using both vector and scalar values. OpenCL specification states (section 6.3.j):
For the right-shift (>>), left-shift (<<) operators, the rightmost operand must be a scalar if the first operand is a scalar, and the rightmost operand can be a vector or scalar if the first operand is a vector.
Try to use a more recent toolchain. If this is not possible, you might need to tweak the code like above.
Marking this as solved.
Hi,
Could you please reopen this issue?
We were able to recreate the issue using one of the recommended toolchains - gcc-linaro-4.9-2016.02-x86_64_aarch64-linux-gnu (Downloaded from https://releases.linaro.org/components/toolchain/binaries/4.9-2016.02/aarch64-linux-gnu/
The scons build options are as below. scons Werror=1 -j8 debug=0 neon=1 opencl=1 os=linux arch=arm64-v8a build=cross_compile
The stand alone application is built as below. aarch64-linux-gnu-g++ examples/cl_accumWtd.cpp utils/Utils.cpp -I. -Iinclude -std=c++11 -L. -Lbuild -Lbuild/opencl-1.2-stubs -larm_compute -larm_compute_core -lOpenCL -o cl_accumWtd -DARM_COMPUTE_CL
Again, even with linaro toolchain, this issue got resolved if i am doing an explicit cast (to ushort16) in /src/core/CL/cl_kernels/accumulate.cl as before.
Could you please give your comments regarding this?
Thanks, Rohit
Hello @rohit-unnimadhavan ,
What does the linaro toolchain has to do with the OpenCL frontend issues? What board are you trying to run on and what GPU does it have? It seems you GPU's driver OpenCL frontend does not support the respective operation. We can switch to explicit cast but this is an issue of the GPU's driver compiler.
As mentioned by @mpekatsoula, your GPU driver does not implement:
For the right-shift (>>), left-shift (<<) operators, the rightmost operand must be a scalar if the first operand is a scalar, and the rightmost operand can be a vector or scalar if the first operand is a vector.
Closing this issue: this seems to be a bug in the OpenCL driver of the platform, not the Compute Library