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

Alberto Magni alberto.magni86 at gmail.com
Tue Jan 10 11:38:54 PST 2012

Hi Bo,

try the following:

clang -ccc-host-triple ptx32 \
      -Xclang -target-feature -Xclang +ptx23 \
      -Xclang -target-feature -Xclang +sm20 \
      -I$LIBCLC/generic/include -I$LIBCLC/ptx-nvidiacl/include \
      -include $LIBCLC/generic/include/clc/clc.h
-Dcl_clang_storage_class_specifiers \
      -O0 kernels/matrixMul.cl -S -emit-llvm -o matrixMul.ll

where $LIBCLC points to the libclc [1] installation directory.
(This command is a modification of the one by Justin Holewinski you
can find here [2])

I am wondering why the frontend does not lower this piece of
information to the IR-level
when compiling for x86. I think that should be backend's
responsibility to discard the
address space if the target supports only the default one.

Am I missing something ?

[1] http://www.pcc.me.uk/~peter/libclc/
[2] https://jholewinski.org/blog/llvm-3-0-ptx-backend

2012/1/10 Pekka Jääskeläinen <pekka.jaaskelainen at tut.fi>:
> Hello,
> On 01/09/2012 11:18 PM, Bo Wu wrote:
>> Then I changed "__global" to "__local" and generate the IR again, but
>> the generated IR is the same as the first one.
> When compiling for x86(_64) the address spaces to global and local
> probably point to the same target address space (0) so there's no
> difference in the final IR.
>> I am confused because if the "__local" information is lost when
>> generating LLVM IR, how can local memory be used anyway?
> Please check this thread from the last March where the local
> memory implementation is discussed:
> http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-March/013737.html
> Best regards,
> --
> Pekka Jääskeläinen,
> a contributor to the Portable OpenCL (http://launchpad.net/pocl)
> project which uses the Clang's OpenCL C support
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

More information about the cfe-dev mailing list