[cfe-dev] memory annotation treatment in the compilation of OpenCL code

Bo Wu bwu at cs.wm.edu
Mon Jan 9 13:18:33 PST 2012


I'd like to see how clang handles local memory in OpenCL. So I compiled the
following code with "clang -S -emit-llvm -o test.ll -x cl test.cl".

int get_global_id(int index);

/* Test kernel */

__kernel void test(__global float *in, __global float *out) {

        int index = get_global_id(0);

        out[index] = 3.14159f * in[index] + in[index];


Then I changed "__global" to "__local" and generate the IR again, but the
generated IR is the same as the first one.

I am confused because if the "__local" information is lost when generating
LLVM IR, how can local memory be used anyway?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120109/2cd1bcc3/attachment.html>

More information about the cfe-dev mailing list