[cfe-dev] Proposal: CUDA support; outline, initial patches

Peter Collingbourne peter at pcc.me.uk
Mon Nov 22 17:51:27 PST 2010


On Mon, Nov 22, 2010 at 11:05:49PM +0200, Török Edwin wrote:
> On Sun, 21 Nov 2010 14:23:44 +0000
> Owen Shepherd <owen.shepherd at e43.eu> wrote:
> 
> > On 21 Nov 2010, at 11:28, C. Bergström wrote:
> > > OvermindDL1 wrote:
> > >> Why not OpenCL as more people can actually run it and on far more
> > >> devices?
> > >> 
> > > If you have to ask then you're likely out of touch with GPGPU usage 
> > > trends....  (Basically there's a lot more people using CUDA and a
> > > lot more CUDA code out there..)
> > 
> > But this raises an interesting question: If we can build an AST from
> > CUDA source, is there any reason we cannot build OpenCL code from
> > that?
> 
> If it is possible to do that then it could also help port projects from
> CUDA to OpenCL (assuming the output is human readable).

This is more difficult than it sounds.  For one thing, CUDA is based
on C++ while OpenCL on C.  We may be able to do something with (a
modified version of?) the C backend, though it wouldn't be very human
readable, and we'd be restricted in the CUDA we can accept.

A better approach IMHO would be to add more LLVM backends for GPU
targets.  If we had an AMDIL backend that would be great.

> But in either case, you may want to make sure that the LLVM IR you are
> generating from CUDA code, will be compatible with what Mesa's clover
> will eventually generate, or can use.

We'll need to introduce a number of target-specific parameters for CUDA.
It will be a matter for Mesa to tune those parameters for their needs.

Thanks,
-- 
Peter



More information about the cfe-dev mailing list