-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Faster incremental rebuilds of (user-specific) sysimgs #46045
Conversation
test/chainedsysimage.jl
Outdated
|
||
@test success(`$(Base.julia_cmd()) --sysimage-native-code=chained --startup-file=no --sysimage=$sysimg --output-o chained.o.a -e $source_txt`) | ||
@test success(`ar x chained.o.a`) # Extract new sysimage files | ||
@test success(`ld -shared -o chained.$(Libdl.dlext) text.o data.o text-old.o`) |
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 now have a LLD_jll
that we can add as a stdlib to provide LD.
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.
Yes, I'll update the test to be system independent, but I'd probably need LLVM_full_jll
because of llvm-objcopy
. However, this is only a test, and not a dependency for for building Julia itself.
…ained system image
I'm closing this PR because |
Thanks @petvana for your work and the great discussions this summer about this :) |
This is part of my GSoC'22 project "Automatic system images based on a specific user workflow," under the supervision of @ianatol. The project's main idea is to introduce a new library that would obtain
precompile
statements during regular usage of Julia. Then the system image is customized for a specific user. So, it's crucial to speed up building the system image (sysimage) because it's pretty slow now (empty >2 min). So, this PR rebases #40414 (initially proposed by @Keno) for Julia v1.9-dev. But there are some modifications:precompile
field ofCodeInstance
.precompile & 2
-CodeInstance
is loaded from a current sysimage.precompile & 4
-CodeInstance
should be emitted into the incremental sysimage.precompile & 4
).jl_precompiles_for_sysimage
function is introduced to tag only user-specific precompile statements. Precompiles generated before this function is called will be ignored.CodeInstance
is already in the sysimage. Originally, it was done only by the naming convention. Now, the instance is not included if contained inReverseLocalSymbolTable
checked bylookup_sysimage_fname
, which seems a bit more robust and systematic way to do so.Given these changes, it's unnecessary to emit binary code for all
precompile()
statements defined in loaded libraries, resulting in relatively fast compilation times.In the future, I'll will investigate why there is a greater overhead for
Plots
(not yet clear to me).All times are in seconds, N - normal run, S - using chained sysimage, SysImg - create chained sysimage, load - call
using
, work - time to first work (TTFX). Sources for the comparison are in BenchmarkIncrementalSysimage.There are probably some edge cases, but it seems to work fine for now. In the future, I'd like to try to disable
precompile()
entirely for the included libraries; that would probably save some loading time because the sysimage would contain less inferredCodeInstance
s.This PR also introduces a CI test for building an almost empty sysimage. It seems possible to make the test multi-platform by using
LLVM_full_jll
library that contains all the necessary utils.Solved issues
ld --allow-multiple-definition
is not used). Solved by initializingglobalUniqueGeneratedNames
, see 431b6ba.sys-o.a
(207MB) is not currently shipped with julia, but it can be re-created easily together withsys.so
. This is necessary only once.Known issues (to be solved) / TODOs
Base.compilecache
. Precompilation do not work when building incremental sysimage, so the pakages need to be already precompiled.Open questions and ideas for and improvement