Results 1 to 4 of 4

Thread: Implementation of OpenCL in clang

  1. #1
    Junior Member
    Join Date
    Feb 2011
    Posts
    2

    Implementation of OpenCL in clang

    is there any implementation for OpenCL, like function qualifiers __kernel and the address space qualifiers (__global, __local, __constant, __private) in LLVM's Clang ?

  2. #2
    Member
    Join Date
    Nov 2009
    Location
    Scotland
    Posts
    72

    Re: Implementation of OpenCL in clang

    As far as I know clang currently does not support OpenCL. There are some efforts of patching clang to support OpenCL that I've heard of, but it's not made it into mainstream clang yet and it seems to go rather slow...
    I'd really like to see clang supporting OpenCL too. I'd be really helpful for my research.

    For now, you can help yourself with a little hack. For example, you can always include a header file that defines the OpenCL keywords, as in
    Code :
    #define __kernel __attribute__((annotate("kernel")))
    #define __global __attribute__((annotate("global")))
    That's what I've done anyway. It's not very elegant but it works for me.

    Cheers
    Dominik

  3. #3
    Junior Member
    Join Date
    Feb 2011
    Posts
    2

    Re: Implementation of OpenCL in clang

    Thanks for the hint, I will use this. Hopefuly in the future an implementation for clang will be available from LLVM developers.

    Have a nice weekend,
    Marius

  4. #4

    Re: Implementation of OpenCL in clang

    Also you might consider the following as a possible alternative for the address spaces
    #define __global __attribute__((address_space(1)))
    #define __local __attribute__((address_space(3)))
    #define __constant __attribute__((address_space(2)))
    #define __private __attribute__((address_space(4)))
    Or some similar numeric bindings

Similar Threads

  1. OpenCL Software implementation.
    By Shadrach in forum OpenCL
    Replies: 1
    Last Post: 06-03-2010, 12:42 PM
  2. OpenCl+llvm+clang
    By bhm in forum OpenCL
    Replies: 1
    Last Post: 12-12-2009, 09:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •