-
Notifications
You must be signed in to change notification settings - Fork 318
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
Add ORC-MCJIT replacement binding #245
Conversation
Codecov Report
@@ Coverage Diff @@
## master #245 +/- ##
==========================================
+ Coverage 91.87% 91.91% +0.03%
==========================================
Files 33 33
Lines 4728 4774 +46
Branches 330 332 +2
==========================================
+ Hits 4344 4388 +44
- Misses 308 309 +1
- Partials 76 77 +1 Continue to review full report at Codecov.
|
Does this mean we'll need to write our own MCJIT replacement with the ORC API that is actually thread-safe? |
Yes. I think there are two potential approaches:
|
Do we benefit from the lazy compilation, since we are already deferring our call to LLVM to the first function call anyway? If no benefit, then option 1 seems to make the most sense. |
And I assume that option 1 means Numba (or llvmlite?) will still need to enforce locking at the Python level to prevent concurrent compilation. |
The current numba setup won't benefit from lazy compilation. I prefer option 1 and hope that it actually fixes the issue. Option 1 will be exactly like what MCJIT is doing---eager compilation all the time. Numba already has the concurrent compilation lock. |
def test_object_cache_getbuffer(self): # overrides | ||
# The ORC JIT needs a different test because it will fail at the | ||
# second phase if loading function "sum" in a module without one. | ||
# Instead, we will supply another "sum" implementation and make sure it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow. Is that a documented difference in LLVM? A bug?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the behavior in the MCJIT-version documented?
It seems OrcJIT is stricter here. Due to its laziness, Orc first tries to find a IR module that has the symbol. Once found, it checks if it is already compiled and do its thing. If not found, it stops and return NULL.
What's the status of this? AFAIK ORC supports eager compilation via the basic |
@abebeos OrcMCJITReplacement was intended as an OrcV1 drop-in replacement for MCJIT. has been deprecated for a while and was removed with the rest of OrcV1 in LLVM 12. I think this PR can be closed. |
sure |
Adds binding to OrcMCJITReplacement.
Progress:
Note:
The Orc-MCJIT is not a direct replacement for MCJIT for all cases. When testing in numba, the lazy compilation in Orc-MCJIT seems to be non-threadsafe and it is failing any parallel execution of the same function. (See related LLVM issue https://bugs.llvm.org//show_bug.cgi?id=5184). In Orc-MCJIT, it seems the lazy compilation cannot be turned off.