[cfe-dev] openclc to llvm

Lei Mou lunarrocks at gmail.com
Fri Apr 27 08:19:15 PDT 2012


Hi Peter,

On Fri, Apr 27, 2012 at 7:36 PM, Peter Collingbourne <peter at pcc.me.uk>wrote:

> On Fri, Apr 27, 2012 at 11:37:13AM +0800, Lei Mou wrote:
> > Hi Ankur,
> >
> > Yes, you need the support of libclc in order to successfully compile
> OpenCL
> > kernels. It is available at http://libclc.llvm.org/. After building
> libclc,
> > you can use the script "compile-test.sh" to compile OpenCL kernels. For
> me,
> > the compile-test.sh has a little problem (due to the option -Xclang
> > ptx32--nvidiacl/lib/builtins.bc), so I just removed the option, and the
>
> What problem?  Did you follow the instructions in README.TXT to build
> the builtins.bc file?


Thank you for your attention. I did follow the instructions in README.txt.
I got a lot of errors and warnings like the following one:

ptx32--nvidiacl/lib/builtins.bc:299:196: warning: null character ignored
2�>���M 0 !����<� �D��#>R��� hS � �>b� ODH>�#��;<F PT�5ن �T��4��#��!
!��p@�H}�e�Q ��#� �D��#>���c� HE\��� $ !���-$ �,>�#� �,>�# �T��4�d���
�8
���A8��T>��#un� �


                                           ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2900 warnings and 20 errors generated.

I don't know what's the problem, so I just removed the option from the
script.


> > resulting script looks like this:
> >
> > clang -ccc-host-triple ptx32--nvidiacl -Iptx-nvidiacl/include
> > -Igeneric/include -include clc/clc.h -target-feature -Xclang +ptx23
> -Xclang
> > -target-feature -Xclang +sm20 -Dcl_clang_storage_class_specifiers -S
> > -emit-llvm "$@"
> >
> > Using the modified script, OpenCL kernels can be successfully compiled
> into
> > PTX codes.
>
> But most of the builtin functions won't work.
>

I only tried a few kernels, including VectorAdd and Matrix Vector
Multiplication in the Nvidia OpenCL SDK. For the kernel mentioned in
Ankur's mail, it works as expected.
Please let me know how can the problem be solved. Thank you very much!


>
> Thanks,
> --
> Peter
>

Regards,
Lei Mou
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120427/67056854/attachment.html>


More information about the cfe-dev mailing list