View Full Version : Implementation of OpenCL in clang
02-02-2011, 02:24 AM
is there any implementation for OpenCL, like function qualifiers __kernel and the address space qualifiers (__global, __local, __constant, __private) in LLVM's Clang ?
02-02-2011, 03:59 AM
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
#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.
02-04-2011, 07:26 AM
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,
02-04-2011, 09:27 AM
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
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.