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
Fix space leak in solver backjumping #2916
Conversation
e3cab66
to
c1189c3
Compare
@@ -135,15 +80,12 @@ exploreLog = cata go | |||
-- tree, but rather make assumptions about where that shape originated from. It'd be | |||
-- better if the pruning itself would leave information that we could pick up at this | |||
-- point. |
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.
I'm not sure if this comment still applies to this function after I changed it.
aa8a029
to
e742305
Compare
This commit removes references to the solver log that prevented it from being garbage collected. It also forces evaluation of the current level and variable stack in 'Message.showMessages'.
This commit refactors backjumping so that it uses the 'Progress' type instead of separate references to a node's children and the conflict set calculated from those children.
e742305
to
8923a46
Compare
Since this PR only touches |
@grayjay So far, this is looking good as well. I can confirm/reproduce your profiling results, and performance tests seem to be ok. Also, I don't think merging |
Ok, I'm happy with the code and going to merge this. Quite drastic space wins for more complicated solver tasks on this one, and at least near-constant space behavior of the solver for really long runs now. Really great work. Thanks again. |
@kosmikus Thank you! |
Cherry-picked both this and #2914 into 1.24. |
Thanks! |
@23Skidoo Does this mean that master is once again open for big changes? (Sorry, I haven't had time to follow along too closely with Cabal goings-on.) |
@BardurArantsson In principle, yes, but I've been focusing on PRs that have a chance of being included in 1.24 (given that we have some time until the GHC 8 release). So the 1.24 branch hasn't really diverged from master yet. Right now, the remaining ones are (ordered by priority):
|
Ah, right, so ideally things that cause less distruption should be merged first? I don't think my reworked solver-split changes will necessarily need to be merged to master immediately (but OTOH they should be obvious enough to not cause any breakage). It's just one of those things that probably will cause conflicts for any other solver changes. Anywho, I'll give it a go and we'll see what the damage is :) |
@BardurArantsson fyi, @kosmikus is currently looking at solver issues & PRs (and his time is sadly rather limited)... and right now it's still easy to cherry-pick stuff he lands to master to 1.24... |
@kosmikus tbh, I don't think it's essential getting this refactoring into the 1.24 branch; we're still in the process of merging the
...that being said, since as far as I understand it, the solver split won't touch the Morever, there may very well be an interim 1.26 branch not bundled with any GHC release (like there was the 1.20 branch inbetween GHC 7.8 and GHC 7.10), before a 1.28 branch to go with GHC 8.2 So there's imho no hurry as there's plenty of opportunities to release such a solver package into the open in the forseeable future. And there's still the question of how to version the solver library and how to reconcile this with Git... for instance, having all in a single Git repo will severly limit our options, and effectively force use to develop the solver library in lock-step with cabal-install and resulting in an even more intertwined and confusing history (IMO, Git handles multiple-deliverables-in-a-single-Git-repo very poorly -- having |
The new(TM) solver-split thing doesn't touch Cabal at all (nor did the old one, but...). The first step is simply about adding a type parameter to make it possible to split cabal-install and the modular solver. I'll try to submit a PR later today so we have something concrete to discuss :). EDIT: Sorry, ninja edit:
The idea is to have cabal-solver to be a dependency between Cabal and cabal-install. (At least as a first step. We could consider making it completely independent of Cabal, but I'm not sure there's much value in that.) |
@BardurArantsson that, indeed, sounds rather harmless... looking forward to the patch |
This commit refactors backjumping so that it uses the
Progress
type instead ofseparate references to a node's children and the conflict set calculated from
those children. The behavior should be unchanged.
I added to #2914 so that I could test memory usage more easily. These heap profiles were generated with
cabal --ignore-sandbox install --dry-run --max-backjumps -1 hackage-server-0.4 aeson yesod --with-compiler C:/ghc-7.6.3_64/bin/ghc +RTS -p -s -h -L50
.after #2914 (90c7772):
after both commits (c1189c3):
longer run with both commits, using
-i10
. I don't know why it increases later.I have a few concerns about this PR. I combined backjumping and exploring the tree into one traversal, which is less modular. Is there a way that we could use two passes without storing conflict sets directly on the tree's nodes? The
combine
function is also less recognizable after the refactoring. I'd like to make it clearer, if possible.I deleted several unused functions that didn't compile with my change, such asexplore
. Is that alright, or should I refactor them?