Skip to content

Validate miri against the HIR const evaluator - #45002

Merged
bors merged 1591 commits into
rust-lang:masterfrom
oli-obk:miri
Dec 14, 2017
Merged

Validate miri against the HIR const evaluator#45002
bors merged 1591 commits into
rust-lang:masterfrom
oli-obk:miri

Conversation

@oli-obk

@oli-obkoli-obk commented Oct 3, 2017

Copy link
Copy Markdown
Contributor

r? @eddyb

cc @alexcrichton@arielb1@RalfJung

The interesting parts are the last few functions in librustc_const_eval/eval.rs

  • We warn if miri produces an error while HIR const eval does not.
  • We warn if miri produces a value that does not match the value produced by HIR const eval
  • if miri succeeds and HIR const eval fails, nothing is emitted, but we still return the HIR error
  • if both error, nothing is emitted and the HIR const eval error is returned

So there are no actual changes, except that miri is forced to produce the same values as the old const eval.

  • This does not touch the const evaluator in trans at all. That will come in a future PR.
  • This does not cause any code to compile that didn't compile before. That will also come in the future

It would be great if someone could start a crater run if travis passes

oli-obkand others added 30 commits July 31, 2017 12:41
make force_allocation handle packed ByValPair
previously miri had a check for const fn and other cases that
CTFE requires. Instead the function call is completely
processed inside the machine. This allows CTFE to have full
control over what is called and miri to not have useless
CTFE-checks in normal mode.
Split up miri into the librustc_mir and bin parts
@oli-obk

Copy link
Copy Markdown
ContributorAuthor

At this point I don't know where the increase in size is coming from. Miri is adding nothing measurable to librustc and like 2MB to librustc_mir. I don't see how the other crates' size increases can come from miri.

It's a 23MB increase, which still is 12%. All I can think of now is that it severly degraded the zippability of the crates, because the unzipped crates seem to not have increased by that much.

@kennytm

kennytm commented Dec 14, 2017

Copy link
Copy Markdown
Member

@oli-obk

zippability of the crates

Since the tarballs are actually uploaded we could download them and check locally.
Before (8954b16)After (a9b425b)
Download URL(URL)(URL)
File size194,457,881223,798,237
After gunzip664,856,576804,350,976

It doesn't look like related to zippability, but an actual increase in binary size.


Edit:

Comparing top largest files in the tarball (sorted by "after"):
FileBeforeAfter
rls-preview/bin/rls18,232,37697,001,776
cargo/bin/cargo17,335,55257,398,408
rustc/lib/librustc_llvm-*.so56,813,28056,813,112
rust-std-*/lib/rustlib/*/lib/librustc_llvm-*.so56,813,28056,813,112
rust-std-*/lib/rustlib/*/lib/librustc_asan-*.rlib26,420,55826,420,544
rustc/lib/librustc-*.so23,119,92823,468,920
rust-std-*/lib/rustlib/*/lib/librustc-*.so23,119,92823,468,920
rust-std-*/lib/rustlib/*/lib/libcore-*.rlib18,266,45618,267,880
rust-std-*/lib/rustlib/*/lib/librustc_tsan-*.rlib17,178,77217,178,750
rust-std-*/lib/rustlib/*/lib/libstd-*.rlib16,608,60216,626,360
rustfmt-preview/bin/rustfmt3,257,87216,353,720

Why did RLS and Cargo becomes so much larger? They contribute almost all of the size increase.

@oli-obk

oli-obk commented Dec 14, 2017

Copy link
Copy Markdown
ContributorAuthor
folderbeforeafter
rustfmt-preview9.023.0
cargo17.651.8
rls-preview18.384.9
rust-docs149.6149.6
rustc171.6159.6
rust-std303.1299.4

soo... uhm... I've been looking at the wrong thing the entire time

@eddyb

Copy link
Copy Markdown
Contributor

Did we change the situations in which we generate MIR for libraries, or the MIR itself? Are we compiling some new dependencies as rlibs and thus duplicating them in the binaries somehow?

Comment threadsrc/bootstrap/builder.rs Outdated
if let Some(target_linker) = self.build.linker(target) {
cargo.env("RUSTC_TARGET_LINKER", target_linker);
}
cargo.env("RUSTC_DEBUGINFO", self.config.rust_debuginfo.to_string())

@oli-obkoli-obkDec 14, 2017

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

found the issue (I think)

@kennytm

kennytm commented Dec 14, 2017

Copy link
Copy Markdown
Member
Specifically checking the size increase of RLS:
BeforeAfter
URL(URL)(URL)
Size4,641,99214,975,372
After unxz18,311,68097,080,832
rls-preview/bin/rls binary size18,232,37697,001,776
Comparing the sections with `llvm-readelf -sections rls-preview/bin/rls`:

screenshot_2017-12-14 22 36 36_hxwuye-fs8

It's definitely the debug symbols. All the extra size is occupied by debug symbols.

@oli-obk

oli-obk commented Dec 14, 2017

Copy link
Copy Markdown
ContributorAuthor

While it's not fun to debug the tools without debug info, I can just activate it when needed. (confirmed locally that the binary size of the tools is back to what it's supposed to be)

Launching miri

3...
2...
1...
@bors r=eddyb

@bors

bors commented Dec 14, 2017

Copy link
Copy Markdown
Collaborator

📌 Commit 7a2bff7 has been approved by eddyb

@bors

bors commented Dec 14, 2017

Copy link
Copy Markdown
Collaborator

💡 This pull request was already approved, no need to approve it again.

@bors

bors commented Dec 14, 2017

Copy link
Copy Markdown
Collaborator

📌 Commit 7a2bff7 has been approved by eddyb

@kennytmkennytm added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 14, 2017
@bors

bors commented Dec 14, 2017

Copy link
Copy Markdown
Collaborator

💡 This pull request was already approved, no need to approve it again.

@bors

bors commented Dec 14, 2017

Copy link
Copy Markdown
Collaborator

📌 Commit 7a2bff7 has been approved by eddyb

@bors

bors commented Dec 14, 2017

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 7a2bff7 with merge 2974104...

bors added a commit that referenced this pull request Dec 14, 2017
Validate miri against the HIR const evaluator
r? @eddyb
cc @alexcrichton@arielb1@RalfJung
The interesting parts are the last few functions in `librustc_const_eval/eval.rs`
* We warn if miri produces an error while HIR const eval does not.
* We warn if miri produces a value that does not match the value produced by HIR const eval
* if miri succeeds and HIR const eval fails, nothing is emitted, but we still return the HIR error
* if both error, nothing is emitted and the HIR const eval error is returned
So there are no actual changes, except that miri is forced to produce the same values as the old const eval.
* This does **not** touch the const evaluator in trans at all. That will come in a future PR.
* This does **not** cause any code to compile that didn't compile before. That will also come in the future
It would be great if someone could start a crater run if travis passes
@bors

bors commented Dec 14, 2017

Copy link
Copy Markdown
Collaborator

☀️ Test successful - status-appveyor, status-travis
Approved by: eddyb
Pushing 2974104 to master...

@vn971

Copy link
Copy Markdown
Contributor

Hi, is there any reason why .editorconfig was removed? See first changed file in acdf83f
CC @oli-obk

@oli-obk

Copy link
Copy Markdown
ContributorAuthor

I don't remember... sorry

@vn971vn971 mentioned this pull request Jan 22, 2021
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

15 participants

@oli-obk@eddyb@arielb1@bors@RalfJung@aidanhs@Mark-Simulacrum@carols10cents@kennytm@steveklabnik@lqd@alexcrichton@vn971@hanna-kruppe@dwrensha