New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Want JIT support for threaded programs #790
Comments
One of the UIUC researchers was assigned to add threading support to LLVM. I |
Adding this to the LLVM JIT would be really trivial, it's just that noone has Noone has started looking at this, but if you're interested, it would be a -Chris |
I've made a first attempt at adding locking to the JIT. Unfortunately, since I do not really understand the To make sure that I added locks where required, I moved "dangerous" members of the classes into a ExecutionEngine: JIT: Both of these classes have additional members which I have not protected. It looked to my brief ExecutionEngine: JIT: I specifically did not protect the ExecutionEngine::CurMod member because a reference is returned via I've attached my patch against the latest CVS. There is one "trivial" fix which should be committed, even |
Overall, the patch looks very good. Here are a couple of suggestions:
MutexLocker locked(lock); instead of using getPM multiple times.
It seems like pthread_mutexattr_init should be used, or I think your patch is correct. To test it, the first thing you want to do is For the threaded case, it's more difficult. You can try writing programs that If you take care of the above and attach both patches (the trivial stuff and Thanks a lot! -Chris |
Trivial fixes from the thread patch |
ThreadSupport-PThreads.h: Use recursive mutexes |
I have finally ran the test suite, and created an example that actually calls into the JIT from multiple This bug depends on configure and Makefile support to add "-lpthreads" to the linker command line for |
Updated JIT thread support patch http://mail.cs.uiuc.edu/pipermail/llvmdev/2005-April/003809.html |
Makes the JIT thread-safe
I ran the regression tests on Linux and it did not break anything on my |
Let's review this again after 1.5 is released. |
Mine |
I have applied Evan's patch in my own tree and determined that it does not, at Unfortunately, this patch causes lli to require linking with libpthread.a which Anyone want to chime in on this? |
There is no libpthread in VC++. It won't even compile, much less link. Win32 |
My patch doesn't directly depend on libpthread, so it would be very possible to add Win32 support by As for threaded test programs, I have a couple that I used to test the patch myself that I could provide. |
Evan, could you please add your threaded test programs to |
Don't forget to update the release notes:
Thanks! -Chris |
Parallel JIT test I apologize: I'm not working with LLVM at the moment, and I don't really have This test program creates two LLVM functions then calls them from three The three threads are created and then block waiting on a condition variable. This code can be licenced under whatever licence you choose. Technically, it is |
mentioned in issue llvm/llvm-bugzilla-archive#540 |
Extended Description
According to the 1.3 release notes at
"http://llvm.cs.uiuc.edu/releases/1.3/docs/ReleaseNotes.html", LLVM is unable to
run threaded programs:
"
The JIT does not use mutexes to protect its internal data structures. As such,
execution of a threaded program could cause these data structures to be corrupted.
"
It would be nice if it was indeed possible to run threaded programs.
Since this is in the release notes, you're obviously aware of it, but having a
bugzilla for it makes it easier for people to track what's happening with this.
The text was updated successfully, but these errors were encountered: