Created attachment 113290 [details] source code to reproduce the bug A simple kernel performing fmod returns wrong results when compared to the C's math library. The attached file can reproduce this problem. System tested on: Device: Intel(R) HD Graphics IvyBridge GT2 Beignet version: Release_v1.0.0 Linux Kernel: 3.18.4-1-ARCH
I just tried the test case with strict conformance mode, and it could pass. The difference between strict conformance mode and the normal mode[default] is that the normal mode will try to use Gen instruction to implement a fast but less accuracy math library. For this example: fmod(3.0, 0.3), the theoritical result should be 0. But considering that the 0.3 could not be represented accurately by float point data. Actually 0.3f is 0.30000001, so fmod (3.0, 0.30000001) should be 0.29999989. This accuracy requirement exceeds the default mode's range. If your applications require numerical accurate result, I'd recommend you to always enable the strict conformance mode by set the following envirnment variabe before you call into beignet to compile ocl kernels. export OCL_STRICT_CONFORMACE=1 I you found its performance is very bad for some important applications, you are welcome to file performance bug here. Thanks.
yes, running with strict conformance fixed the issue.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.