[cfe-dev] linking relocatable device object code with clang

Jonas Hahnfeld via cfe-dev cfe-dev at lists.llvm.org
Thu Jun 28 07:38:19 PDT 2018


On 2018-06-27 00:39, Andrea Bocci wrote:
> Dear clang developers,thanks to the recent work by Alexey Bataev,
> Jonas Hahnfeld, and others, the trunk version of clang includes
> support for compiling device code into relocatable object files.
> 
> These object files can be linked with nvlink (once per GPU
> architecture), combined with fatbin, embedded in a host object file,
> and linked with the other host code by the host linker.
> Usually nvcc can take care of this part - but it refuses to do so for
> unsupported host compilers (gcc 8, clang 6).
> 
> It would be great if support for this "device link" step could be
> added to the clang driver.
> I am interested to work on it myself, but I would need some guidance
> on how to start.

You might want to start looking around in the Driver code, how things 
are done and especially how you invoke external tools.
There is https://reviews.llvm.org/D47394 which does somewhat related 
things for OpenMP, maybe you can reuse some parts once the change lands?

Cheers,
Jonas



More information about the cfe-dev mailing list