[LLVMdev] [cfe-dev] OpenCL support
David Neto
dneto.llvm at gmail.com
Fri Dec 10 07:57:01 PST 2010
On Wed, Dec 8, 2010 at 9:00 PM, Villmow, Micah <Micah.Villmow at amd.com> wrote:
>> So a kernel function like this:
>>
>> void foo(__global int*A) {
>> __local int vint;
>> __local int *vpint;
>> __local int const *vcpint;
>> __local int volatile vvint;
>> int a = A[0];
>> vint = a;
>> vvint = a;
>> int a2 = vint;
>> int va2 = vvint;
>> barrier(CLK_LOCAL_MEM_FENCE);
>> A[0] = a2 + va2;
>> }
>>
> [Villmow, Micah] This example is incorrect. There is a race condition between the writes to vint and vvint and the reads from vint/vvint.
This is a bit of a side issue for this thread. Yes, I understand the
race conditions, but thank you for being clear.
My point was to show a translation scheme for code, in particular how
storage is allocated, and how reads and writes are handled. The
original code was stupid. The job of the compiler is not to fix the
semantics of the code it is translating, but to faithfully translate
it. :-)
cheers,
david
More information about the llvm-dev
mailing list