<?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 Bug in OpenCL Code Builder's Debugger in OpenCL* for CPU</title>
    <link>https://community.intel.com/t5/OpenCL-for-CPU/Bug-in-OpenCL-Code-Builder-s-Debugger/m-p/1021212#M3300</link>
    <description>&lt;P&gt;To start this post off, I would like to say that I do not take the term "bug" lightly - it gets thrown around on the internet often, but usually when someone does not understand the tool set. I hope this post is not one of those, but my research tells me otherwise. TL;DR clause: there appears to be a problem with get_global_size(dim) from the debugger.&lt;/P&gt;

&lt;P&gt;Lets start by defining a simple kernel (emphasis on simple) - set the value of the array element in an in/out buffer to its associated linear index:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;__kernel void test_kernel(__global int* buffer)
{    
    int2 pos = {get_global_id(0), get_global_id(1)};
    int2 gs = {get_global_size(0), get_global_size(1)};
    int i = pos.x + pos.y*gs.x;
    
    buffer&lt;I&gt; = i;
}&lt;/I&gt;&lt;/PRE&gt;

&lt;P&gt;In Intel OpenCL Code Builder (64-bit), version 1.4.0.25, if we run the kernel in the analyzer with a global size (x,y,z) of 1024,1024,0, this works as expected. The buffer is of size 1024*1024 and gets the correct associated index - so the runtime seems OK.&lt;/P&gt;

&lt;P&gt;If you run the same thing in the debugger (see below), the issue arises - one would expect per the standard that get_global_size() will return 1024, right?&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Fig1.png"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/7749i16700146C093C29C/image-size/large?v=v2&amp;amp;px=999&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="Fig1.png" alt="Fig1.png" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Not quite. If we start the debugger and go to global work item 1023x1023 (the 'lower right' if you want to think of it geometrically in 2D with dimension 0 as the x-axis and 1 as the y-axis), running up until the last instruction, we observe that the global sizes are flat wrong:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Fig2.png"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/7750i35247ABE788CBAFF/image-size/large?v=v2&amp;amp;px=999&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="Fig2.png" alt="Fig2.png" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;In the above, I set the local size to 16x16x0. Everything appears right in the debugger selections, I can select item 1023,1023 and I get local work group 63,63 item 15,15. But the global size is 16 (???), leading to incorrect buffer indexing.&lt;/P&gt;

&lt;P&gt;Other notes: Sometimes when I run this the application in the 64-bit version it crashes and I have never had luck in 32-bit mode. Because this has been such a great learning tool for OpenCL up to this point, I would like to recommend it for use in the workspace… but realistically can’t with such a blatant deficiency (nothing against anyone really, this kind of thing happens).&lt;/P&gt;

&lt;P&gt;Can someone let me know if I am doing anything wrong, or perhaps take a look into the matter?&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jul 2015 02:40:54 GMT</pubDate>
    <dc:creator>Jason_L_1</dc:creator>
    <dc:date>2015-07-22T02:40:54Z</dc:date>
    <item>
      <title>Bug in OpenCL Code Builder's Debugger</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Bug-in-OpenCL-Code-Builder-s-Debugger/m-p/1021212#M3300</link>
      <description>&lt;P&gt;To start this post off, I would like to say that I do not take the term "bug" lightly - it gets thrown around on the internet often, but usually when someone does not understand the tool set. I hope this post is not one of those, but my research tells me otherwise. TL;DR clause: there appears to be a problem with get_global_size(dim) from the debugger.&lt;/P&gt;

&lt;P&gt;Lets start by defining a simple kernel (emphasis on simple) - set the value of the array element in an in/out buffer to its associated linear index:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;__kernel void test_kernel(__global int* buffer)
{    
    int2 pos = {get_global_id(0), get_global_id(1)};
    int2 gs = {get_global_size(0), get_global_size(1)};
    int i = pos.x + pos.y*gs.x;
    
    buffer&lt;I&gt; = i;
}&lt;/I&gt;&lt;/PRE&gt;

