Skip to content
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

Support for multithreading #28

Open
TheDan64 opened this issue Nov 2, 2017 · 7 comments
Open

Support for multithreading #28

TheDan64 opened this issue Nov 2, 2017 · 7 comments
Labels
enhancement requires triage Currently assigned milestone may change pending additional research wishlist
Milestone

Comments

@TheDan64
Copy link
Owner

TheDan64 commented Nov 2, 2017

IIRC LLVM supports multithreading. We should support this at some point, if possible. It will likely have it's own set of obstacles. Any Rc types will likely need to be changed to Arc and our existing memory model may or may not need to be further reworked. This is for the far future, so I am marking it as v0.3.0 for now.

@TheDan64 TheDan64 added this to the 0.3.0 milestone Nov 2, 2017
@TheDan64 TheDan64 added the requires triage Currently assigned milestone may change pending additional research label May 9, 2018
@novacrazy
Copy link

What's the current plan for this?

@TheDan64
Copy link
Owner Author

There are currently no plans to support multithreaded LLVM. It's still something that we should explore in the future, but single-threaded LLVM is proving to be difficult and time consuming enough as it is to get right

@novacrazy
Copy link

Do you have any rough idea as to how you would go about it? I'm working on a language right now and may be able to help if there is time.

@TheDan64
Copy link
Owner Author

No clue. I think the first step is information. I have no idea what LLVM's multithreading mode does concretely. Does Context suddenly become Sync? (Ie is it being locked by a mutex or something?). Furthermore, it's not clear how we would toggle this functionality. LLVM does provide a runtime check to see if multithreaded is enabled, but we would likely need this information at compile time to mark the type as Sync...

@JCapucho
Copy link

It seems that it is a compile time gate in llvm https://llvm.org/doxygen/group__LLVMCCoreThreading.html

@haochending
Copy link

Is there a work-around at the moment to reuse the jit compiled function from a different thread?

@TheDan64
Copy link
Owner Author

TheDan64 commented Mar 23, 2021

I don't believe that is thread-safe to do. The functions are raw memory locations, not contained by any sort of locking mechanism

Edit: It appears EE has its own lock

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement requires triage Currently assigned milestone may change pending additional research wishlist
Projects
None yet
Development

No branches or pull requests

4 participants