[LLVMdev] [PATCH][RFC] Add llvm.codegen Intrinsic To Support Embedded LLVM IR Code Generation

Tobias Grosser tobias at grosser.es
Mon May 7 01:15:29 PDT 2012


On 05/01/2012 11:21 PM, dag at cray.com wrote:
> Justin Holewinski<justin.holewinski at gmail.com>  writes:
>
>>      For something like PTX, runtime calls take care of the call semantics so
>>      it is either up to the user or the frontend to set up the runtime calls
>>      correctly.  We don't need to completely solve this problem.  Yet.  :)
>>
>> But there has to be some interface that allows an LLVM IR function
>> from one architecture to get at the code or name of a function from
>> another architecture.  This could be handled in the front-end, but it
>> seems like we could design some abstraction.
>
> Doesn't LLVM support taking the address of a function in another address
> space?  If not it probably should.

Hi Dave,

I highly appreciate your idea of integrating heterogeneous computing 
features directly into LLVM-IR. I believe this can be a way worth going, 
but I doubt now is the right moment for it. I don't share your opinion 
that it is easy to move LLVM-IR in this direction, but I rather believe 
that this is an engineering project that will take several months of 
full time work. Possibly not the implementation itself, but designing 
it, discussing it, implementing it and ensuring that the new feature 
does not increase run-time and memory footprint or reduce 
maintainability of LLVM. Due to the large amount of changes that would 
be needed all over LLVM, I really think we should first get some 
experience in this area, before we burn this feature into LLVM-IR.

The llvm.codegen intrinsic seems the perfect match to build up such 
experience. It requires no changes to LLVM-IR itself and only very local 
changes to the generic back end infrastructure. It may possibly not be 
as generic as other solutions, but it is far from being an ugly hack. 
Quite in contrast, it is a close match for OpenCL like run times and 
works well with the existing PTX back end.

Do you have definitiv plans to add heterogeneous computing capabilities 
to LLVM-IR within the next couple (3-4) months? Will these capabilities 
superseed the llvm codegen intrinsic?

In case such plans do not exist, what do you think about adding the 
llvm.codegen() intrinsic for now? If mid-term plans exist for 
heterogeneous extensions to LLVM-IR, we can document them along the 
intrinsic.

Cheers
Tobi



More information about the llvm-dev mailing list