[LLVMdev] [PROPOSAL] LLVM multi-module support

Tobias Grosser tobias at grosser.es
Sun Jul 29 12:23:04 PDT 2012


On 07/26/2012 04:12 PM, Dmitry N. Mikushin wrote:
> In our project we combine regular binary code and LLVM IR code for
> kernels, embedded as a special data symbol of ELF object. The LLVM IR
> for kernel existing at compile-time is preliminary, and may be optimized
> further during runtime (pointers analysis, polly, etc.). During
> application startup, runtime system builds an index of all kernels
> sources embedded into the executable. Host and kernel code interact by
> means of special "launch" call, which does not only
> optimize&compile&execute the kernel, but first makes an estimation if it
> is worth to, or better to fall back to host code equivalent.
>
> Proposal made by Tobias is very elegant, but it seems to be addressing
> the case when host and sub-architectures' code exist in the same time.
> May I kindly point out that to our experience the really efficient
> deeply specialized sub-architectures code may simply not exist at
> compile time, while the generic baseline host code always can.

Hi Dimitry,

the proposal did not mean to say that all code needs to be optimized and 
target code generate at compile time. You may very well retain some 
kernels as LLVM-IR code and pass this code to your runtime system 
(similar how CUDA or OpenCL currently accept kernel code).

Btw, one question I always wanted to ask: What is the benefit of having 
the kernel embedded as data symbol in the ELF object, in contrast to 
having it as a global variable (which is then passed to the run-time). I 
know cell used mainly elf symbols, but e.g. OpenCL reads kernels by 
passing a pointer to the kernel string to the run-time library. Can you 
point out the difference to me?

Cheers and thanks
Tobi



More information about the llvm-dev mailing list