-
Notifications
You must be signed in to change notification settings - Fork 41
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
add option to print inlining costs #160
Conversation
This allows printing inlining costs alongside optimized IR similar to `Base.print_statement_costs`, which I found useful for debugging why some functions are not inlined. They are highlighted green, because I found them hard to distinguish otherwise, but I am open to suggestions regarding formatting. This relies on JuliaLang/julia#41257, which I hope can be backported to 1.7, so we don't have to worry about compatibility.
Codecov Report
@@ Coverage Diff @@
## master #160 +/- ##
==========================================
- Coverage 44.61% 44.40% -0.21%
==========================================
Files 7 7
Lines 901 912 +11
==========================================
+ Hits 402 405 +3
- Misses 499 507 +8
Continue to review full report at Codecov.
|
This makes a minor changes to the README: - removes the part about accepting nominations (no time left...) - expands the installation documentation - proposes that we split the SnoopCompile part into "pre-Cthulhu" and "post-Cthulhu" This also adds a couple more packages (JET, SnoopCompile) and adds [compat] for long-term compatibility. There does not seem to be a suitable Cthulhu release; either we'll need to make a branch or we can get a release out before Saturday. I favor the latter, if possible. JuliaDebug/Cthulhu.jl#160 looks delicious and would be nice to merge if it wouldn't jeopardize the existing functionality.
* Update the README and add [compat] This makes a minor changes to the README: - removes the part about accepting nominations (no time left...) - expands the installation documentation - proposes that we split the SnoopCompile part into "pre-Cthulhu" and "post-Cthulhu" This also adds a couple more packages (JET, SnoopCompile) and adds [compat] for long-term compatibility. There does not seem to be a suitable Cthulhu release; either we'll need to make a branch or we can get a release out before Saturday. I favor the latter, if possible. JuliaDebug/Cthulhu.jl#160 looks delicious and would be nice to merge if it wouldn't jeopardize the existing functionality. * update Manifest to julia 1.7
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.
Nice feature !
end | ||
println(io) | ||
|
||
if src isa IRCode && inline_cost |
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 can just allow the inlining cost printing for unoptimized source as well ?
if src isa IRCode && inline_cost | |
if inline_cost |
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 did actually experiment with that, but the issue is that any call that isn't an intrinsic is assumed to be a dynamic call, so it's probably more misleading than useful. I wonder whether we can get the recursive total costs after inlining for each call from the AbstractInterpreter, but that is probably a separate PR.
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.
Ah, I see.
For now maybe it'd be more kind if we print some warning message like:
elseif toggle === :optimize
optimize ⊻= true
if !is_cached(mi)
@warn "can't switch to post-optimization state, since this inference frame isn't cached"
optimize ⊻= true
end
continue
elseif toggle === :debuginfo
debuginfo = DebugInfo((Int(debuginfo) + 1) % 3)
elseif toggle === :inline_cost
if !optimize
@warn "enable optimization to see the inlining costs"
end
inline_cost ⊻= true
?
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.
Yeah, that sounds reasonable. Do you just want to push that to this branch?
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.
Okay, I will push the change and merge this.
This allows printing inlining costs alongside optimized IR similar to
Base.print_statement_costs
, which I found useful for debugging whysome functions are not inlined. They are highlighted green, because I
found them hard to distinguish otherwise, but I am open to suggestions
regarding formatting. This relies on JuliaLang/julia#41257, which I hope
can be backported to 1.7, so we don't have to worry about compatibility.