[cfe-dev] OpenCL patch

Alberto Magni alberto.magni86 at gmail.com
Fri Dec 17 09:27:43 PST 2010


Hi everybody,

I saw the Cuda patch submitted by Peter Collingbourne
(already included in the svn) and I would like to propose
an OpenCL patch based on his structure.

The attached patches add the following features:

1) Add ocl_{kernel|constant|global|local|private} attributes
2) Checking the type of kernel function arguments: OpenCL 1.1 standard
    chapter 6.8.k
3) Checking kernel function return value, OpenCL 1.1 chapter 6.8.j

The 004-opecl-test.patch contains relevant test cases.
In order to check the current implementation the opencl.h file has been
included in the test case.
It contains the definition of OpenCL keywords based on ocl_* attributes.

I did so because in don't know where to place these definitions
in InitPreprocessor.cpp. I saw that language dependent macros are defined in
InitializePredefinedMacros, is this the right function to place these
define commands ?

Another problem concerns the OpenCL builtin types (eg intptr_t, uintptr_t, ...).
I mapped these types, using typedefs, __*_TYPE__,
eg  typedef __PTRDIFF_TYPE__ ptrdiff_t;

I think the right way to handle all this preprocessor initializations
is to include an implicit
header file with all the required stuff.

At the moment the provided test cases fails due to the presence of the
aka construct in
the diagnostic messages, it unrolls the typedef showing the canonical
type which depends
on the current architecture.

Reviews and suggestions are greatly appreciated.

Many thanks,

Alberto
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 003-kernel-sema.patch
Type: application/octet-stream
Size: 8436 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101217/ad966c44/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 001-test-environment.patch
Type: application/octet-stream
Size: 860 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101217/ad966c44/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 002-kernel-address-space-attributes.patch
Type: application/octet-stream
Size: 1713 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101217/ad966c44/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 004-opencl-test.patch
Type: application/octet-stream
Size: 1810 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101217/ad966c44/attachment-0003.obj>


More information about the cfe-dev mailing list