Skip to content
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

Adapt SnoopPrecompile & snoopi_deep to work for new julia API. #313

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

vilterp
Copy link

@vilterp vilterp commented Nov 22, 2022

Starting in JuliaLang/julia#47615, we are changing the API for snoopi_deep, to allow for thread safe snooping in one thread while compiling in another.

This commit changes SnoopPrecompile to work with the new API if it's available.

Starting in JuliaLang/julia#47615, we are
changing the API for snoopi_deep, to allow for thread safe snooping
in one thread while compiling in another.

This commit changes SnoopPrecompile to work with the new API if it's
available.

Co-Authored-By: Pete Vilter <[email protected]>
@NHDaly NHDaly force-pushed the nhd-pv-SnoopPrecompile-new-jl-api branch from d40b6eb to 40a9f6c Compare November 22, 2022 01:08
@codecov
Copy link

codecov bot commented Nov 22, 2022

Codecov Report

Base: 83.56% // Head: 83.22% // Decreases project coverage by -0.33% ⚠️

Coverage data is based on head (c0908c1) compared to base (4e00e22).
Patch coverage: 65.38% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #313      +/-   ##
==========================================
- Coverage   83.56%   83.22%   -0.34%     
==========================================
  Files          17       17              
  Lines        2178     2188      +10     
==========================================
+ Hits         1820     1821       +1     
- Misses        358      367       +9     
Impacted Files Coverage Δ
SnoopCompileCore/src/snoopi_deep.jl 86.20% <50.00%> (-13.80%) ⬇️
SnoopPrecompile/src/SnoopPrecompile.jl 91.17% <90.00%> (-2.58%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Create a dummy ROOT node, and return the tree with that node.
Comment on lines +84 to +91
function finish_snoopi_deep()
# Construct a dummy Timing for ROOT(), for backwards compatibility with the old API.
root = Timing(
InferenceFrameInfo(ROOTmi, 0x0, Any[], Any[Core.Const(ROOT)], 1),
0x0)
root.children = Core.Compiler.Timings.clear_and_fetch_timings()

return InferenceTimingNode(root)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@timholy: In JuliaLang/julia#47615, we changed the API to return a vector of inference trees, rather than a single inference tree with the dummy "ROOT" node.

We think this is a more sensical API, since there really wasn't a single tree of type inference, there were many, and it also made it easier to get the thread safety correct.

However, of course this breaks the old API. So for now, I'm proposing we just do this, and shove it back into a dummy ROOT node to make a single tree 😅

Then we can investigate changes to the API in the future if we want to clean things up to all operate on vectors of trees, or just leave it like this forever. :)

Does that sound good to you?

Copy link
Collaborator

@NHDaly NHDaly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this LGTM. 👍 The tests pass on our local branch of JuliaLang/julia#47615, and on a release build, so I think this is good to go.

Thanks @vilterp. 👍

@NHDaly
Copy link
Collaborator

NHDaly commented Dec 30, 2022

There are some other test failures here, but they seem very much unrelated. If anyone (@timholy?) can comment on it, that'd be appreciated, otherwise I plan to merge this PR next week. :)

@NHDaly NHDaly changed the title Adapt SnoopPrecompile to work for new julia API. Adapt SnoopPrecompile & snoopi_deep to work for new julia API. Dec 30, 2022
@timholy
Copy link
Owner

timholy commented Jul 10, 2023

I'd certain approve merging this if it's needed for Julia 1.10! Sorry for my lack of response.

@timholy
Copy link
Owner

timholy commented Apr 16, 2024

This will need to be updated for SnoopCompile 3, if it's still relevant. See #382 and especially #384.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants