<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Comparison of get_global_id() to int differs when optimizations on/off in OpenCL* for CPU</title>
    <link>https://community.intel.com/t5/OpenCL-for-CPU/Comparison-of-get-global-id-to-int-differs-when-optimizations-on/m-p/1158258#M6233</link>
    <description>&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Hi&lt;/SPAN&gt;&lt;SPAN style="font-size: 1em;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;With the following kernel:&lt;/SPAN&gt;&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;__kernel void A(__global double* input) {
  int tid = get_global_id(0);
  if (tid &amp;lt; - 1) {
    input[tid] = 1;
  }
}&lt;/PRE&gt;

&lt;P&gt;The 'if' branch of the conditional should never be executed, since global id is always &amp;gt;= 0. However, on my&amp;nbsp;E5-2620 and&amp;nbsp;i5-4570, it is. When optimizations are disabled, it isn't. Could this be a compiler bug?&lt;/P&gt;

&lt;P&gt;Full test case is here:&amp;nbsp;http://paste.ubuntu.com/25213218/&amp;nbsp;&lt;/P&gt;

&lt;P&gt;My driver version is 1.2.0.25.&lt;/P&gt;

&lt;P&gt;Cheers,&lt;BR /&gt;
	Chris&lt;/P&gt;</description>
    <pubDate>Mon, 31 Jul 2017 13:22:17 GMT</pubDate>
    <dc:creator>Chris_C_1</dc:creator>
    <dc:date>2017-07-31T13:22:17Z</dc:date>
    <item>
      <title>Comparison of get_global_id() to int differs when optimizations on/off</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Comparison-of-get-global-id-to-int-differs-when-optimizations-on/m-p/1158258#M6233</link>
      <description>&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Hi&lt;/SPAN&gt;&lt;SPAN style="font-size: 1em;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;With the following kernel:&lt;/SPAN&gt;&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;__kernel void A(__global double* input) {
  int tid = get_global_id(0);
  if (tid &amp;lt; - 1) {
    input[tid] = 1;
  }
}&lt;/PRE&gt;

&lt;P&gt;The 'if' branch of the conditional should never be executed, since global id is always &amp;gt;= 0. However, on my&amp;nbsp;E5-2620 and&amp;nbsp;i5-4570, it is. When optimizations are disabled, it isn't. Could this be a compiler bug?&lt;/P&gt;

&lt;P&gt;Full test case is here:&amp;nbsp;http://paste.ubuntu.com/25213218/&amp;nbsp;&lt;/P&gt;

&lt;P&gt;My driver version is 1.2.0.25.&lt;/P&gt;

&lt;P&gt;Cheers,&lt;BR /&gt;
	Chris&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 13:22:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Comparison-of-get-global-id-to-int-differs-when-optimizations-on/m-p/1158258#M6233</guid>
      <dc:creator>Chris_C_1</dc:creator>
      <dc:date>2017-07-31T13:22:17Z</dc:date>
    </item>
    <item>
      <title>Thanks for this report.  As I</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Comparison-of-get-global-id-to-int-differs-when-optimizations-on/m-p/1158259#M6234</link>
      <description>&lt;P&gt;Thanks for this report.&amp;nbsp; As I've investigated, I have not been able to reproduce tid having a value of &amp;lt;0 with or without optimizations, with the CPU-only opencl-1.2-6.4.0.25 release or with SRB5.&amp;nbsp; Could you tell us a bit more about your system configuration, and the results you are seeing? &amp;nbsp; The contents of /etc/OpenCL/vendors could help us make sure we are testing the same OpenCL version.&amp;nbsp; What do you see there?&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 19:15:32 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Comparison-of-get-global-id-to-int-differs-when-optimizations-on/m-p/1158259#M6234</guid>
      <dc:creator>Jeffrey_M_Intel1</dc:creator>
      <dc:date>2017-07-31T19:15:32Z</dc:date>
    </item>
    <item>
      <title>Hi Jeffrey,</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Comparison-of-get-global-id-to-int-differs-when-optimizations-on/m-p/1158260#M6235</link>
      <description>&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Hi Jeffrey,&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Thanks for the quick reply. My driver version is:&lt;/P&gt;

&lt;PRE class="brush:bash;"&gt;$ cat /etc/OpenCL/vendors/intel64.icd
/opt/intel/opencl-1.2-6.4.0.25/lib64/libintelocl.so&lt;/PRE&gt;

&lt;P&gt;The OpenCL devices on which I've observed the incorrect output are "&lt;SPAN style="font-size: 1em;"&gt;Intel(R) Xeon(R) CPU E5-2620 v4 @ 2.10GHz" and "&lt;/SPAN&gt;Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz&lt;SPAN style="font-size: 1em;"&gt;", and the host OS is Ubuntu 16.04.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;With the test case I linked above, the output is consistently:&lt;/P&gt;

