[cfe-dev] OpenCL/CUDA Interop with PTX Back-End
peter at pcc.me.uk
Wed Oct 5 08:42:38 PDT 2011
On Wed, Oct 05, 2011 at 08:28:41AM +0200, Speziale Ettore wrote:
> I can report my experience with my OpenCL runtime. First of all consider
> I'm developing it in spare time.
> > The built-in functions would be declared by a header file that belongs
> > to an OpenCL C runtime library (not to be confused with the OpenCL
> > Platform Layer or OpenCL Runtime defined by sections 4 and 5 of the
> > OpenCL specification). The runtime library in this case would consist
> > of a set of header files and (optionally) a static or shared library
> > file which together implement section 6.11 of the OpenCL specification.
> > The runtime library as a project would be a separate project from Clang
> > (but it may be a potential LLVM sub-project).
> The first observation is that many OpenCL C library functions are
> overloaded for vector types. The semantic of those functions is simply
> to apply the scalar version of the function to all elements of the
> vector. Thus, I described the runtime functions I need through TableGen
> files, then I wrote a couple of TableGen backends. The first generates
> the implementations of vector versions using scalar versions. Scalar
> versions are coded by hand, but now I have only used functions that
> easely map on a mathematic builting (e.g. cos*, sin*, ...). The second
> generates an "ocldef.h" header files, that have been added to clang
> Header lib. That file is automatically included by clang every time it
> compiles OpenCL C sources.
> The runtime will be released as soon as it will reach a minimum level of
> quality. For the clang patches, I can send them to the ML if anyone are
I would be very interested in gaining access to your OpenCL C runtime
library, even if in an incomplete state, since I have also been working
on a runtime library, and it would be best to avoid duplicating effort.
If you like, I can provide assistance with open sourcing it. I can
also ask the LLVM project maintainers if they would be willing to
create a sub-project as I mentioned above.
Coincidentally enough, I have been working on separating the TableGen
parser from its backends. So if your runtime library project were
separated from Clang, it would be relatively trivial to maintain its
TableGen backends in the runtime library tree.
More information about the cfe-dev