Another liveness hack#63
Merged
lthls merged 7 commits intoocaml-flambda:flambda2.0-stablefrom Apr 6, 2020
Merged
Conversation
Author
|
Preliminary results seem to indicate that liveness works fine, but something else allocates a lot and I couldn't get past the OOM killer. I will look further. |
Author
|
So apparently, |
0c7ff2b to
7d47581
Compare
Author
|
Merging for now, as it blocks further testing, but this should still be reviewed |
mshinwell
pushed a commit
that referenced
this pull request
Apr 7, 2020
* Avoid exponential case in liveness * Avoid quadratic cases for free conts * Remove mutable state from spill * Remove leftover debug * Use cache for reload * Remove useless reference in spill * Add cache for spill Co-authored-by: Pierre Chambart <pierre.chambart@ocamlpro.com>
lthls
added a commit
that referenced
this pull request
Sep 29, 2020
* Avoid exponential case in liveness * Avoid quadratic cases for free conts * Remove mutable state from spill * Remove leftover debug * Use cache for reload * Remove useless reference in spill * Add cache for spill Co-authored-by: Pierre Chambart <pierre.chambart@ocamlpro.com>
poechsel
pushed a commit
that referenced
this pull request
Sep 3, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This tries to avoid exponential blow-up in liveness.
The initial idea from @chambart was to notice if we're recomputing the live set of an expression with the same arguments, in which case we can reuse the previous result.
However, there was a bug because the previous result was read from the
livefield of the next instruction, which can contain an initial empty set or the result of a previous run, but doesn't mean it is actually the result of the analysis.In addition, the
envparameter needs to be compared too, and it is not stored anywhere.So I introduced a cache that remembers, for each handler, the last arguments (
envandat_join) and result (before_handler) of the last time we went through it.Of course, this doesn't help much, because the environment will likely be different each time (otherwise we wouldn't get called again), so I cached the restriction of the environment to the free continuations of the handler, which should be safe and still avoid the exponential blow-up.
I haven't run the libbigarray test yet, but will try it and report if it compiles in a reasonable amount of time.