10 Replies Latest reply on Oct 13, 2015 6:13 AM by dipak

    Running OpenCL 2.0 kernel loaded from binary returning wrong results

    doqtor

      The problem is when using logarithms. See below example:

       

      __kernel __attribute__((reqd_work_group_size(256, 1, 1)))

      void test(__global double *a, __global double *c)

      {

          int local_id = get_local_id(0);

          c[local_id] = log(a[local_id]);

      }

       

      Array "a" is filled with numbers from 0 to 255:

      double a[256] = {0...255};

       

      Then the first 3 results are OK but then the rest is wrong:

       

      wrong result [3]: -1.74441e+136 <> 1.09861

      wrong result [5]: 1.37262 <> 1.60944

      wrong result [6]: -1.74441e+136 <> 1.79176

      wrong result [7]: -2.68156e+154 <> 1.94591

      wrong result [9]: 2.07944 <> 2.19722

      wrong result [10]: 2.06577 <> 2.30259

      ...

      wrong result [255]: 4.84812 <> 5.54126

       

      The same kernel works fine when built online or when built as OpenCL1.x online or loaded from binary.