This is an archive of the discontinued LLVM Phabricator instance.

[ORC] LLJIT::Create() proposal: add flag to enable multithreaded codegen
AbandonedPublic

Authored by sgraenitz on Aug 22 2018, 2:04 PM.

Details

Reviewers
lhames
Summary

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.

Diff Detail

Event Timeline

sgraenitz created this revision.Aug 22 2018, 2:04 PM

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()?

Add LLJIT::CreateMultiThreaded() instead.

sgraenitz retitled this revision from [ORC] Lock mutex in IRCompileLayer2::emit() to avoid calling into PassManager::run() in parallel. to [ORC] Add LLJIT::CreateMultiThreaded().Aug 24 2018, 3:55 AM
sgraenitz edited the summary of this revision. (Show Details)
sgraenitz updated this revision to Diff 163357.Aug 30 2018, 9:53 AM

[ORC] LLJIT::Create() proposal: add flag to enable multithreaded codegen

sgraenitz retitled this revision from [ORC] Add LLJIT::CreateMultiThreaded() to [ORC] LLJIT::Create() proposal: add flag to enable multithreaded codegen.Aug 30 2018, 10:03 AM
sgraenitz edited the summary of this revision. (Show Details)

I think the changes in r343122 provide a superset of this functionality, so this can be closed.

lhames added a comment.May 8 2019, 3:48 PM

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.

Herald added a project: Restricted Project. · View Herald TranscriptMay 8 2019, 3:48 PM
sgraenitz abandoned this revision.May 9 2019, 2:31 AM