&lt;P&gt;In Intel OpenCL Code Builder (64-bit), version 1.4.0.25, if we run the kernel in the analyzer with a global size (x,y,z) of 1024,1024,0, this works as expected. The buffer is of size 1024*1024 and gets the correct associated index - so the runtime seems OK.&lt;/P&gt;

&lt;P&gt;If you run the same thing in the debugger (see below), the issue arises - one would expect per the standard that get_global_size() will return 1024, right?&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Fig1.png"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/7749i16700146C093C29C/image-size/large?v=v2&amp;amp;px=999&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="Fig1.png" alt="Fig1.png" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Not quite. If we start the debugger and go to global work item 1023x1023 (the 'lower right' if you want to think of it geometrically in 2D with dimension 0 as the x-axis and 1 as the y-axis), running up until the last instruction, we observe that the global sizes are flat wrong:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Fig2.png"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/7750i35247ABE788CBAFF/image-size/large?v=v2&amp;amp;px=999&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="Fig2.png" alt="Fig2.png" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;In the above, I set the local size to 16x16x0. Everything appears right in the debugger selections, I can select item 1023,1023 and I get local work group 63,63 item 15,15. But the global size is 16 (???), leading to incorrect buffer indexing.&lt;/P&gt;

&lt;P&gt;Other notes: Sometimes when I run this the application in the 64-bit version it crashes and I have never had luck in 32-bit mode. Because this has been such a great learning tool for OpenCL up to this point, I would like to recommend it for use in the workspace… but realistically can’t with such a blatant deficiency (nothing against anyone really, this kind of thing happens).&lt;/P&gt;

&lt;P&gt;Can someone let me know if I am doing anything wrong, or perhaps take a look into the matter?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2015 02:40:54 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Bug-in-OpenCL-Code-Builder-s-Debugger/m-p/1021212#M3300</guid>
      <dc:creator>Jason_L_1</dc:creator>
      <dc:date>2015-07-22T02:40:54Z</dc:date>
    </item>
    <item>
      <title>Jason,</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Bug-in-OpenCL-Code-Builder-s-Debugger/m-p/1021213#M3301</link>
      <description>&lt;P&gt;Jason,&lt;/P&gt;

&lt;P&gt;I will take a look at this. First, a couple of clarifying questions:&lt;/P&gt;

&lt;P&gt;1. Which processor do you have?&lt;/P&gt;

&lt;P&gt;2. Which operating system are you running on?&lt;/P&gt;

&lt;P&gt;3. Which graphics driver do you have?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2015 16:16:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Bug-in-OpenCL-Code-Builder-s-Debugger/m-p/1021213#M3301</guid>
      <dc:creator>Robert_I_Intel</dc:creator>
      <dc:date>2015-07-22T16:16:56Z</dc:date>
    </item>
    <item>
      <title>Quote:Robert I. (Intel) wrote</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Bug-in-OpenCL-Code-Builder-s-Debugger/m-p/1021214#M3302</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Robert I. (Intel) wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Jason,&lt;/P&gt;

&lt;P&gt;I will take a look at this. First, a couple of clarifying questions:&lt;/P&gt;

&lt;P&gt;1. Which processor do you have?&lt;/P&gt;

&lt;P&gt;2. Which operating system are you running on?&lt;/P&gt;

&lt;P&gt;3. Which graphics driver do you have?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;1) Intel Core i7 975&lt;/P&gt;

&lt;P&gt;2) Windows 7 x64&lt;/P&gt;

&lt;P&gt;3) OpenCL Runtime 15.1 x64 (MSI MD5: d6567a351b2af16bde82ee9e92bc6869)&lt;/P&gt;</description>
      <pubDate>Sat, 25 Jul 2015 06:20:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Bug-in-OpenCL-Code-Builder-s-Debugger/m-p/1021214#M3302</guid>
      <dc:creator>Jason_L_1</dc:creator>
      <dc:date>2015-07-25T06:20:26Z</dc:date>
    </item>
  </channel>
</rss>

