[LLVMdev] Example for usage of LLVM/Clang/libclc

Ahmed ElTantawy ahmede at ece.ubc.ca
Fri Feb 6 16:05:58 PST 2015


Thanks a lot for both your answers:

@mats:
> Would it not just be a matter of removing
> -Xclang -mlink-bitcode-file -Xclang nvptx--nvidiacl/lib/builtins.opt.bc
> from your command? The seems to be the part that links in builtin
functions..

I can not do this as in the code I am using some of these builtin functions
but not "all" of them. Currently what happens is that all of them get
translated to LLVM-IR, even those I don't use. I can manually include only
those I am interested in for a specific kernel, but that will not be neat
solution.

@Dan:

> Mark all functions apart from the kernel entry points with the internal
attribute and then run global dead code elimination (it should remove most
of the unused functions).
> You can use the opt tool to do this.
> e.g. if you had kernel entry points foo and bar you could run the
following
> $ opt -internalize-public-api-list= foo,bar -globaldce your_program.bc
> transformed_program.bc

That would probably help, but I was aiming for a solution that doesn't
involve knowing the name of kernel entry points, but I can definitely write
a small script that would figure out the kernel entry points for me.



On Thu, Feb 5, 2015 at 6:41 AM, mats petersson <mats at planetcatfish.com>
wrote:

> So, another "department for ignorance and stupid comments" comment:
>
> Would it not just be a matter of removing
> -Xclang -mlink-bitcode-file -Xclang nvptx--nvidiacl/lib/builtins.opt.bc
> from your command? The seems to be the part that links in builtin
> functions..
>
> On 5 February 2015 at 13:50, Dan Liew <dan at su-root.co.uk> wrote:
> > Hi,
> >
> >> which works but it produces LLVM IR code for all OpenCL intrinsics
> >> implemented by libclc along with the kernel I am interested in, is
> their a
> >> possibility to avoid this ? and only produce the llvm code for the
> kernel
> >> required ?
> >
> > Mark all functions apart from the kernel entry points with the
> > internal attribute and then run global dead code elimination (it
> > should remove most of the unused functions).
> >
> > You can use the opt tool to do this.
> >
> > e.g. if you had kernel entry points foo and bar you could run the
> following
> >
> > $ opt -internalize-public-api-list=foo,bar -globaldce your_program.bc
> >> transformed_program.bc
> >
> > Hope that helps.
> > _______________________________________________
> > LLVM Developers mailing list
> > LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150206/f8caf204/attachment.html>


More information about the llvm-dev mailing list