In the following minimal example, foo()
isn’t fully precompiled (notice the precompile statement from --trace-compile=stderr
) unless I type annotate the type unstable function from Meshes.jl
(confirmed type unstable with @code_warntype
).
This is a stripped down version of a bigger problem I’m running into. From my understanding though, everything in the precompile workload should get fully compiled (caveat for invalidations, etc., but that shouldn’t be an issue here, I think).
See the precompile output first:
tarnon@dave:~/projects/TestProj$ julia --project=. --trace-compile=stderr -q
julia> using TestProj
[ Info: Precompiling TestProj [36d4f223-0a32-46af-8d45-768600d85ced]
precompile(Tuple{typeof(Core.kwcall), NamedTuple{(:cpu_target,), Tuple{Nothing}}, typeof(Base.julia_cmd)})
precompile(Tuple{Type{NamedTuple{(:stderr, :stdout), T} where T<:Tuple}, Tuple{Base.TTY, Base.TTY}})
precompile(Tuple{typeof(Core.kwcall), NamedTuple{(:stderr, :stdout), Tuple{Base.TTY, Base.TTY}}, typeof(Base.pipeline), Base.Cmd})
precompile(Tuple{typeof(Base._tryrequire_from_serialized), Base.PkgId, String, String})
precompile(Tuple{typeof(Base.first), Array{Any, 1}})
# NOTE: shouldn't foo() be fully precompiled?
julia> foo();
precompile(Tuple{typeof(Base.:(>)), Float64, Int64})
MWE:
module TestProj
using PrecompileTools
using Meshes: area, hull, JarvisMarch, Point2, intersects
export foo
function foo()
shape1 = hull([Point2(rand(2)) for i in 1:10], JarvisMarch())
area(shape1) > 1
end
@compile_workload begin
foo()
end
end
Interestingly, if I type annotate area(shape1)::Float64
, the precompile printout goes away.
Is this a bug, invalidation or cache issue, or am I just not using PrecompileTools correctly?