-
Notifications
You must be signed in to change notification settings - Fork 21
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
Fix execute ir pointer #856
Conversation
@avik-pal after this bugfix goes in we should probably fix the calling conv of the other ones to be a similar llvmcall |
src/xla/XLA.jl
Outdated
@static if !Sys.isapple() | ||
lljit = Enzyme.LLVM.JuliaOJIT() | ||
jd_main = Enzyme.LLVM.JITDylib(lljit) | ||
|
||
for name in ("XLAExecute", "XLAExecuteSharded", "ifrt_loaded_executable_execute") | ||
ptr = Libdl.dlsym(Reactant_jll.libReactantExtra_handle, name) | ||
Enzyme.LLVM.define( | ||
jd_main, | ||
Enzyme.Compiler.JIT.absolute_symbol_materialization( | ||
Enzyme.LLVM.mangle(lljit, name), ptr | ||
), | ||
) | ||
end | ||
end |
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.
This a better solution than doing RTLD_GLOBAL.
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.
Or use https://github.com/JuliaLLVM/LLVM.jl/blob/8757e8a438bb5a67fb27536923954abb6cae6d55/src/orc.jl#L178C10-L178C55 to make all symbols findable.
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.
You mean that with this we don't actually need JuliaPackaging/Yggdrasil#10706? I'd be happy to revert that change 🙂
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.
No this is still required even with that (from local testing).
Specifically loading a precompiled .so fails with just this and is fixed by the global
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.
I’ll also note here that we don’t use the JIT from llvm.jl. The exclusive purpose of this is such that these symbols are findable from Julia’s JIT
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.
What is the concrete error when loading a plgimage?
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.
Will get when by computer, but cannot find symbol XLAExecuteSharded when loading GordonBell2025/…/.so when doing PRONTOLab/GB-25#31
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.
Note that this code without the global works normally without the precompiled code done in the linked issue
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.
/home/wmoses/git/Enzyme.jl/julia11/julia: symbol lookup error: /home/wmoses/.julia/compiled/v1.11/GordonBell25/qFJ42_9Shjc.so: undefined symbol: XLAExecuteSharded
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Besides x86_64 macOS failures due to #867, all integration tests are failing on Linux (which is affected by making all symbols global): https://github.com/EnzymeAD/Reactant.jl/actions/runs/13740137086/job/38428385024?pr=856. Sounds like we really need a solution to avoid that. |
I have an idea. |
N1 = $(length(libname)+1) | ||
N2 = $(length(fname)+1) |
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.
[JuliaFormatter] reported by reviewdog 🐶
N1 = $(length(libname)+1) | |
N2 = $(length(fname)+1) | |
N1 = $(length(libname) + 1) | |
N2 = $(length(fname) + 1) |
@@ -84,7 +84,7 @@ PythonCall = "0.9" | |||
Random = "1.10" | |||
Random123 = "1.7" | |||
ReactantCore = "0.1.5" | |||
Reactant_jll = "0.0.83" | |||
Reactant_jll = "0.0.84" |
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.
We should probably test with the old version (without rtld_global)
Reactant_jll = "0.0.84" | |
Reactant_jll = "0.0.83" |
On the merge commit of this PR: https://github.com/EnzymeAD/Reactant.jl/actions/runs/13764654846/job/38488238961#step:9:539
I've never seen it before, is that new with this change? |
odd....in any case this is resolved by the other pr (which was just merged), so closing this |
Sorry, I posted in the wrong PR, it was meant to be in #869 (comment) |
No description provided.