[LLVMdev] IR code generation and JIT execution in a multithread environment
Graham Wakefield
lists at grahamwakefield.net
Mon Jan 12 13:08:37 PST 2009
Quick related Q:
Does the global lock of the JIT during code generation prevent
concurrent execution of already JIT-ted code?
Thanks.
On Jan 12, 2009, at 9:34 AM, Gordon Henriksen wrote:
> On Jan 12, 2009, at 11:10, Edgar Geisler wrote:
>
>> my goal is to create a service with multiple threads, each of them
>> generating IR code and JIT'ing/executing it in their threads and
>> some threads will share generated code through a code repository...
>
>
> Hi Edgar,
>
> Module and Value are unsafe for concurrent access--even disjoint
> instances thereof. So you'll need to hold a global mutex while
> loading, building, or transforming IR. The JIT can execute threaded
> code, but itself holds a global lock during code generation.
>
> I think serializing code generation in a JIT will usually be adequate,
> since presumably the compiled program (rather than the compiler)
> should dominate runtime. However, if your project truly needs
> concurrent JIT compilation, LLVM doesn't yet meet your needs. Chris
> Lattner has disclosed an open project at Apple for providing
> multithreaded code generation and IR manipulation, but no code has yet
> hit the repository AFAIK.
>
> You could certainly spawn subprocesses to do concurrent static code
> generation, however.
>
> — Gordon
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
More information about the llvm-dev
mailing list