-
Notifications
You must be signed in to change notification settings - Fork 0
gf.c: include const-return methods in --trace-compile
#237
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
Conversation
4533648
to
ba3cfb0
Compare
ba3cfb0
to
fa0f780
Compare
src/gf.c
Outdated
@@ -2420,7 +2426,10 @@ static void record_precompile_statement(jl_method_instance_t *mi, double compila | |||
jl_printf(s_precompile, "#= %6.1f =# ", compilation_time / 1e6); | |||
jl_printf(s_precompile, "precompile("); | |||
jl_static_show(s_precompile, mi->specTypes); | |||
jl_printf(s_precompile, ")\n"); | |||
if (is_const_return_abi) | |||
jl_printf(s_precompile, ") #= const-return =#\n"); |
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 this going to negatively interact with any trace-processing tools we have?
why do we want this in the output?
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.
Great observation. I think I did see some CI errors due to this comment when I had added the TPC-H trace (before I removed that trace from testing). Those should be easily fixable; I'll check.
Upstream, they are (for now) maintaining the idea that compilation traces are human-readable, which is why this is in the output. We could remove it locally if we're okay with diverging.
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.
compilation traces are human-readable, which is why this is in the output
i wonder in what situations seeing the #= const-return =#
comment is helpful?
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.
I think we should be able to handle these trailing comments, but it's definitely a good idea to check 👍
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.
julia> RAI_CompilationsCache.PrecompileStatementParsing.is_precompileable(Base, "#= 1.0 =# precompile(Tuple{typeof(Base.:+), Int, Int}) #= const-return =#")
pr_success::PrecompilationResult = 1
julia> RAI_CompilationsCache.PrecompileStatementParsing.run_precompile(Base, "#= 1.0 =# precompile(Tuple{typeof(Base.:+), Int, Int}) #= const-return =#")
pr_success::PrecompilationResult = 1
We could end up with duplicate traces though -- if on engine 1 we produced
#= 1.0 =# precompile(Tuple{typeof(Base.:+), Int, Int}) #= const-return =#
and on engine 2, which called the function in a different context, we'd get
#= 1.0 =# precompile(Tuple{typeof(Base.:+), Int, Int})
That could cause the precompile to take up 2 spots in the cache, so we probably need to augment the cache to strip any trailing comments.
These are never compiled by LLVM, but we want to log them since they are inferred / compiled by our own compiler.
fa0f780
to
9202e9c
Compare
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.
LGTM
PR Description
This is a quick-fix for an issue where methods that are inferred to return a
Const
do not emit compilation traces. Although they are never compiled by LLVM, we want to log them since they are inferred / compiled by Julia. As with #236, it isn't yet clear what the actual upstream fix will look like on 1.12+.Checklist
Requirements for merging:
--trace-compile
ignores inferred const-return Methods JuliaLang/julia#58482port-to-*
labels that don't apply.