-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Initial implementation of lazy JLLs for LinearAlgebra #57719
Conversation
This alters CompilerSupportLibraries_jll, OpenBLAS_jll and libblastrampoline_jll to use `LazyLibrary` objects and thereby be loaded only upon first `dlopen()` or `ccall()` to the individual library objects. Note that this is one of the more complicated cases, as `libblastrampoline` must have OpenBLAS_jll added as a dynamic dependency (as it does not actually have it listed in its shared object headers) and also has some on-load callbacks that must be invoked. This must be paired with the appropriate base Julia changes [0]. [0] JuliaLang/julia#57719
85eb73d
to
d537c45
Compare
This alters CompilerSupportLibraries_jll, OpenBLAS_jll and libblastrampoline_jll to use `LazyLibrary` objects and thereby be loaded only upon first `dlopen()` or `ccall()` to the individual library objects. Note that this is one of the more complicated cases, as `libblastrampoline` must have OpenBLAS_jll added as a dynamic dependency (as it does not actually have it listed in its shared object headers) and also has some on-load callbacks that must be invoked. This must be paired with the appropriate base Julia changes [0]. [0] JuliaLang/julia#57719
d537c45
to
b43712b
Compare
b43712b
to
3db34a3
Compare
d21736d
to
24bdde7
Compare
This is working locally now, I can confirm that Note that this is attempting to conform to the What this means is that for any realistic workload where there are JLLs that depend on LBT/OpenBLAS, everything is going to get eagerly loaded upon loading of that JLL anyway, until those JLLs are built to use |
The |
I've converted this to draft because I realized that while "real" JLLs that use |
This alters CompilerSupportLibraries_jll, OpenBLAS_jll and libblastrampoline_jll to use `LazyLibrary` objects and thereby be loaded only upon first `dlopen()` or `ccall()` to the individual library objects. Note that this is one of the more complicated cases, as `libblastrampoline` must have OpenBLAS_jll added as a dynamic dependency (as it does not actually have it listed in its shared object headers) and also has some on-load callbacks that must be invoked. This must be paired with the appropriate base Julia changes [0]. [0] JuliaLang/julia#57719
b85e778
to
6109346
Compare
It's also worth noting that once we land this PR, |
94382bd
to
afc71c7
Compare
I think you might need a rebase for the diff --git i/base/libdl.jl w/base/libdl.jl
index 77f608e77e..d94a2fd0e2 100644
--- i/base/libdl.jl
+++ w/base/libdl.jl
@@ -333,7 +333,7 @@ struct LazyLibraryPath
pieces::Tuple{Vararg{Any}}
LazyLibraryPath(pieces...) = new(pieces)
end
-Base.string(llp::LazyLibraryPath) = joinpath(String[string(p) for p in llp.pieces])
+@inline Base.string(llp::LazyLibraryPath) = joinpath(String[string(p) for p in llp.pieces])
Base.cconvert(::Type{Cstring}, llp::LazyLibraryPath) = Base.cconvert(Cstring, string(llp))
# Define `print` so that we can wrap this in a `LazyString`
Base.print(io::IO, llp::LazyLibraryPath) = print(io, string(llp)) The robust solution to this will require a callable of some kind, but for now massaging is required to make sure that the components of the |
7dcb242
to
b4cc2f8
Compare
This alters CompilerSupportLibraries_jll, OpenBLAS_jll and libblastrampoline_jll to use `LazyLibrary` objects and thereby be loaded only upon first `dlopen()` or `ccall()` to the individual library objects. Note that this is one of the more complicated cases, as `libblastrampoline` must have OpenBLAS_jll added as a dynamic dependency (as it does not actually have it listed in its shared object headers) and also has some on-load callbacks that must be invoked. This must be paired with the appropriate base Julia changes [0]. [0] JuliaLang/julia#57719
44bd276
to
41e8fb4
Compare
3433d57
to
f77f026
Compare
This alters CompilerSupportLibraries_jll, OpenBLAS_jll and libblastrampoline_jll to use `LazyLibrary` objects and thereby be loaded only upon first `dlopen()` or `ccall()` to the individual library objects. Note that this is one of the more complicated cases, as `libblastrampoline` must have OpenBLAS_jll added as a dynamic dependency (as it does not actually have it listed in its shared object headers) and also has some on-load callbacks that must be invoked. This must be paired with the appropriate base Julia changes [0]. [0] JuliaLang/julia#57719
This alters CompilerSupportLibraries_jll, OpenBLAS_jll and libblastrampoline_jll to use `LazyLibrary` objects and thereby be loaded only upon first `dlopen()` or `ccall()` to the individual library objects. Note that this is one of the more complicated cases, as `libblastrampoline` must have OpenBLAS_jll added as a dynamic dependency (as it does not actually have it listed in its shared object headers) and also has some on-load callbacks that must be invoked. Long-term, I would like to replace the bespoke JLLs here with actual JLL source code, and vendor a version of `LazyJLLWrappers` in-tree to do the actual code generation even for Base. That is left as future work. This must be paired with the appropriate `LinearAlgebra.jl` changes [0]. [0] JuliaLang/LinearAlgebra.jl#1235
This makes more sense, reduces work, and avoids that perennial thorn in my side, that in-tree builds store libraries in `${prefix}/lib`, whereas installed builds store libraries in `${prefix}/lib/julia`. Co-authored-by: Cody Tapscott <[email protected]>
We can no longer depend on the fact that these libraries will be eagerly loaded (huzzah!) so we must teach these helper functions to either inspect the lazy CSL JLL for the necessary information, or just directly load the library.
This includes the changes needed for lazy LinearAlgebra JLLs.
f77f026
to
f38a3b9
Compare
Tests passed, so I merged the |
Your job submission was not accepted: invalid argument to |
@nanosoldier |
It looks like this might have broken a test on FreeBSD: https://buildkite.com/julialang/julia-master/builds/45925#0195a580-58c7-45e6-a297-b1adcc81d8b6/770-1576 The commits just prior this on |
Fix in #57811 |
The package evaluation job you requested has completed - possible new issues were detected. Report summary❗ Packages that crashed1 packages crashed only on the current version.
4 packages crashed on the previous version too. ✖ Packages that failed31 packages failed only on the current version.
1518 packages failed on the previous version too. ✔ Packages that passed tests21 packages passed tests only on the current version.
5084 packages passed tests on the previous version too. ~ Packages that at least loaded7 packages successfully loaded only on the current version.
2817 packages successfully loaded on the previous version too. ➖ Packages that were skipped altogether1 packages were skipped only on the current version.
909 packages were skipped on the previous version too. |
Some of the PkgEval failures (thankfully, not many!) look relevant, such as FastPolynomialRoots.jl and StateSpaceLearning.jl:
|
Looks like the common theme is that the JLL's involved are so old (≥5 years) that they predate JLLWrappers |
const LIBPATH = Ref("") | ||
const LIBPATH_list = String[] |
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 it intentional that this dropped PATH_list
?
Some very old JLL's (e.g. NL2sol_jll
) fail now with:
ERROR: LoadError: InitError: UndefVarError: `PATH_list` not defined in `CompilerSupportLibraries_jll`
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.
That's not good, that's documented: https://docs.binarybuilder.org/stable/jll/#The-wrappers
Just a note that between this PR and the previous one 57752, the size of Julia windows installation folder jumped from 1.1G to 1.5G. |
I removed the backport here because this is very much like a feature and feature freeze was many months ago. |
Any idea which files / folders experienced the difference? |
This alters CompilerSupportLibraries_jll, OpenBLAS_jll and
libblastrampoline_jll to use
LazyLibrary
objects and thereby be loadedonly upon first
dlopen()
orccall()
to the individual libraryobjects. Note that this is one of the more complicated cases, as
libblastrampoline
must have OpenBLAS_jll added as a dynamic dependency(as it does not actually have it listed in its shared object headers)
and also has some on-load callbacks that must be invoked.
Long-term, I would like to replace the bespoke JLLs here with actual JLL
source code, and vendor a version of
LazyJLLWrappers
in-tree to do theactual code generation even for Base. That is left as future work.
[0] JuliaLang/LinearAlgebra.jl#1235