[cfe-dev] [LLVMdev] ANN: libclc (OpenCL C library implementation)

Justin Holewinski justin.holewinski at gmail.com
Wed Oct 19 07:09:17 PDT 2011

On Wed, Oct 19, 2011 at 9:47 AM, Peter Collingbourne <peter at pcc.me.uk>wrote:

> Hi,
> This is to announce the availability of libclc, an open source, BSD
> licensed implementation of the library requirements of the OpenCL C
> programming language, as specified by the OpenCL 1.1 Specification.
> libclc is intended to be used with Clang's OpenCL frontend.
> libclc website: http://www.pcc.me.uk/~peter/libclc/
> libclc is designed to be portable and extensible. To this end,
> it provides generic implementations of most library requirements,
> allowing the target to override the generic implementation at the
> granularity of individual functions.
> libclc currently only supports the PTX target, but support for more
> targets is welcome.
> How does this project relate to the recently announced Portable OpenCL
> (POCL) project?  Unlike POCL, this project is not intended to provide
> an OpenCL host library (i.e. the OpenCL Platform Layer and OpenCL
> Runtime specified in sections 4-5 of the OpenCL specification).
> Instead, it provides only the requirements for the OpenCL C
> Programming Language (section 6 et seq).  It is intended to be used
> with an existing host library implementation, and comply with its
> ABI requirements.
> An example of such a host library is NVIDIA's OpenCL host library
> for PTX -- the intention is to at some point provide a mechanism
> for using the NVIDIA implementation of OpenCL with Clang, libclc
> and LLVM's PTX backend instead of NVIDIA's own OpenCL compiler.

This is already semi-functional.  You can compile OpenCL code with
Clang+libclc for ptx32, and load the resulting PTX as an OpenCL binary using
Nvidia's OpenCL platform. :)

> Another example would be POCL's host library, and the POCL developers
> have expressed an interest in using libclc as their OpenCL C library
> instead of developing their own.
> I will hope to find time over the next few weeks to add libclc support
> to the Clang driver.  The intention is that compiling OpenCL C programs
> to PTX would be as easy as (something like this):
> clang -target ptx32 -S file.cl
> such that the driver would automatically locate the libclc headers,
> add them to the include path and pre-include the main header file.
> (The libclc support will of course be optional, and a -cl-stdlib=
> flag will be provided to allow for switching between OpenCL standard
> library implementations.)
> Thanks,
> --
> Peter
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev



Justin Holewinski
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111019/17708e4d/attachment.html>

More information about the cfe-dev mailing list