-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Missing backedges and poor precompilation result #49617
Comments
In JuliaLang/julia#49617 it was found that not all callees have backedges to callers. There is some speculation that rather than adding the backedge to those cases, we may in fact be able to prune the backedge graph more substantially in cases where it may be safe to avoid propagating invalidation. Consequently, to enforce the guarantees made by `@compile_workload`, PrecompileTools should check the inference graph and add tags in cases where a backedge is missing.
The practical consequences for PrecompileTools-managed precompilation will be fixed by JuliaLang/PrecompileTools.jl#15. @vtjnash has suggested that there may be backedges that aren't required for proper invalidation, and that pruning them might be a good thing; if this is one such case, then this issue should be closed. The only real question is whether that's not true, in which case missing backedges open us up to #265 violations. |
In JuliaLang/julia#49617 it was found that not all callees have backedges to callers. There is some speculation that rather than adding the backedge to those cases, we may in fact be able to prune the backedge graph more substantially in cases where it may be safe to avoid propagating invalidation. Consequently, to enforce the guarantees made by `@compile_workload`, PrecompileTools should check the inference graph and add tags in cases where a backedge is missing.
Hopefully fixed since then, so I don't think there is an easy way to check for these |
While analyzing a surprisingly-poor result from adding a precompile workload for Trixi (https://github.com/trixi-framework/TrixiStartup.jl), it became clear that the source of the trouble was missing backedge(s). I don't have a MWE, but installing
[email protected]
and making the following diff to[email protected]
(currentmain
branch):I get
This is on Julia
master
but I get a similar result on Julia 1.9.0-rc3.A bit of explanation about how this works: PrecompileTools turns on "inference snooping" which constructs a tree of the inference spawned by each runtime-dispatched call (the "roots" in PrecompileTools parlance). As you navigate each one of these trees, the children should have a backedge to each parent. The diff above just checks whether that's true.
This ends up affecting Trixi precompilation because we rely on tracing the backedges to find package-owned or explicitly "tagged" (by PrecompileTools) MethodInstances. In this case, an expensive-to-compile Trixi MethodInstance has no backedges to any "root" and thus gets omitted from the cache.
The text was updated successfully, but these errors were encountered: