<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:΢ÈíÑźÚ
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi Zheng,<div><br><div>You can find some examples in test/CodeGenOpenCL/, but they are not builtin functions.</div><div><br></div><div>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.</div><div><br></div><div>If you want to see some llvm ir of a OpenCL implementation you can try Beignet <a href="http://www.freedesktop.org/wiki/Software/Beignet/">http://www.freedesktop.org/wiki/Software/Beignet/</a> <span style="font-size: 12pt;">on Linux or Intel CodeBuilder on Windows, they both use clang as front-end and can dump llvm ir.</span></div><div><br></div><div>Thanks</div><div>Xiuli<br><br><div><hr id="stopSpelling">Date: Fri, 15 Jan 2016 18:12:00 +0000<br>To: cfe-users@lists.llvm.org<br>Subject: [cfe-users] Emit LLVM IR from OpenCL<br>From: cfe-users@lists.llvm.org<br><br><div dir="ltr">Hi,<div><br></div><div>Could anybody give me an example of emitting LLVM IR from OpenCL code?</div><div><br></div><div>I tried this for the backprop benchmark from the rodinia benchmark suite:</div><div><br></div><div>clang -x cl <a href="http://backprop_kernel.cl" target="_blank">backprop_kernel.cl</a>  -emit-llvm -S -o backprop_kernel.ll</div><div><br></div><div>and the the following warning:</div><div><br clear="all"><div><div>backprop_kernel.cl:24:13: warning: implicit declaration of function 'get_group_id' is invalid in C99 [-Wimplicit-function-declaration]</div><div>   int by = get_group_id(1);</div><div>            ^</div><div>backprop_kernel.cl:25:13: warning: implicit declaration of function 'get_local_id' is invalid in C99 [-Wimplicit-function-declaration]</div><div>   int tx = get_local_id(0);</div><div>            ^</div><div>backprop_kernel.cl:34:3: warning: implicit declaration of function 'barrier' is invalid in C99 [-Wimplicit-function-declaration]</div><div>                barrier(CLK_LOCAL_MEM_FENCE);</div><div>                ^</div><div>3 warnings generated.</div></div><div><br></div><div>Does it seem okay? </div><div><br></div>-- <br><div class="ecxgmail_signature"><div dir="ltr">Cheers,<div>Zheng</div></div></div>
</div></div>
<br>_______________________________________________
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users</div></div></div>                                      </div></body>
</html>