-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Investigate memory usage of compiling the packed_simd crate #57829
Comments
cc @mw @nnethercote |
Looks like nll needs a lot of memory here
|
Coherence checking also takes a good chunk of memory:
although NLL is the first suspect here. I wonder why NLL uses this much memory, |
This one could be closed as duplicate of #57432 I guess. |
EDIT: @mati865 you are right, these are duplicates, I thought that was a different issue that apparently never got filled, so forget this. original comment: @mati865 while they are related, they are two different issues:
|
I did a DHAT run. The "At t-gmax" measurement is the relevant one, it's short for "time of global max". It shows that the interning of constants within
|
Cc @eddyb |
There is an obvious problem:
Fixing this should drastically reduce the memory usage. I tried doing the obvious thing by introducing |
Currently it just unconditionally allocates it in the arena. For a "Clean Check" build of the the `packed-simd` benchmark, this change reduces both the `max-rss` and `faults` counts by 59%; it slightly (~3%) increases the instruction counts but the `wall-time` is unchanged. For the same builds of a few other benchmarks, `max-rss` and `faults` drop by 1--5%, but instruction counts and `wall-time` changes are in the noise. Fixes rust-lang#57432, fixes rust-lang#57829.
FWIW, without the in-flight fix here, a relatively small tweak to I'll test again once the fix for this issue is in nightly. |
This just brought down my whole system -- 16GB of RAM used to be enough to compile two rustc in parallel (with 8 jobs each), but with the current RAM consumption that does not seem to be the case any more. |
Make `intern_lazy_const` actually intern its argument. Currently it just unconditionally allocates it in the arena. For a "Clean Check" build of the the `packed-simd` benchmark, this change reduces both the `max-rss` and `faults` counts by 59%; it slightly (~3%) increases the instruction counts but the `wall-time` is unchanged. For the same builds of a few other benchmarks, `max-rss` and `faults` drop by 1--5%, but instruction counts and `wall-time` changes are in the noise. Fixes #57432, fixes #57829.
Can you try again with today's nightly? |
Much better memory usage now. Thank you! It seems it would be worthwhile to nominate this for uplift to beta, but I'm not permitted to add the tag myself. |
Currently it just unconditionally allocates it in the arena. For a "Clean Check" build of the the `packed-simd` benchmark, this change reduces both the `max-rss` and `faults` counts by 59%; it slightly (~3%) increases the instruction counts but the `wall-time` is unchanged. For the same builds of a few other benchmarks, `max-rss` and `faults` drop by 1--5%, but instruction counts and `wall-time` changes are in the noise. Fixes rust-lang#57432, fixes rust-lang#57829.
Steps to reproduce
packed_simd = '0.3.1'
toCargo.toml
of the new crate.Actual results
While compiling
packed_simd
, rustc takes more than 2 GB of RAM.Expected results
Lesser RAM usage.
Additional info
Maybe it's just the nature of
packed_simd
that it takes a lot of RAM to compile, and there's no bug. However, if RAM usage reached 3 GB in the future, the crate would become unbuildable on 32-bit systems. It might be worthwhile to investigate if buildingpacked_simd
has to take this much RAM or if there is an opportunity to use less RAM without adversely affecting compilation speed on systems that have plenty of RAM.The text was updated successfully, but these errors were encountered: