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

Ahmed ElTantawy ahmede at ece.ubc.ca
Tue Feb 3 15:35:11 PST 2015


Hi,

My goal is to use Clang/LLVM/libclc to compile an OpenCL kernel and
eventually generate a PTX code. I already did this but I am not sure if the
PTX code I am generating is correct (is the one that is supposed to be
generated).

For example, currently,

In OpenCL : get_global_id(0)   translates to
In LLVM    :  %call = tail call i32 @get_global_id(i32 0)  which translates
to
In PTX:

        // .globl       blur2d
.func  (.param .b32 func_retval0) get_global_id
(
        .param .b32 get_global_id_param_0
)
;

         mov.u32         %r2, 0;
        .param .b32 param0;
        st.param.b32    [param0+0], %r2;
        .param .b32 retval0;
        call.uni (retval0),
        get_global_id,
        (
        param0
        );




Is this what is supposed to happen ? or there is something wrong ?  I am
saying this because the get_global_id implementation does not make much
sense to me and I am not sure if it used the libclc definitions at all ?

If it is not, any idea how the correct conversion will look like ?

Thanks,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150203/60533a21/attachment.html>


More information about the llvm-dev mailing list