Skip to content

Conversation

@topolarity
Copy link
Member

@topolarity topolarity commented May 13, 2025

I ran into this when inference was trying to compile a signature and then exhausted its recursion heuristic and refused (correctly) to cache the CI, meaning that this codegen edge was not fully resolved (despite being left as an invoke).

A "dynamic invoke" like this can also be an intended result if inference knows what method you're dispatching to (e.g. convert(::Foo, ::Integer)) but the optimizer decides that it wants to specialize this call more aggressively (e.g. convert(::Foo, ::UInt8), convert(::Foo, ::Int8), convert(::Foo, ::UInt16), etc.) when generating machine code.

I think the compiler currently does that rarely in practice (it prefers to not add the edge if it cannot enumerate the code on the other side), but either way, we should highlight this in code_typed

@topolarity topolarity added the backport 1.12 Change should be backported to release-1.12 label May 13, 2025
Sometimes the optimizer leaves a dispatch resolved, but the code was not
available / provided at compile-time.

This requires running the JIT to execute, since it means we left an edge
of the call graph un-resolved. This change highlights this in `code_typed`
to match, e.g., how we handle "dynamic" built-ins.
@topolarity topolarity force-pushed the ct/dynamic-invoke branch from 61a4958 to fbb61b0 Compare May 13, 2025 21:45
@topolarity topolarity added merge me PR is reviewed. Merge when all tests are passing backport 1.12 Change should be backported to release-1.12 and removed backport 1.12 Change should be backported to release-1.12 labels May 15, 2025
@IanButterworth IanButterworth merged commit 43ead47 into JuliaLang:master May 16, 2025
10 checks passed
@topolarity topolarity removed the merge me PR is reviewed. Merge when all tests are passing label May 16, 2025
KristofferC pushed a commit that referenced this pull request May 20, 2025
@KristofferC KristofferC mentioned this pull request May 20, 2025
58 tasks
@KristofferC KristofferC removed the backport 1.12 Change should be backported to release-1.12 label Jun 4, 2025
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.

4 participants