rust-lang / miri

An interpreter for Rust's mid-level intermediate representation
Apache License 2.0
4.14k stars 318 forks source link

Add a benchmark for creating large uninit allocations #3638

Closed saethlin closed 1 month ago

saethlin commented 1 month ago

Extracted from https://github.com/rust-lang/miri/issues/3637

I used this program to confirm that https://github.com/rust-lang/rust/pull/125633 has the desired effect.

saethlin commented 1 month ago

That is strange. The only docs I can find suggest this should fit comfortably on a GitHub-hosted runner: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories

RalfJung commented 1 month ago

Note that on Windows we're using a 32bit target as the host. Not sure how Windows manages the address space there, maybe it keeps half of it for the kernel so there's only 2GB total for the program?

RalfJung commented 1 month ago

So probably it would make sense to decrease the allocation size to 1GB if the pointer_width is 32.

saethlin commented 1 month ago

Right. I was trying to avoid doing that because the effect size shrinks, but of course a little loop fixes that.

RalfJung commented 1 month ago

How long does the benchmark take (with the fix)?

RalfJung commented 1 month ago

https://github.com/rust-lang/rust/pull/125633 landed, but a ./miri rustc-pull will be needed before we have it available in the repo.

saethlin commented 1 month ago

How long does the benchmark take (with the fix)?

200 ms per iteration with the fix. Without the fix, it's 800 ms per iteration. So I think it would be fair to land this without the fix, because it's already one of our faster benchmarks.

RalfJung commented 1 month ago

Makes sense, thanks! @bors r+

bors commented 1 month ago

:pushpin: Commit 88a24967c6cbb08adb52aa3e6b8ea515d7d7cd35 has been approved by RalfJung

It is now in the queue for this repository.

bors commented 1 month ago

:hourglass: Testing commit 88a24967c6cbb08adb52aa3e6b8ea515d7d7cd35 with merge 952aa4d59772d3c0f7de5313392e28e8fec75302...

bors commented 1 month ago

:sunny: Test successful - checks-actions Approved by: RalfJung Pushing 952aa4d59772d3c0f7de5313392e28e8fec75302 to master...