[cfe-dev] openclc to llvm

ankur deshwal a.s.deshwal at gmail.com
Thu Apr 26 17:37:24 PDT 2012


Hi Jim,

Thanks for reply. int4 is a valid data type of Opencl-C language. I read
that OpenCL support is available in Clang with "-x cl" option.

I also found from some conversation on the llvm mailing group that libclc
is also required for supporting builtin functions for openCL specification.
Is it necessary for parsing the OpenCL introduced data types like int4 too?

Please help me with the issue.

Regards,
Ankur

On Fri, Apr 27, 2012 at 2:06 AM, Jim Grosbach <grosbach at apple.com> wrote:

> Hi Ankur,
>
> "int4" is not a valid C/C++ type on its own. Are you missing a #include
> that typedefs those types, perhaps?
>
> -Jim
>   On Apr 25, 2012, at 5:48 PM, ankur deshwal <a.s.deshwal at gmail.com>
> wrote:
>
>  Hi all,
>
> I am trying to generate an llvm file from opencl kernel. It recognizes
> address space qualifiers for openCL like __global. However I get following
> errors for the types ( int4 etc.. for OpenCL)
>
> -- My Simple Kernel ---
>
>  __kernel void VectorAdd(__global int4 *c, __global int4 *a, __global
> int4 *b){
>     unsigned int idx = get_global_id(0);
>     c[idx] = a[idx] + b[idx];
> }
>
> -- Compilation and errors
>
>   ../build/Debug+Asserts/bin/clang -x cl -emit-llvm -S vectoradd_post.cl-o vectoradd_post.ll
> vectoradd_post.cl:1:34: error: unknown type name 'int4'; did you mean
> 'int'?
> __kernel void VectorAdd(__global int4 *c, __global int4 *a, __global int4
> *b){
>                                  ^
> vectoradd_post.cl:1:52: error: unknown type name 'int4'; did you mean
> 'int'?
> __kernel void VectorAdd(__global int4 *c, __global int4 *a, __global int4
> *b){
>                                                    ^
> vectoradd_post.cl:1:70: error: unknown type name 'int4'; did you mean
> 'int'?
> __kernel void VectorAdd(__global int4 *c, __global int4 *a, __global int4
> *b){
>                                                                      ^
> vectoradd_post.cl:2:24: warning: implicit declaration of function
> 'get_global_id' is invalid in C99 [-Wimplicit-function-declaration]
>     unsigned int idx = get_global_id(0);
>                        ^
> 1 warning and 3 errors generated.
> .
>
> Please let me what am I doing wrong. Also is there any document regarding
> opencl with clang.
>
> Thanks and Regards,
> Ankur
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120427/f2b45dee/attachment.html>


More information about the cfe-dev mailing list