[LLVMdev] ExecutionEngine and multithreading

Chris Lattner sabre at nondot.org
Mon Apr 14 10:51:27 PDT 2008


On Mon, 14 Apr 2008, brdavs wrote:
> Say I have n different Function objects
> that I want to execute simultaneously on a multicore
> machine. So, one would want to create n different
> instances of ExecutionEngine and run each function.
> But, if I understand correctly, there can only be one
> instance of ExecutionEngine, so there would have to be
> a locking mechanism or execute everything
> sequentially.

Right.

> I have the following questions:
> 1. What's the best way to run many different functions
> in multiple threads using a single ExecutionEngine?

You shouldn't have to do anything special.  It only holds the lock when 
jiting, not when executing the code.

> 2. What's the reason for having only a single engine?

It makes the internal implementation more efficient.

> 3. Are there any plans for the future that might
> allow multiple instances of ExecutionEngine?

no

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list