-
-
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
effects: relax recursion detection for effects analysis #45993
Conversation
@nanosoldier |
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. |
effects = Effects(effects; terminates=ALWAYS_FALSE) | ||
# Some sort of recursion was detected. | ||
if edge !== nothing && !edgelimited && !is_edge_recursed(edge, sv) | ||
# no `MethodInstance` cycles -- don't taint :terminate |
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.
This seems like it may only consider whether there was a cycle that will impact the computation of the result type. If we note that the result is discarded, there won't be an edge
or edgecycle
here at all (note line 512 above).
IIUC, the correct fix for that may be to poison the effects at line 512 however?
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.
If we discard the result, we propagate the unknown effects Effects()
, whose :terminate
effect is also tainted, and it will eventually poison the rest of the call graph.
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.
sgtm
7f70f91
to
703b12c
Compare
* ~~Add (the equivalent of) `@assume_effects :terminates_globally` to `unwrap_composed`. Although it could be inferred as `Const`, without the annotation, it was not elided for too complex inputs, resulting in unnecessary runtime overhead.~~ EDIT: now #45993 is merged and this part isn't included. * Reverse recursion order in `call_composed`. This prevents potentially changing argument types being piped through the recursion, making inference bail out. With the reversed order, only the tuple of remaining functions is changing during recursion and is becoming strictly simpler, letting inference succeed. Co-authored-by: Shuhei Kadowaki <aviatesk@gmail.com>
effects: relax recursion detection for effects analysis
#45993 fixed this bug, let's make the math effect-tests actually fail
effects: relax recursion detection for effects analysis
* ~~Add (the equivalent of) `@assume_effects :terminates_globally` to `unwrap_composed`. Although it could be inferred as `Const`, without the annotation, it was not elided for too complex inputs, resulting in unnecessary runtime overhead.~~ EDIT: now JuliaLang#45993 is merged and this part isn't included. * Reverse recursion order in `call_composed`. This prevents potentially changing argument types being piped through the recursion, making inference bail out. With the reversed order, only the tuple of remaining functions is changing during recursion and is becoming strictly simpler, letting inference succeed. Co-authored-by: Shuhei Kadowaki <aviatesk@gmail.com>
JuliaLang#45993 fixed this bug, let's make the math effect-tests actually fail
* ~~Add (the equivalent of) `@assume_effects :terminates_globally` to `unwrap_composed`. Although it could be inferred as `Const`, without the annotation, it was not elided for too complex inputs, resulting in unnecessary runtime overhead.~~ EDIT: now JuliaLang#45993 is merged and this part isn't included. * Reverse recursion order in `call_composed`. This prevents potentially changing argument types being piped through the recursion, making inference bail out. With the reversed order, only the tuple of remaining functions is changing during recursion and is becoming strictly simpler, letting inference succeed. Co-authored-by: Shuhei Kadowaki <aviatesk@gmail.com>
JuliaLang#45993 fixed this bug, let's make the math effect-tests actually fail
In a similar spirit to #40561, we can relax the recursion detection to
guarantee
:terminates
effect and allow the effects analysis to nottaint
:terminates
effect when there are no cycles inMethodInstance
sin a call graph.
fix #45781