Skip to content

Conversation

timholy
Copy link
Member

@timholy timholy commented Apr 15, 2025

This is needed to eliminate the Core.Compiler.Timings module while still keeping SnoopCompile working.

This is one mechanism to add a backtrace to each entrance to inference. An alternative approach is presented in #58123. Only one of these should be merged.

@vchuravy
Copy link
Member

I have a weak preference for this over option 1.

@timholy
Copy link
Member Author

timholy commented Apr 15, 2025

I like this one better too.

Copy link
Member

@vtjnash vtjnash left a comment

Choose a reason for hiding this comment

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

I am neutral between these PR, as they seem to express entirely different operations (first-dispatch vs first-infer) which may occur at different times in different places. The one thing that must occur before merging though is adding a lock around them (c.f. jl_push_newly_inferred for possible inspiration, as it seems to be fairly common that we need a primitive "locked array push" similar to that)

@timholy timholy force-pushed the teh/snoopinf_backtrace2 branch from d8cd21c to 39d9e56 Compare July 17, 2025 17:13
@timholy timholy added the backport 1.12 Change should be backported to release-1.12 label Jul 17, 2025
@timholy timholy changed the title [RFC] Log a backtrace on entrance to type inference (option 2) Log a backtrace on entrance to type inference Jul 17, 2025
@timholy timholy added this to the 1.12 milestone Jul 17, 2025
@KristofferC KristofferC mentioned this pull request Jul 22, 2025
20 tasks
@timholy timholy requested a review from vtjnash July 29, 2025 08:01
@KristofferC KristofferC mentioned this pull request Aug 6, 2025
38 tasks
@timholy timholy requested a review from vtjnash August 9, 2025 12:58
This is needed to eliminate the `Core.Compiler.Timings` module while
still keeping SnoopCompile working.
@vtjnash
Copy link
Member

vtjnash commented Aug 11, 2025

Can you write a few devdocs on the intended behavior of this, just especially so we can make sure it keeps working with that behavior? Is there a reason it use CI instead of MI? It looks like we could put the calls themselves in C (in jl_type_infer) as well to keep things a bit more self-contained

@timholy timholy force-pushed the teh/snoopinf_backtrace2 branch from 7e5508a to 0da5143 Compare August 11, 2025 20:26
@timholy
Copy link
Member Author

timholy commented Aug 11, 2025

Can you write a few devdocs on the intended behavior of this, just especially so we can make sure it keeps working with that behavior?

Done. The real link is SnoopCompile, specifically JuliaDebug/SnoopCompile.jl#419. SnoopCompileCore is the only place this ccall is used.

I don't know whether you need more detail than I provided. The test should keep things working. I added a comment that indicates the purpose of the test, to prevent someone from concluding that it doesn't seem to be used anywhere and just deleting that test.

Is there a reason it use CI instead of MI?

Not really. I just went with CI since the trend has been to use CI in logs rather than MI. Happy to switch if you'd prefer it.

It looks like we could put the calls themselves in C (in jl_type_infer) as well to keep things a bit more self-contained

I once tried to figure out how to collect the backtrace from C, and that looked a lot harder. If I can get both, then sure, moving it makes sense. But the two have to be linked, so I don't see much advantage in getting one from C and the other from Julia when this already seems pretty non-intrusive to me.

@timholy
Copy link
Member Author

timholy commented Aug 13, 2025

Bump. I'll be on vacation for two weeks starting next week. It would be really nice to get this merged, so we can get rc2 out, so I can start directing users to test timholy/Revise.jl#894

@KristofferC KristofferC mentioned this pull request Aug 19, 2025
27 tasks
@vtjnash vtjnash added broadcast Applying a function over a collection merge me PR is reviewed. Merge when all tests are passing labels Aug 20, 2025
@vtjnash vtjnash force-pushed the teh/snoopinf_backtrace2 branch from a4913ca to 3c3d955 Compare August 20, 2025 15:43
@IanButterworth IanButterworth merged commit fc0017f into master Aug 21, 2025
7 checks passed
@IanButterworth IanButterworth deleted the teh/snoopinf_backtrace2 branch August 21, 2025 07:24
@IanButterworth IanButterworth removed the merge me PR is reviewed. Merge when all tests are passing label Aug 26, 2025
KristofferC pushed a commit that referenced this pull request Sep 1, 2025
KristofferC pushed a commit that referenced this pull request Sep 2, 2025
@KristofferC KristofferC removed the backport 1.12 Change should be backported to release-1.12 label Sep 11, 2025
KristofferC pushed a commit that referenced this pull request Sep 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

broadcast Applying a function over a collection

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants