Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upCompilation of a crate using a large static map fails on latest i686-pc-windows-gnu Beta #36799
Comments
sfackler
added
regression-from-stable-to-beta
T-compiler
labels
Sep 28, 2016
urschrei
changed the title
Compilation of a crate using a large static map fails on latest i686 Beta
Compilation of a crate using a large static map fails on latest i686-pc-windows-gnu Beta
Sep 28, 2016
This comment has been minimized.
This comment has been minimized.
|
cc @brson just want to make sure you're aware of this. |
pnkfelix
added
regression-from-stable-to-stable
P-high
and removed
regression-from-stable-to-beta
labels
Sep 29, 2016
This comment has been minimized.
This comment has been minimized.
|
Related to #36926 perhaps? ("1.12.0: High memory usage when linking in release mode with debug info") |
This comment has been minimized.
This comment has been minimized.
|
@urschrei have you tried this on platforms other than windows, out of curiosity? |
This comment has been minimized.
This comment has been minimized.
|
I see. It seems to work on |
This comment has been minimized.
This comment has been minimized.
|
I haven't tried to build i686 on Linux or OSX, but I easily could… |
This comment has been minimized.
This comment has been minimized.
|
Well, I just did a run on my linux box. The memory usage is certainly through the roof: https://gist.github.com/nikomatsakis/ea771dd69f12ebc5d3d5848fa59fb43a This is using nightly ( |
brson
assigned
nikomatsakis
Oct 6, 2016
This comment has been minimized.
This comment has been minimized.
|
So @alexcrichton has executed a massif run: https://gist.github.com/alexcrichton/d20d685dd7475b1801a2ccac6ba15b08
The peak result (measurement 48) looks pretty similar. More memory used by MIR:
These numbers are just based on a kind of quick scan of the gist. |
This comment has been minimized.
This comment has been minimized.
|
It seems clear we need to revisit our handling of statics and constants in a big way. But then this has been clear for a long time. =) I'm wondering if we can find some kind of "quick fix" here. I also haven't compared with historical records -- but most of that memory we see above, we would have been allocating before too, so I'm guessing this is a case of being pushed just over the threshold on i686, versus a sudden spike. |
This comment has been minimized.
This comment has been minimized.
|
Sizes of some types from MIR (gathered from play):
|
This comment has been minimized.
This comment has been minimized.
|
I am feeling torn here. It seems the best we can do short-term is to make some small changes to MIR/HIR and try to bring the peak down below 4GB. The long term fix would be to revisit the overall representation particularly around constants and see what we can do to bring the size down. One thing I was wondering about (which is probably answerable from @alexcrichton's measurements) is what percentage of memory is being used just in the side-tables vs the HIR itself. In any case, it seems like 152 bytes for a mir rvalue is really quite big. |
This comment has been minimized.
This comment has been minimized.
|
Looking again at the massif results, it looks like MIR is taking more memory than I initially thought. One place that seems to use quite a bit is the list of scopes. |
This comment has been minimized.
This comment has been minimized.
|
Better numbers:
|
This comment has been minimized.
This comment has been minimized.
|
Just pinging @nikomatsakis to keep this P-high bug on his radar. |
This comment has been minimized.
This comment has been minimized.
|
I've made basically no progress here, I'm afraid. I think the most likely path forward in short term is to try and reduce memory usage in various data structures. Not very satisfying though. I'm not sure if we can make up the gap that way. |
nikomatsakis
assigned
pnkfelix
and unassigned
nikomatsakis
Oct 20, 2016
This comment has been minimized.
This comment has been minimized.
|
Discussed in compiler meeting. Conclusion: miri would be the proper fix, but maybe we can shrink MIR a bit in the short term, perhaps enough to push us over the edge. I personally probably don't have time for this just now (have some other regr to examine). Hence re-assigning to @pnkfelix -- @arielb1 maybe also interested in doing something? |
This comment has been minimized.
This comment has been minimized.
|
cc @nnethercote in case he might have input on ways to attack this |
This comment has been minimized.
This comment has been minimized.
|
Massif is slow and the output isn't the easy to read, but it's the ideal tool for tackling this. The peak snapshot in @alexcrichton's data is number 48, and I've made a nicer, cut-down version of it here: https://gist.github.com/nnethercote/935db34ff2da854df8a69fa28c978497 You can see that ~30% of the memory usage comes from ExprKind::Tup(ref elts) => {
hir::ExprTup(elts.iter().map(|x| self.lower_expr(x)).collect())
}
|
This comment has been minimized.
This comment has been minimized.
|
The Also, |
This comment has been minimized.
This comment has been minimized.
|
Having a 32-bit MIR "shared object representation" We can then intern |
This comment has been minimized.
This comment has been minimized.
|
actually, all memory usage is accounted for, so I'm sure it's not LLVM. |
arielb1
added a commit
to arielb1/rust
that referenced
this issue
Sep 24, 2017
bors
added a commit
that referenced
this issue
Sep 24, 2017
bors
added a commit
that referenced
this issue
Sep 24, 2017
bors
added a commit
that referenced
this issue
Sep 24, 2017
bors
added a commit
that referenced
this issue
Sep 24, 2017
This comment has been minimized.
This comment has been minimized.
|
@arielb1 Oh right, with one CGU memory usage should be the same unless there's some kind of bug. |
bors
added a commit
that referenced
this issue
Sep 25, 2017
This comment has been minimized.
This comment has been minimized.
|
@petrochenkov's span reform PR had lost us 400MB of space here, which means making this compile is that much harder. Maybe we should just use enough bits for the crate when encoding spans? |
This comment has been minimized.
This comment has been minimized.
|
or use 40 bit spans, which should be enough to handle 64MB crates? |
This comment has been minimized.
This comment has been minimized.
|
@arielb1 I'm not sure I understand: The span PR makes this test case use 400 MB more -- or less? |
This comment has been minimized.
This comment has been minimized.
|
it makes the test case use 400MB more, because the span just overflows the 24-bit length we have. |
This comment has been minimized.
This comment has been minimized.
|
The current peak is during LLVM translation where we are using memory from both MIR and LLVM. I think that after miri lands, we could easily store constants as byte arrays, which should bring this well into the green zone. |
petrochenkov
referenced this issue
Nov 3, 2017
Closed
Simplify Span by explicitly not supporting ctxt #45747
This comment has been minimized.
This comment has been minimized.
|
triage: P-medium It seems like we are going to wait until we can fix this properly. |
rust-highfive
added
P-medium
and removed
P-high
labels
Nov 9, 2017
This comment has been minimized.
This comment has been minimized.
|
miri has landed. I'm not entirely sure how to reproduce this though. |
This comment has been minimized.
This comment has been minimized.
|
Is it on the latest Nightly? If so, I’ll kick off an Appveyor build in a couple of hours.
…--
steph
On 17 Apr 2018, at 15:52, Oliver Schneider ***@***.***> wrote:
miri has landed. I'm not entirely sure how to reproduce this though.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
This comment has been minimized.
This comment has been minimized.
|
jup. it's even in beta (although somewhat broken) |
urschrei
referenced this issue
Apr 17, 2018
Closed
Constant evaluation regression in beta 1.26 #49930
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
we have new nightlies! |
This comment has been minimized.
This comment has been minimized.
|
i686 is failing on ac3c228 (2018-04-18) with exit code: 3221225501: https://ci.appveyor.com/project/urschrei/lonlat-bng/build/job/qaipuqj88243xs4c#L115 (Which is a memory exhaustion error I think?) |
This comment has been minimized.
This comment has been minimized.
|
looks like it. Because the x86_64 |
This comment has been minimized.
This comment has been minimized.
|
@oli-obk Oh, I had no idea – can you point me at some details? |
This comment has been minimized.
This comment has been minimized.
|
You need to install the cross toolchain via rustup and invoke cargo with the target flag for that cross target |
urschrei commentedSep 28, 2016
•
edited
I'm trying to build a
cdylib(https://github.com/urschrei/lonlat_bng) which requires the https://github.com/urschrei/ostn15_phf crate.building on AppVeyor, on
i686-pc-windows-gnu, using the latest beta, is failing with an OOM error:Details
The
ostn15_phfcrate is essentially just a very big static map, built using PHF (the generated, uncompiled map is around 42.9mb)The build passed when running
cargo test, usingrustc 1.12.0-beta.3 (341bfe43c 2016-09-16):https://ci.appveyor.com/project/urschrei/lonlat-bng/build/105/job/3y1llt6luqs3phs3
It's now failing when running
cargo test, usingrustc 1.12.0-beta.6 (d3eb33ef8 2016-09-23):https://ci.appveyor.com/project/urschrei/lonlat-bng/build/job/27pgrkx2cnn2gw50
The failure occurs when compiling
ostn15_phfwithfatal runtime error: out of memory