[cfe-dev] OpenCL support - using metadata

Benyei, Guy guy.benyei at intel.com
Mon Jan 10 11:07:41 PST 2011

Anton Lokhmotov wrote:
> Given that at least two companies have found metadata useful for
> representing OpenCL C features in LLVM-IR, I think the community needs to
> reconsider the use of metadata, perhaps introducing a 'sticky' variant of
> it?

We at Intel are also using metadata for our implementation. This approach is very useful for a few reasons:
First, when compiling OpenCL C code to llvm, some important information about the kernel arguments is lost. i.e. typedefs are lost, structures are sometimes disassembled. We're adding a string containing the interesting part original function signature. This can also be used for providing data about the kernel arguments, validating the arguments set by the user, etc...
Second, we use a global metadata node, which enumerates all the kernel functions. This can be used to quickly enumerate the kernels in a program, instead of passing the whole module.
Third, for each kernel we hold the kernel attributes in the same metadata: vector type hint, required workgroup size and workgroup size hint.
Last, we also hold in the metadata a list of the local variables defined in that kernel.


[cid:image001.png at 01CBB10A.48487AD0]

Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110110/40218db3/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 35414 bytes
Desc: image001.png
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110110/40218db3/attachment.png>

More information about the cfe-dev mailing list