-
Couldn't load subscription status.
- Fork 400
Add 2+2W litmus test #4641
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
Add 2+2W litmus test #4641
Conversation
|
Thank you for contributing to Miri! |
| /// 2+2W variant https://johnwickerson.github.io/papers/memalloy.pdf §4.1 | ||
| /// 3 SC + 1 Rel is the strongest ordering to still observe x==y==1 | ||
| fn two_w_two_w() { | ||
| check_all_outcomes([1, 1], || { |
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.
This only checks y, and it checks that that is always 1...?
The slice here is the set of all outcomes, so [1, 1] is equivalent to [1].
| x.load(Relaxed) | ||
| }); | ||
| let t2 = spawn(move || { | ||
| y.store(1, Release); | ||
| x.store(2, SeqCst); | ||
| y.load(Relaxed) |
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.
Your code doesn't match the cppmem code. It should be:
| x.load(Relaxed) | |
| }); | |
| let t2 = spawn(move || { | |
| y.store(1, Release); | |
| x.store(2, SeqCst); | |
| y.load(Relaxed) | |
| y.load(Relaxed) | |
| }); | |
| let t2 = spawn(move || { | |
| y.store(1, Release); | |
| x.store(2, SeqCst); | |
| x.load(Relaxed) |
|
As noted on Zulip, the test is wrong: the @rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
Add 2+2W litmus tests with the strongest ordering that still allows observing
x==y==1Equivalent cppmem code: