Pass a CompileFtorFactory to the LLJIT ctor. Depending on the Multithreaded parameter, this either produces a SimpleCompiler or a MultithreadedCompiler functor. Adjusted the implementation of LLLazyJIT::Create(), but did not yet add the flag there as it's used in lli.
Details
Diff Detail
- Repository
- rL LLVM
- Build Status
Buildable 22102 Build 22102: arc lint + arc unit
Event Timeline
Hi Stefan,
We actually want the compiler call to be able to proceed on multiple threads concurrently. I think we need a documentation fix here: It just isn't safe to use SimpleCompiler when you're running on multiple threads. You need to use MultiThreadedSimpleCompiler (also in include/llvm/ExecutionEngine/Orc/CompileUtils.h) instead.
Maybe it would be safer to name the multi-threaded variant "SimpleCompiler", and rename the current SimpleCompiler to SingleThreadedSimpleCompiler.
Cheers,
Lang.
Ok, now I see the note on the SimpleCompiler class. I didn't consider that, because I didn't touch the Compile functor in IRCompileLayer2. It is the default in the LLJIT ctor.
Maybe LLJIT::Create() could have an option for it or an alternative like CreateMultiThreaded()?
I think the changes in r343122 provide a superset of this functionality, so this can be closed.
I suggest we close this: The code is stale now, though the idea could be applied (and would be a neater fit) in the new LLJITBuilder utility.