gchudov

OpenCL compiler glitch?

Discussion created by gchudov on Oct 11, 2010
Latest reply on Oct 11, 2010 by himanshu.gautam
A very simple code produces unexpected results

Kernel which includes this code produces the following output:

k[0] = 3
k[1] = 3
k[2] = 2
k[3] = 2
k[4] = 1
k[5] = 1
k[6] = 1
k[7] = 1
k[8] = 0

Note that k[0] should have been 4.

Platform ID:                                   00000000012B3568
Name:                                          Cedar
Vendor:                                        Advanced Micro Devices, Inc.
Driver version:                                CAL 1.4.739
Profile:                                       FULL_PROFILE
Version:                                       OpenCL 1.1 ATI-Stream-v2.2 (302)

 

int k = 0; for (int sh = 3; sh >= 0; sh --) { if (get_local_id(0) < (1 << sh)) k ++; } if (get_local_id(0) <= 8) printf("k[%d] = %d\n", get_local_id(0), k);

Outcomes