I have encountered a strange behaviour of APP PRofiler from a developer point of view. I am not sure that this is a bug, maybe it is intended, but it is not really good in some cases.
Here is what happens: I have a kernel which uses global memory (read/write). It reads from buffer does some work and writes the data back to the same buffer. Then another kernel uses its results.
Everything goes fine untill i try to run my program from APP Profiler. Becaue it(APP Profiler) runs internally my kernel several times (i checked it by putting simple print message) - data in global buffer become invalid. Which in turn makes my program to misbehave.
I've rewritten my kernel to instead use 2 buffers (just to workaround this issue) and then it works. But this is not one usually wants to do.
So, the question is: Is there any way to fix it without modifying my program.
profiler make backup of buffers before multiple runs of kernel. it choose according to CL_MEM_WRITE flag when you create buffer. so you must have buffer flaged as read only but you write into that buffer.
Yes i was thinking the same way at the beginning, but my buffer is created as read/write with CL_MEM_READ_WRITE flag.
inside kernel it is declared as : __global uint* buf