OpenCL* for CPU
Ask questions and share information on Intel® SDK for OpenCL™ Applications and OpenCL™ implementations for Intel® CPU.
Announcements
This forum covers OpenCL* for CPU only. OpenCL* for GPU questions can be asked in the GPU Compute Software forum. Intel® FPGA SDK for OpenCL™ questions can be ask in the FPGA Intel® High Level Design forum.
1718 Discussions

Bug in OpenCL Code Builder's Debugger

Jason_L_1
Beginner
421 Views

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.

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:

__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 = i;
}

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.

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?

Fig1.png

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:

Fig2.png

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.

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).

Can someone let me know if I am doing anything wrong, or perhaps take a look into the matter?

0 Kudos
2 Replies
Robert_I_Intel
Employee
421 Views

Jason,

I will take a look at this. First, a couple of clarifying questions:

1. Which processor do you have?

2. Which operating system are you running on?

3. Which graphics driver do you have?

Thanks!

0 Kudos
Jason_L_1
Beginner
421 Views

Robert I. (Intel) wrote:

Jason,

I will take a look at this. First, a couple of clarifying questions:

1. Which processor do you have?

2. Which operating system are you running on?

3. Which graphics driver do you have?

Thanks!

1) Intel Core i7 975

2) Windows 7 x64

3) OpenCL Runtime 15.1 x64 (MSI MD5: d6567a351b2af16bde82ee9e92bc6869)

0 Kudos
Reply