[LLVMdev] LLVM multithreading

Renato Golin renato.golin at linaro.org
Fri May 30 03:06:58 PDT 2014


On 30 May 2014 10:52, Jasmin Jahic <jasmin.jahic at gmail.com> wrote:
> What I want to know is following: Imagine that I create threads in some way.
> I want threads to execute the same BC, while using the same memory space. I
> know that LLVM IR has a nice structure: Context - Module - Execution engine.
> Is there a way to run several instances of LLVM (using threads for example)
> with the same memory space?

Do you want to write a program to load LLVM libraries, spawn a few
threads and use the LLVM libraries inside each thread? And, if you do,
are you trying to understand where the cut is, regarding shared memory
and thread-local memory, WRT the LLVM API?

IIUC, you should have a separate Module per thread, to be able to
compile/run on each thread. AFAIK, the ExecutionEngine has no concept
of multiple threads, so you would have to use one EE per thread, which
is wasteful. But that was my understanding a few years ago, and it
might have changed.

--renato



More information about the llvm-dev mailing list