OpenCL kernel to bitcode

Hi,

is there any possibility to compile OpenCL kernels into LLVM-bitcode?

Thanx,
Nico

I don't think I ever saw a response to this message. RapidMind reported that they are using OpenCL as well as LLVM but their press release wasn't clear about whether they do this. I'd be interested in hearing from Stefanus or anyone else there about how you use OpenCL and whether it is compiled to LLVM.

--Vikram
Associate Professor, Computer Science
University of Illinois at Urbana-Champaign
http://llvm.org/~vadve

Hi Vikram and Nico,

RapidMind is a user today of LLVM, and potentially in the future of OpenCL. We use LLVM for x86 code generation today, and intend to use OpenCL to access GPU devices in the future once vendor implementations of OpenCL are available.

There are currently no complete available implementations of OpenCL, but that will change soon. It is very likely that some of these implementations will be based on LLVM and related technologies.

OpenCL provides functionality to compile kernels written in OpenCL C (a language derived from C99 used to express computations in OpenCL) to some form of binary code, both at runtime and as a compile time tool. The specification does not say what that binary code should look like. LLVM IR is certainly an option for an OpenCL implementation, but so is native binary code for a specific hardware device, or any other IR or machine code representation. Currently there is no provision of portability of binary code between OpenCL implementations.

LLVM does not currently (to my knowledge) contain any functionality specific to OpenCL, but LLVM and Clang would provide a good starting point for (the language part of) an OpenCL implementation.

I hope that addresses your questions,

Stefanus