Hey Everyone,

i'm very new in here, either to openCL.

i'm trying to understand, how "does it works" and i'm going through very illogical problems (at the first look)

some - i solved, and i saw, that most common "issue" is the compilator's "attitude", i mean: optimization, which he makes.

for example:
parts of code :

case 1 : int ITER ; declared as an argument to the kernel function, which is set to 1.0e4
case 2 : ITER; declared in macro sent to the program (the same value 1.0e4)

for (int i = 0; i < ITER; ++i) {
// some computations, doesn't matter
}

case 1 : 100FPS
case 2 : 700FPS
Ofc: it doesn't matter how many fps, but how big the different is
all because of the optimization made by compiler
in case 1 he prepare code as there'll be not many loops
in case 2 - he knows the number of loops

second ex:
for (int i = 0; i < ITER; ++i) {
case 1: if (i == ITER) // notice- it'll never happen!
barrier(CLK_LOCAL_MEM_FENCE)
case 2: if (i == ITER)
// some things.. it doesn't matter
}

the result ?
case 1: 200 FPS
case 2: 700 FPS
all because of instuctions which will never be used..

and the question is.. are there any way to "set" compiler exactly how we want to ?
especially the second example.. why does he respond in this way for this instruction?

ps sorry for my english, but i hope, it's able to be read