[cfe-dev] OpenCL/CUDA Interop with PTX Back-End

Speziale Ettore speziale.ettore at gmail.com
Mon Oct 10 02:30:46 PDT 2011


> 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.

I agree.

> 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.

There are no problems on my side, if the quality is high enough for you.
My goal was to generate as fast as possible a minimal library to compile
AMD benchmarks. I wrote the generator and checked it for the functions I
needed -- gentype foo(gentype) -- but I think the code is quite general
to be easely extended.

I attach the following files:

OCLGen.tar.gz: the TableGen backends. There are two backends, one for
generating implemementations, the other for the ocldef.h file. The
backends are built inside my project, but I was not aware of your work
about refactoring TableGen, so I have re-used old TableGen source to
build the OCLGen driver.

GenLib.tar.gz: the .td files used as TableGen inputs. More specifically,
Math.td is a partial definition of OpenCL Math library, OCLDef.td must
includes all library *.td and it is used to generate the ocldef.h
header, and OCLTypes.td should contains OpenCL C type definitions -- now
it includes only types I need -- and generic builtin declarations.

Math.inc: the subset of the math library generated by the backend.

ocldef.h: the header file generated by the backend. In order to avoid
clashes with the standard math library and to avoid major modification
of clang/llvm, I have prefixed all OpenCL builtins with the
__builtin_ocl_ prefix. At the end of the file, I define a macro for each
builtin, allowing to use the undecorated name -- I do not known if this
is the right approach, but it looks working on X86 and X86_64.

> 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.

So, I think I need to update my code. Thank you for the news.

I apologize for the delay -- deadlines,
speziale.ettore at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OCLGen.tar.gz
Type: application/x-compressed-tar
Size: 7840 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111010/b58e294e/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GenLib.tar.gz
Type: application/x-compressed-tar
Size: 1468 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111010/b58e294e/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Math.inc
Type: text/x-csrc
Size: 19169 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111010/b58e294e/attachment.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ocldef.h
Type: text/x-csrc
Size: 6906 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111010/b58e294e/attachment-0001.c>

More information about the cfe-dev mailing list