PDA

View Full Version : OpenCl+llvm+clang



bhm
12-12-2009, 01:39 AM
Hello

I'm trying to wrap my head around all of this and all I read is only getting me more and more confused. Comprehensive information about OpenCl and compilation of its code is rather endangered species( common for new relatively new technology I guess).

Is there any way of compiling OpenCl code with the use of llvm+clang? After all it is used by Apple/Nvidia/RapidMind for their implementations of OpenCL.
Do I really need driver for OpenCL provided by Nvidia to make use of OpenCL?
Second question comes from actual hardware I right now poses. It's 7 series which is not obviously "CUDA-enabled" thus not supported by OpenCL driver from Nvidia.

Thank is advance for shedding any light on those questions
Cheers.

On another note. This is rather different story, but comes to my mind. Ignore it if it there's too weak connection with questions above.
According to GPU Gems, series of n40 GPUs are actually programmable in GPGPU context ( via HSLS AFAIR right). How does this comply in the light of OpenCL?

dbs2
12-12-2009, 09:26 AM
If llvm+clang support the opencl dialect of C then you should be able to compile them. However, to actually use these kernels you will need support for the built-in functions (such as get_global_id(); which implies a runtime) and all the math functions (and there are a lot of them). With llvm+clang supporting most if not all of opencl today, the hard part for implementing OpenCL is really the math libraries and interacting with the GPUs themselves. The former is hard to get right, and very hard to make fast, while the latter is exceedingly difficult to do without vendor support.

As to your question about older GPUs, the real limiting factor is what the hardware supports. OpenCL puts no limitation on program length, pointer indirection, or control flow, so if those are not supported to arbitrary degrees by the hardware, it will never be CL compatible.