I have a rather simple kernel that I'm having strange issues with type casting uint to ulong inside of a printf with the AMD APP SDK 2.8.1 running on a x86_64 CPU:
__kernel void opencl_hello_world(uint n)
size_t i = get_global_id(0);
size_t j = get_global_id(1);
if (i < n)
printf("OpenCL Hello World: (%lu, %lu) of (%lu, %lu)\n", (ulong) (i + 1), (ulong) (j + 1), (ulong) n, (ulong) 1);
If I set the NDRange offset size = 0, global size = 16, and local size = 16, I get the following output:
OpenCL Hello World: (1, 0) of (1, 0)
OpenCL Hello World: (2, 0) of (1, 0)
OpenCL Hello World: (3, 0) of (1, 0)
OpenCL Hello World: (16, 0) of (1, 0)
It seems that the %lu (64 bit) within the printf is behaving as %u (32 bit).
I was able to run your code..And printed correctly on an internal driver.
What is the driver version you are using?
Also, you have given a 1D kernel in the source code.
However, in the original post, you have mentioend a 2D kernel...
I changed the kernel to be like what you had posted there.
And, it printed correctly (although only 1D kernel is spawned by your code and not 16x16)
So, does this problem occur only with 16x16?
Please send me a repro case, if thats the case.
With the most recent kernel that I attached I get the following output:
OpenCL Hello World: 1 of 0
OpenCL Hello World: 2 of 0
OpenCL Hello World: 3 of 0
OpenCL Hello World: 16 of 0
I'm using Windows 8 64-bit and Visual Studio 2012. I'm getting correct results on my desktop systems with HD 5970 and 7750 GPUs and the most recent non-beta drivers, but observing these incorrect results on my notebook system with an i7-3630QM CPU. Yes, that's unfortunately another vendor's CPU, but it shows up under the AMD platform and the AMD APP SDK FAQ states:
7. What CPUs does the AMD APP SDK v2.8.1 with OpenCL™ 1.2 support work on?
The CPU component of OpenCL™ bundled with the AMD APP SDK works with any x86 CPU with SSE3 or later, as well as SSE2.x or later.
I reproduced the problem here on an intel laptop....
The problem occurs only when you compile the application as "32-bit" on a 64-bit machine.
If you compile as 64-bit -- you wont hit the problem...
Onlt the 32-bit compilation fails....
I am 99% sure that this will fail on AMD CPU as well...
Unfortunately, I dont have time to test this today... I can test this only on coming Wednesday.
but rest assured that this is being tracked...
Hi There! Good Bud Settle!
I was able to reproduce the problem on AMD Athlon CPU as well.
Just a plain run Win7 32-bit application exposes the problem.
I have bundled your repro-case as a Visual Studio Project and have filed a bug report.
We have done our duty.
Let us leave the rest to the AMD engineers,
Thanks for posting here and helping the community,
It is people like you who care to post simple repro-cases, are really helping AMD to improve their drivers.
Thanks for taking time to post one,
I will be checking tomorrow to see if a newer internal driver actually fixes this problem.
If so, you will have a fix coming soon..
If not, you may have to wait some 3 or 4 months...Thats the usual cycle time.. But then, there is no guarantee.