[cfe-dev] Question on Clang OpenCL to SPIR Compilation

Andrew Gozillon via cfe-dev cfe-dev at lists.llvm.org
Wed Mar 8 09:07:08 PST 2017


Hi guys,


I've been trying to get Clang 5.0 to compile a very simple OpenCL kernel example to SPIR (1.2) so that I can run it through another program that basically loads the SPIR binary and executes it.


However I've been having some issues in that the program loads up the binary fine and executes it getting the wrong result. Now I don't believe this is an issue with the program that loads the binary or the OpenCL kernel itself for a couple of reasons 1) Is that I can compile the OpenCL kernel to SPIR using the Intel Offline Compiler and the Khronos SPIR compiler (based off of Clang/LLVM 3.3) and the returned SPIR binary will run through the program and output as expected and 2) I can just run the OpenCL code through it and output the compiled binary and then run that binary back through and get the correct results.



So at the moment I'm unsure if this is to do with the compile command I'm giving to Clang is slightly off or if the output llvm from Clang 5.0 no longer supports SPIR 1.0/1.2 (although the Clang 5 documentation leads me to believe it does still support it)?


The compiler command I'm feeding to Clang at the moment is:

clang -cc1 -isystem $LIBCLC/generic/include -include clc/clc.h -Dcl_clang_storage_class_specifiers -triple spir64-unknown-unknown -x cl -cl-std=CL1.2 -emit-llvm -o $NAME.ll $NAME.cl

Although I've tried a number of variations from the documentation with no luck.


Thank you very much for your time, and help with this matter.


Best Regards,

Andrew Gozillon


Please consider the environment and think before you print.

The University of the West of Scotland is a registered Scottish charity. Charity number SC002520.

This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender.

Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the University of the West of Scotland.

As a public body, the University of the West of Scotland may be required to make available emails as well as other written forms of information as a result of a request made under the Freedom of Information (Scotland) Act 2002.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170308/b49e4ce8/attachment.html>


More information about the cfe-dev mailing list