This is an archive of the discontinued LLVM Phabricator instance.

[ORC] LLJITTest: API test and usage examples with actual codegen
AbandonedPublic

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

Details

Reviewers
lhames
Summary

4 tests to illustrate the LLJIT API in combinations of sequential/concurrent and single/multi dylib.
Requires: https://reviews.llvm.org/D51126

I am using thread-local scope-exit guards to join worker threads back to their correct origins. This works surprisingly well! It's definitely dangerous with long-living threads as resources can get stuck for long. OTOH it's quite simple compared to tracking the instances in containers that require locks etc...

What do you think?

Diff Detail

Event Timeline

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

Use LLJIT::CreateMultiThreaded()

I will do some experiments with LLLazyJIT next.

[ORC] LLJITTest: API test and usage examples with actual codegen

sgraenitz retitled this revision from [ORC] LLJITTest to [ORC] LLJITTest: API test and usage examples with actual codegen.Aug 30 2018, 10:18 AM
sgraenitz edited the summary of this revision. (Show Details)
sgraenitz added a subscriber: friss.
lhames accepted this revision.Aug 30 2018, 2:13 PM

This looks great! Thanks Stefan!

The thread / LLVMContext creation code is awkward, but I think that's because ORC isn't really helping yet. I was thinking I might add an ExecutionSession::createCompileThread(...) utility to spawn a thread, provide a portable id that could be used for registering LLVMContexts, provide portable thread teardown, etc. This seems like a good example to apply the idea to to see if it simplifies things.

This revision is now accepted and ready to land.Aug 30 2018, 2:13 PM

I do not think this landed in the end (it does not look like it). It may be able to be rewritten more naturally now that LLJIT has native support for multiple threads. Also ThreadSafeModule and ThreadSafeContext will help with the context management issues.

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