&lt;PRE class="brush:bash;"&gt;$ gcc foo.c -lOpenCL &amp;amp;&amp;amp; ./a.out 2&amp;gt;/dev/null
computed result: 1.000
$ gcc foo.c -DNO_OPT -lOpenCL &amp;amp;&amp;amp; ./a.out 2&amp;gt;/dev/null
computed result: 0.000&lt;/PRE&gt;

&lt;P&gt;On all other devices I've checked (including an E5-2650 running&amp;nbsp;opencl-1.2-4.4.0.117 release), the output is consistently 0.000.&lt;/P&gt;

&lt;P&gt;Cheers,&lt;BR /&gt;
	Chris&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 21:39:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Comparison-of-get-global-id-to-int-differs-when-optimizations-on/m-p/1158260#M6235</guid>
      <dc:creator>Chris_C_1</dc:creator>
      <dc:date>2017-07-31T21:39:00Z</dc:date>
    </item>
    <item>
      <title>The problem, as best as I can</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Comparison-of-get-global-id-to-int-differs-when-optimizations-on/m-p/1158261#M6236</link>
      <description>&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;The problem, as best as I can tell, appears to be in the implicit conversion of get_global_id() from size_t to int. On my system I am unable to coax the comparison of get_global_id() into int type. This kernel has the equivalent (incorrect) behavior when optimizations are enabled:&lt;/SPAN&gt;&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;__kernel void A(__global double* input) {
  if (((int)get_global_id(0)) &amp;lt; ((int)- 1)) {
    input[tid] = 1; // Executed when opt enabled, not executed when -cl-opt-disable.
  }
}&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 21:45:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Comparison-of-get-global-id-to-int-differs-when-optimizations-on/m-p/1158261#M6236</guid>
      <dc:creator>Chris_C_1</dc:creator>
      <dc:date>2017-07-31T21:45:27Z</dc:date>
    </item>
    <item>
      <title>Thanks for this additional</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Comparison-of-get-global-id-to-int-differs-when-optimizations-on/m-p/1158262#M6237</link>
      <description>&lt;P&gt;Thanks for this additional info. &amp;nbsp;It is interesting that this is only happening on a few types of machines. &amp;nbsp;I'm still getting a 4th Generation Core machine set up for more investigation with the goal of filing a bug. &amp;nbsp;&lt;/P&gt;

&lt;P&gt;In the meantime, the team is wondering about the context of how you found this behavior -- in validation of a larger group of kernels, or in new development?&lt;/P&gt;

&lt;P&gt;Also, you mentioned that &amp;nbsp;you have an e5-2650 that does not have the problem. &amp;nbsp;Is this also v4? &amp;nbsp;If you use a different OpenCL runtime release on your E5-2620 v4 or &amp;nbsp;i5-4570 do you see the expected results?&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2017 01:05:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Comparison-of-get-global-id-to-int-differs-when-optimizations-on/m-p/1158262#M6237</guid>
      <dc:creator>Jeffrey_M_Intel1</dc:creator>
      <dc:date>2017-08-02T01:05:46Z</dc:date>
    </item>
    <item>
      <title>Given the combination of</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Comparison-of-get-global-id-to-int-differs-when-optimizations-on/m-p/1158263#M6238</link>
      <description>&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Given the combination of drivers and hardware I have, I can't be sure which is at fault. I've been able to replicate this bug on:&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;UL&gt;
	&lt;LI&gt;"Intel(R) Xeon(R) CPU E5-2620 v4 @ 2.10GHz" with driver "1.2.0.25" running Ubuntu 16.04&lt;/LI&gt;
	&lt;LI&gt;"Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz" with driver "1.2.0.25"&amp;nbsp;running Ubuntu 16.04&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;But not on:&lt;/P&gt;

&lt;UL&gt;
	&lt;LI&gt;"Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60GHz" with driver "1.2.0.44" running CentOS 7.1&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;The discrepancy was found during batch testing a group of kernels, though I made sure to manually reproduce on the E5-2620.&lt;/P&gt;

&lt;P&gt;Hope that helps.&lt;/P&gt;

&lt;P&gt;Cheers,&lt;BR /&gt;
	Chris&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2017 09:55:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Comparison-of-get-global-id-to-int-differs-when-optimizations-on/m-p/1158263#M6238</guid>
      <dc:creator>Chris_C_1</dc:creator>
      <dc:date>2017-08-02T09:55:27Z</dc:date>
    </item>
  </channel>
</rss>

