[cfe-users] Emit LLVM IR from OpenCL

PanXiuli via cfe-users cfe-users at lists.llvm.org
Sat Jan 16 07:08:54 PST 2016


Hi Zheng,
You can find some examples in test/CodeGenOpenCL/, but they are not builtin functions.
The warning is because these buitin functions need implementation for the target device, so it is normal that these builtin functions does not have declarations of definitions in clang.
If you want to see some llvm ir of a OpenCL implementation you can try Beignet http://www.freedesktop.org/wiki/Software/Beignet/ on Linux or Intel CodeBuilder on Windows, they both use clang as front-end and can dump llvm ir.
ThanksXiuli

Date: Fri, 15 Jan 2016 18:12:00 +0000
To: cfe-users at lists.llvm.org
Subject: [cfe-users] Emit LLVM IR from OpenCL
From: cfe-users at lists.llvm.org

Hi,
Could anybody give me an example of emitting LLVM IR from OpenCL code?
I tried this for the backprop benchmark from the rodinia benchmark suite:
clang -x cl backprop_kernel.cl  -emit-llvm -S -o backprop_kernel.ll
and the the following warning:backprop_kernel.cl:24:13: warning: implicit declaration of function 'get_group_id' is invalid in C99 [-Wimplicit-function-declaration]   int by = get_group_id(1);            ^backprop_kernel.cl:25:13: warning: implicit declaration of function 'get_local_id' is invalid in C99 [-Wimplicit-function-declaration]   int tx = get_local_id(0);            ^backprop_kernel.cl:34:3: warning: implicit declaration of function 'barrier' is invalid in C99 [-Wimplicit-function-declaration]                barrier(CLK_LOCAL_MEM_FENCE);                ^3 warnings generated.
Does it seem okay? 
-- 
Cheers,Zheng


_______________________________________________
cfe-users mailing list
cfe-users at lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20160116/caccc3ca/attachment.html>


More information about the cfe-users mailing list