#pragma unroll 1

I have working opencl program. can anyone explain me why I’m getting different output when I add #pragma unroll 1 before a for loop? is this a bug?

It depends what is inside your loop - there could be race conditions or other undefined behaviour which changes the output depending on whether the loop was unrolled or not. If you post some code we may be able to help.

unsigned long w[16];
unsigned long k[16];
unsigned long a;
unsigned long b;
unsigned long c;
unsigned long d;
unsigned long e;
unsigned long f;
unsigned long g;
unsigned long h;
unsigned long t1,t2;


for (int i = 0; i < 16; i++) {
t1 = k[i] + w[i] + h + Sigma1(e) + Ch(e, f, g);
t2 = Maj(a, b, c) + Sigma0(a);

	h = g;
	g = f;
	f = e;
	e = d + t1;
	d = c;
	c = b;
	b = a;
	a = t1 + t2;

where sigma, maj, chr defines operations on these (only values passed by arguments) values like adding, bit shifting, etc.