Hi,
I am trying to build a system image for the (simple) module below:
module TestCatAF
function myfunc(m1, m2)
return cat(m1, m2, dims=(1,2))
end
Base.@ccallable function call_myfunc()::Cdouble
M1 = [1 2; 3 4]
M2 = [5 6; 7 8]
mm=myfunc(M1,M2)
return 2.1
end
if abspath(PROGRAM_FILE) == @__FILE__
println("result is:", call_myfunc())
end
end # module
After creating the binary, I called the call_myfunc
from a C++ code. Running it with the callgrind tool, I was able to see the call stack and, to my surprise, the JIT was called.
In more details, I would expect that if I have a pre-compilation statement then it should be compiled.
Strangely, this is not always true. On the above example, the “cat” call exists on the pre-compilation file:
precompile(Tuple{getfield(Base, Symbol("#cat_t##kw")), NamedTuple{(:dims,), Tuple{Tuple{Int64, Int64}}}, typeof(Base.cat_t), Type{Int64}, Array{Int64, 2}, Vararg{Array{Int64, 2}, N} where N})
precompile(Tuple{getfield(Base, Symbol("##cat_t#110")), Tuple{Int64, Int64}, typeof(Base.cat_t), Type{Int64}, Array{Int64, 2}, Vararg{Array{Int64, 2}, N} where N})
but it cannot be compiled and goes through the JIT (as you can see on the attached picture)
Diving deeper to the “cat” function, it turned out that the input argument is of type “Any”.
below is the output of the @which
Is there a way, to fully compile the “cat” function so that the JIT is not used?
Thanks!