-
-
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
precompile
fails to cache code for calls that are not fully specialized (non-concrete signature)
#46778
Labels
compiler:precompilation
Precompilation of modules
Comments
What happens if you explicitly add |
That doesn't seem to change anything (running with julia> precompile(Tuple{typeof(Serialization.deserialize), Base.GenericIOBuffer{Array{UInt8, 1}}})
precompile(Tuple{typeof(Serialization.deserialize), Base.GenericIOBuffer{Array{UInt8, 1}}})
true
julia> precompile(Tuple{typeof(Serialization.deserialize), Serialization.Serializer{Base.GenericIOBuffer{Array{UInt8, 1}}}, DataType})
false
julia> @time deserialize(io);
precompile(Tuple{typeof(Serialization.deserialize), Serialization.Serializer{Base.GenericIOBuffer{Array{UInt8, 1}}}, DataType})
0.013337 seconds (15.33 k allocations: 1011.251 KiB, 98.18% compilation time) You can see, the |
JeffBezanson
added a commit
that referenced
this issue
Oct 20, 2022
JeffBezanson
added a commit
that referenced
this issue
Oct 21, 2022
JeffBezanson
added a commit
that referenced
this issue
Oct 21, 2022
JeffBezanson
added a commit
that referenced
this issue
Nov 11, 2022
JeffBezanson
added a commit
that referenced
this issue
Nov 16, 2022
KristofferC
pushed a commit
that referenced
this issue
Nov 17, 2022
KristofferC
pushed a commit
that referenced
this issue
Nov 17, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In #46690, I want to deserialize an object on a precompile worker and it is quite important that this is fully precompiled since a lot of precompile workers are spawned and each of these have a separate process and thus they would all need to compile the same code over and over if this isn't the case.
For arbitrary data types,
deserialize
has a function that takes::DataType
and will not get specialized:julia/stdlib/Serialization/src/Serialization.jl
Line 1468 in aae8c48
As an example workload we can look at the following code
Running that with
--trace-compile=stderr
the following precompile statements are emitted from thedeserialize
call:However, restarting Julia and executing these before the
deserialize
call we can see that theprecompile
call for theDataType
fails:and the compilation time is still there.
However, if we specialize the function on the data type (as done in 6e0b2da#diff-0fbb91f060d958d93fcf0a101ade4d87b365f3664a409276c591d7faf77acb67) the precompilation statements we get is:
the compilation time is then removed:
It would be good if the code that is compiled for signatures that are non-concrete could be cached. They clearly are when you run the code since you don't have to compile it for every call.
The text was updated successfully, but these errors were encountered: