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

inference: Relax constprop recursion detection #40561

Merged
merged 1 commit into from
May 26, 2021

Conversation

aviatesk
Copy link
Member

At the moment, we restrict const prop whenever we see a cycle in
methods being called. However, I think this condition can be relaxed
slightly: In particular, if the type complexity limiting did not
decide to limit the growth of the type in question, I think it
should be fine to constant prop as long as there is no cycle in
method instances (rather than just methods).

Fixes #39915, replaces #39918

Co-Authored-By: Keno Fisher [email protected]

@aviatesk aviatesk requested review from vtjnash and Keno April 22, 2021 04:30
@aviatesk
Copy link
Member Author

@nanosoldier runbenchmarks(ALL, vs=":master")

@aviatesk aviatesk requested a review from JeffBezanson April 22, 2021 08:17
@nanosoldier
Copy link
Collaborator

Something went wrong when running your job:

NanosoldierError: failed to run benchmarks against primary commit: failed process: Process(`sudo /run/media/system/data/nanosoldier/cset/bin/cset shield -e su nanosoldier -- -c /run/media/system/data/nanosoldier/workdir/jl_4m1V7I/benchscript.sh`, ProcessExited(1)) [1]

Logs and partial data can be found here
cc @christopher-dG

@aviatesk
Copy link
Member Author

@nanosoldier runbenchmarks(ALL, vs=":master")

@nanosoldier
Copy link
Collaborator

Something went wrong when running your job:

NanosoldierError: failed to run benchmarks against primary commit: failed process: Process(`sudo /run/media/system/data/nanosoldier/cset/bin/cset shield -e su nanosoldier -- -c /run/media/system/data/nanosoldier/workdir/jl_1E3GxG/benchscript.sh`, ProcessExited(1)) [1]

Logs and partial data can be found here
cc @christopher-dG

aviatesk added a commit to aviatesk/JET.jl that referenced this pull request Apr 27, 2021
@simeonschaub
Copy link
Member

@nanosoldier runbenchmarks(ALL, vs=":master")

@simeonschaub simeonschaub added the compiler:inference Type inference label Apr 27, 2021
@KristofferC
Copy link
Member

@nanosoldier runbenchmarks(ALL, vs=":master")

@nanosoldier
Copy link
Collaborator

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @christopher-dG

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.

Looks like we might need to fix a couple BaseBenchmarks.jl now, but that is a good problem to have 😂. AFAICT, it had no performance impact end-to-end (6h15 total run time sounds about typical currently), though most of that time is GC-scrubbing, so it may not be a useful measure.

aviatesk added a commit to aviatesk/JET.jl that referenced this pull request Apr 27, 2021
aviatesk added a commit to aviatesk/JET.jl that referenced this pull request Apr 27, 2021
@aviatesk
Copy link
Member Author

Yeah I will inspect into those serious regressions.

@aviatesk aviatesk changed the title inference: Relax constprop recursion detection WIP: inference: Relax constprop recursion detection Apr 27, 2021
@aviatesk
Copy link
Member Author

@nanosoldier runbenchmarks(ALL, vs=":master")

@nanosoldier
Copy link
Collaborator

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @christopher-dG

@simeonschaub
Copy link
Member

Can't really reproduce the array regressions locally, so retriggering those again.

@nanosoldier runbenchmarks("array", vs = ":master")

@nanosoldier
Copy link
Collaborator

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @christopher-dG

At the moment, we restrict const prop whenever we see a cycle in
methods being called. However, I think this condition can be relaxed
slightly: In particular, if the type complexity limiting did not
decide to limit the growth of the type in question, I think it
should be fine to constant prop as long as there is no cycle in
*method instances* (rather than just methods).

Fixes JuliaLang#39915, replaces JuliaLang#39918

Co-Authored-By: Keno Fisher <[email protected]>
@aviatesk aviatesk changed the title WIP: inference: Relax constprop recursion detection inference: Relax constprop recursion detection May 6, 2021
@simeonschaub simeonschaub reopened this May 13, 2021
@vtjnash vtjnash added the merge me PR is reviewed. Merge when all tests are passing label May 13, 2021
@vtjnash vtjnash merged commit 20dc9e4 into JuliaLang:master May 26, 2021
@aviatesk aviatesk deleted the fix39915 branch May 26, 2021 22:51
aviatesk added a commit to aviatesk/JET.jl that referenced this pull request May 27, 2021
aviatesk added a commit to aviatesk/JET.jl that referenced this pull request May 27, 2021
@simeonschaub simeonschaub removed the merge me PR is reviewed. Merge when all tests are passing label May 29, 2021
aviatesk added a commit that referenced this pull request May 31, 2021
…_call_method_with_const_args` chain

This PR refactors the `abstract_call_method` -> `abstract_call_method_with_const_args`
chain, and simplifies the signature of `abstract_call_method_with_const_args`:
the newly defined `MethodCallResult` struct wraps a result and context
information of `abstract_method_call`, and is passed and consumed
by the succeeding `abstract_call_method_with_const_args`.

Although our constant-propagation heuristic will be likely to change in
the future (as in #40561) and so the signature of `abstract_call_method_with_const_args`
is very unstable, hopefully this PR makes it a bit more stable.
As an additional benefit, now an external `AbstractInterpreter` can use
the context information of `abstract_method_call` (especially `edge::MethodInstance`)
within `maybe_get_const_prop_profitable`.
vtjnash pushed a commit that referenced this pull request May 31, 2021
…_call_method_with_const_args` chain (#41020)

This PR refactors the `abstract_call_method` -> `abstract_call_method_with_const_args`
chain, and simplifies the signature of `abstract_call_method_with_const_args`:
the newly defined `MethodCallResult` struct wraps a result and context
information of `abstract_method_call`, and is passed and consumed
by the succeeding `abstract_call_method_with_const_args`.

Although our constant-propagation heuristic will be likely to change in
the future (as in #40561) and so the signature of `abstract_call_method_with_const_args`
is very unstable, hopefully this PR makes it a bit more stable.
As an additional benefit, now an external `AbstractInterpreter` can use
the context information of `abstract_method_call` (especially `edge::MethodInstance`)
within `maybe_get_const_prop_profitable`.
shirodkara pushed a commit to shirodkara/julia that referenced this pull request Jun 9, 2021
At the moment, we restrict const prop whenever we see a cycle in
methods being called. However, I think this condition can be relaxed
slightly: In particular, if the type complexity limiting did not
decide to limit the growth of the type in question, I think it
should be fine to constant prop as long as there is no cycle in
*method instances* (rather than just methods).

Fixes JuliaLang#39915, replaces JuliaLang#39918

Co-authored-by: Keno Fisher <[email protected]>
shirodkara pushed a commit to shirodkara/julia that referenced this pull request Jun 9, 2021
…_call_method_with_const_args` chain (JuliaLang#41020)

This PR refactors the `abstract_call_method` -> `abstract_call_method_with_const_args`
chain, and simplifies the signature of `abstract_call_method_with_const_args`:
the newly defined `MethodCallResult` struct wraps a result and context
information of `abstract_method_call`, and is passed and consumed
by the succeeding `abstract_call_method_with_const_args`.

Although our constant-propagation heuristic will be likely to change in
the future (as in JuliaLang#40561) and so the signature of `abstract_call_method_with_const_args`
is very unstable, hopefully this PR makes it a bit more stable.
As an additional benefit, now an external `AbstractInterpreter` can use
the context information of `abstract_method_call` (especially `edge::MethodInstance`)
within `maybe_get_const_prop_profitable`.
johanmon pushed a commit to johanmon/julia that referenced this pull request Jul 5, 2021
At the moment, we restrict const prop whenever we see a cycle in
methods being called. However, I think this condition can be relaxed
slightly: In particular, if the type complexity limiting did not
decide to limit the growth of the type in question, I think it
should be fine to constant prop as long as there is no cycle in
*method instances* (rather than just methods).

Fixes JuliaLang#39915, replaces JuliaLang#39918

Co-authored-by: Keno Fisher <[email protected]>
johanmon pushed a commit to johanmon/julia that referenced this pull request Jul 5, 2021
…_call_method_with_const_args` chain (JuliaLang#41020)

This PR refactors the `abstract_call_method` -> `abstract_call_method_with_const_args`
chain, and simplifies the signature of `abstract_call_method_with_const_args`:
the newly defined `MethodCallResult` struct wraps a result and context
information of `abstract_method_call`, and is passed and consumed
by the succeeding `abstract_call_method_with_const_args`.

Although our constant-propagation heuristic will be likely to change in
the future (as in JuliaLang#40561) and so the signature of `abstract_call_method_with_const_args`
is very unstable, hopefully this PR makes it a bit more stable.
As an additional benefit, now an external `AbstractInterpreter` can use
the context information of `abstract_method_call` (especially `edge::MethodInstance`)
within `maybe_get_const_prop_profitable`.
aviatesk added a commit that referenced this pull request Jul 11, 2022
In a similar spirit to #40561, we can relax the recursion detection to
guarantee `:terminates` effect and allow the effects analysis to not
taint `:terminates` effect when there are no cycles in `MethodInstance`s
in a call graph.

fix #45781
aviatesk added a commit that referenced this pull request Jul 12, 2022
In a similar spirit to #40561, we can relax the recursion detection to
guarantee `:terminates` effect and allow the effects analysis to not
taint `:terminates` effect when there are no cycles in `MethodInstance`s
in a call graph.

fix #45781
aviatesk added a commit that referenced this pull request Jul 20, 2022
In a similar spirit to #40561, we can relax the recursion detection to
guarantee `:terminates` effect and allow the effects analysis to not
taint `:terminates` effect when there are no cycles in `MethodInstance`s
in a call graph.

fix #45781
ffucci pushed a commit to ffucci/julia that referenced this pull request Aug 11, 2022
In a similar spirit to JuliaLang#40561, we can relax the recursion detection to
guarantee `:terminates` effect and allow the effects analysis to not
taint `:terminates` effect when there are no cycles in `MethodInstance`s
in a call graph.

fix JuliaLang#45781
pcjentsch pushed a commit to pcjentsch/julia that referenced this pull request Aug 18, 2022
In a similar spirit to JuliaLang#40561, we can relax the recursion detection to
guarantee `:terminates` effect and allow the effects analysis to not
taint `:terminates` effect when there are no cycles in `MethodInstance`s
in a call graph.

fix JuliaLang#45781
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:inference Type inference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Recursion disables constant propagation
5 participants