-
Notifications
You must be signed in to change notification settings - Fork 386
Isolate MiriMachine memory from Miri's #4343
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
base: master
Are you sure you want to change the base?
Conversation
@rustbot ready |
1520f81
to
6cbc283
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! I left some first comments, but this is not a full review. I'd rather not reverse-engineer the invariants of MachineAlloc
myself, so I'll wait for you to document them, which will make review a lot easier.
Furthermore, all pub fn
in discrete_alloc
should have proper doc comments, not just a safety comment. Please also add some basic unit tests -- we don't use them much in Miri, but this is one of the cases where they would make sense.
On Zulip you mentioned some benchmarks. Can you put benchmark results for the variant that you ended up going for here into the PR?
Co-authored-by: Ralf Jung <[email protected]>
@rustbot author |
Reminder, once the PR becomes ready for a review, use |
I'll post benchmarks in a bit! I realised there might be some speed gains to be made with very simple changes, so I'll just experiment a little first. Thanks for the comments ^^ |
Baseline is set to having the allocator fully disabled. It's only marginally slower in most cases, though it struggles with large allocations it seems. I wonder how much work it would be to improve that, but if we go down the "only machines using this will touch it" path I hope it's not too bad? I got a slight (~4%) improvement from calling
|
Yes. A 32x slowdown with big allocations is hefty.^^ Shouldn't those just forward to |
It does mostly do that, which is what's confusing me... I'll try to fix it, I assume I just missed something really obvious. |
I checked; seems like the
I might be able to squeeze a bit more perf out by actually making the functions generic instead of just passing in a function pointer but shrug, unsure if it's necessary |
Ah yes, that is exactly why we added that particular benchmark. :) |
What kind of unit tests do you think belong here? I assumed functionality is covered by the usual tests, but I'll happily add in some stuff if you think it's relevant |
Similar to |
Openen the PR on the main repo, |
Expecting the build to fail for now since it's adapted to the changes from the PR (but also Miri seems to be having trouble on the current upstream master commit, so I guess it's pending that being fixed too) |
Tests added :D let me know if there's anything more to do |
☔ The latest upstream changes (possibly #4349) made this pull request unmergeable. Please resolve the merge conflicts. |
Based on discussion surrounding #4326, this merges in the (very simple) discrete allocator that the MiriMachine will have. See the design document linked there there for considerations, but in brief: we could pull in an off the shelf allocator for this, but performance isn't a massive worry and doing it this way might make it easier to enable support for doing multi-seeded runs in the future (without a lot more extraneous plumbing, at least)