You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am interested in that! But comparing stage0 and stage1 is not much to go on: they differ by whatever has happened since the last snapshot. If you (or someone -- I can try to set up a run if nobody else wants to) bisect from the previous snapshot-registering commit to this point, you should find the culprit.
I bisected down to either of 1daaf78 or 030c666 : the latter won't build and the former is definitely bad. Doesn't matter, they're both the same pull req.
@graydon It seems unlikely that either of those commits could explain all of it, though? I noticed huge slowdowns in, for example, typeck and trans, and those commits only appear to affect lint.
@catamorphism This is about a memory regression, not a speed regression. It only takes one typo to cause a cycle-leak. I'm not certain it's this rev, but it's the one bisect found. As in: the rev before uses 1.8gb to build stage1, this rev uses 2.5gb. I'm not sure what else to say about that; I'll try re-confirming or slicing the history graph differently tomorrow. Gotta do some laundry now.
I'm not aware of this being directly connected to a speed regression. Can you find a pick out a time when the build was fast, for you, so that I can bisect that?
@graydon one thing that would be useful if possible would be differences in the heap graphs over time. If I knew in what stage of the build the memory started deviating largely from what it was before, I could probably see what the problem was.
@alexcrichton massif can produce those graphs. If you like I can make a pair of them tomorrow; if you have it installed locally it will work the same for you or me.
I ran out of time tonight, but I did manage to get one dump of the bad version of the compiler (https://gist.github.com/alexcrichton/5633336). I was having trouble making either heads or tails of the data...
Can you spot the difference? As it turns out, about 700MB was free'd in that drop in the before graph, which is the difference between the before and after. Of this, nearly all of it was from smallintmap::insert during middle::astencode::decode_side_tables. So, from what I can tell, this just means that something which is being decoded isn't being deallocated?
I'm still having trouble understanding how this relates to the lint patch. This definitely didn't touch anything in trans, much less anything in ast encoding/decoding. Any ideas?
So I don't think it's that (curious why the logs differ between runs though -- different ms_print binaries?)
It's very interesting to know we're spending so much on decoded ASTs. We should fix that! 600mb there is absurd enough on its own.
Anyway, the "drop off" you see in the first graph but not the second is supposed to be the place where we drop all pre-LLVM state we can. If you look in the librustc/driver/driver.rs you'll see something like:
The stuff in the block is supposed to get dropped, leaving only llmod and link_meta to pass to LLVM. This is not happening, so the result is we retain it too long.
This is what I expected was happening. As to why, I'd guess we're making a new cycle that keeps everything alive. We don't have a tracing GC at this point (working on it!), so even one bad cycle will keep very large things alive-and-leaked until task death.
I'll keep reading through the code and trying to find such a new cycle, but I'd bet that's what we're seeing. Any further hints from your knowledge of "what the code does" would be appreciated.
Update: talked to @alexcrichton on IRC and it seems likely this is a cycle between the visitors and the lint context. Meanwhile I made a small patch (#6776) that removes the smallintmap pathology in decoding ASTs, saves 400mb.
Activity
graydon commentedon May 21, 2013
I am interested in that! But comparing stage0 and stage1 is not much to go on: they differ by whatever has happened since the last snapshot. If you (or someone -- I can try to set up a run if nobody else wants to) bisect from the previous snapshot-registering commit to this point, you should find the culprit.
bstrie commentedon May 21, 2013
Does this have to do with the fact that stage0 is built with optimizations, but stage1 isn't?
graydon commentedon May 23, 2013
No, both versions are opt.
I bisected down to either of 1daaf78 or 030c666 : the latter won't build and the former is definitely bad. Doesn't matter, they're both the same pull req.
Paging @alexcrichton ?
catamorphism commentedon May 23, 2013
@graydon It seems unlikely that either of those commits could explain all of it, though? I noticed huge slowdowns in, for example, typeck and trans, and those commits only appear to affect lint.
alexcrichton commentedon May 23, 2013
I'd be surprised if either of those were the root cause of this. @catamorphism is right in that those should only affect linting predominately.
I can try to investigate this though to make sure that it's not those commits.
graydon commentedon May 23, 2013
@catamorphism This is about a memory regression, not a speed regression. It only takes one typo to cause a cycle-leak. I'm not certain it's this rev, but it's the one bisect found. As in: the rev before uses 1.8gb to build stage1, this rev uses 2.5gb. I'm not sure what else to say about that; I'll try re-confirming or slicing the history graph differently tomorrow. Gotta do some laundry now.
I'm not aware of this being directly connected to a speed regression. Can you find a pick out a time when the build was fast, for you, so that I can bisect that?
alexcrichton commentedon May 23, 2013
@graydon one thing that would be useful if possible would be differences in the heap graphs over time. If I knew in what stage of the build the memory started deviating largely from what it was before, I could probably see what the problem was.
graydon commentedon May 23, 2013
@alexcrichton massif can produce those graphs. If you like I can make a pair of them tomorrow; if you have it installed locally it will work the same for you or me.
graydon commentedon May 23, 2013
that is,
valgrind --tool=massif <command>followed byms_print massif.out.<pid>alexcrichton commentedon May 23, 2013
I ran out of time tonight, but I did manage to get one dump of the bad version of the compiler (https://gist.github.com/alexcrichton/5633336). I was having trouble making either heads or tails of the data...
jdm commentedon May 23, 2013
From profile 55, which showed 2,283,406,322B of memory usage, we see:
etc. The massif docs have a nice clear explanation of how to read the results. The peak snapshot is usually the most interesting one to analyze.
graydon commentedon May 23, 2013
When reading, it's important to differentiate local and exchange heap allocations. They are separately reported.
alexcrichton commentedon May 23, 2013
OK, so here's the result of some more investigation.
Before this patch: (rev 918bfa7)
After this patch (rev 1daaf78)
Can you spot the difference? As it turns out, about 700MB was free'd in that drop in the before graph, which is the difference between the before and after. Of this, nearly all of it was from
smallintmap::insertduringmiddle::astencode::decode_side_tables. So, from what I can tell, this just means that something which is being decoded isn't being deallocated?I'm still having trouble understanding how this relates to the lint patch. This definitely didn't touch anything in trans, much less anything in ast encoding/decoding. Any ideas?
graydon commentedon May 28, 2013
Looking at your before/after logs, it looks like the sidetable decoding costs are present in both:
pre:
post:
So I don't think it's that (curious why the logs differ between runs though -- different ms_print binaries?)
It's very interesting to know we're spending so much on decoded ASTs. We should fix that! 600mb there is absurd enough on its own.
Anyway, the "drop off" you see in the first graph but not the second is supposed to be the place where we drop all pre-LLVM state we can. If you look in the
librustc/driver/driver.rsyou'll see something like:The stuff in the block is supposed to get dropped, leaving only
llmodandlink_metato pass to LLVM. This is not happening, so the result is we retain it too long.This is what I expected was happening. As to why, I'd guess we're making a new cycle that keeps everything alive. We don't have a tracing GC at this point (working on it!), so even one bad cycle will keep very large things alive-and-leaked until task death.
I'll keep reading through the code and trying to find such a new cycle, but I'd bet that's what we're seeing. Any further hints from your knowledge of "what the code does" would be appreciated.
graydon commentedon May 28, 2013
Update: talked to @alexcrichton on IRC and it seems likely this is a cycle between the visitors and the lint context. Meanwhile I made a small patch (#6776) that removes the smallintmap pathology in decoding ASTs, saves 400mb.
Please keep looking on this one though!
auto merge of #6777 : alexcrichton/rust/less-memory, r=graydon
alexcrichton commentedon May 28, 2013
Just confirmed this after 6264df5. The stage0 peak is around 2.2GB, and the stage1 peak is around 1.5GB
thestinger commentedon May 28, 2013
Yay!
Merge rust-lang#6637