[cfe-dev] [OpenCL] upstreaming khronos OpenCL header files

Anastasia Stulova via cfe-dev cfe-dev at lists.llvm.org
Thu Mar 10 10:56:26 PST 2016

> but it seems PCHs have even larger size by a factor of 10.
To remove any confusion in my previous email, it's actually factor of 2 (not 10!).

From: cfe-dev [mailto:cfe-dev-bounces at lists.llvm.org] On Behalf Of Anastasia Stulova via cfe-dev
Sent: 10 March 2016 18:16
To: Liu, Yaxun (Sam); cfe-dev at lists.llvm.org
Cc: nd; Bader, Alexey (alexey.bader at intel.com); Stellard, Thomas; Sumner, Brian; Pan, Xiuli
Subject: Re: [cfe-dev] [OpenCL] upstreaming khronos OpenCL header files

I see a benefit for the OpenCL users of open source Clang to be able to have the standard includes automatically or at least to have them in the same place as the compiler.

I am not sure if we might have some issue with their size though.

Each header is approximately 1MB large. It might be an issue not just for space but also parsing time. Using PCH would help to reduce compilation time but it seems PCHs have even larger size by a factor of 10.

For example:
  opencl-12.h  -  916K
  opencl-12.h.pch   -  1.9M

It is a bit surprising though since PCHs are stored using compressed bitstream as LLVM's bitcode file format according to the documentation page. Has anyone looked at it before? Size is generally a problem for embedded devices.


From: Liu, Yaxun (Sam) [mailto:Yaxun.Liu at amd.com]
Sent: 09 March 2016 19:29
To: cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>
Cc: Bader, Alexey (alexey.bader at intel.com<mailto:alexey.bader at intel.com>); Sumner, Brian; Stellard, Thomas; Anastasia Stulova; Pan, Xiuli
Subject: RFC: [OpenCL] upstreaming khronos OpenCL header files


OpenCL predefines many overloaded builtin functions ('builtin' in the sense of OpenCL spec) which are not defined in Clang. As such, to compile OpenCL kernels which call OpenCL 'builtin' functions, a header file declaring these functions is needed.

The khronos OpenCL header files can be found at these links:



I am wondering if upstreaming these header files to Clang trunk at clang/lib/Headers would save the OpenCL users the trouble of downloading these header files from different places.

Also with these header files upstreamed, we could make them implicitly included so that users do not need to include them explicitly.

Your feedback is welcome.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160310/c246f8cc/attachment.html>

More information about the cfe-dev mailing list