Skip to content

Conversation

Patrick-6
Copy link
Contributor

This PR switches to using a new GenMC commit containing a temporary implementation of temporal mixing of atomics/non-atomics in GenMC. The API for this change should be identical to the one that will be in the official GenMC release once it is ready.

Which this PR, initializing writes are no longer required and were removed from all tests.
We can now also support using fn main() {} and std::sync::Arc in GenMC mode!

@rustbot
Copy link
Collaborator

rustbot commented Sep 30, 2025

Thank you for contributing to Miri!
Please remember to not force-push to the PR branch except when you need to rebase due to a conflict or when the reviewer asks you for it.

@rustbot rustbot added the S-waiting-on-review Status: Waiting for a review to complete label Sep 30, 2025
Copy link
Member

@RalfJung RalfJung left a comment

Choose a reason for hiding this comment

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

Hardly any code changes and removing lots of hacks in the tests, that's the kind of PR I like. :)

View changes since this review

Copy link
Member

Choose a reason for hiding this comment

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

Feels a bit arbitrary to use this random existing test to check the thread::spawn APIs. This is fully subsumed by tests/genmc/pass/thread/spawn_std_threads.rs, isn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah we don't need it, I've removed the changes.

// FIXME(genmc,HACK): remove this initializing write once Miri-GenMC supports mixed atomic-non-atomic accesses.
x.store(123, ORD);

// MAX, ADD
Copy link
Member

Choose a reason for hiding this comment

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

Looks like you removed a bit too much here, this comment should stay.

Copy link
Member

Choose a reason for hiding this comment

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

arc isn't really a "primitive". It's just a library construct.

Maybe have a folder std to check various std things (main, thread::spawn, thread_local, Arc)? Those tests should all use normal Rust APIs then, no pthread APIs and no miri_start.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Are there any existing tests that should be in the genmc/pass/std/ directory, e.g., pass/thread/thread_locals.rs?

Also, my next PR will be std::sync::Mutex interception, should tests for that be in the pass/intercept or the pass/std directory?

Copy link
Member

Choose a reason for hiding this comment

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

Are there any existing tests that should be in the genmc/pass/std/ directory, e.g., pass/thread/thread_locals.rs?

Yeah that one would make sense to move.

Also, my next PR will be std::sync::Mutex interception, should tests for that be in the pass/intercept or the pass/std directory?

Hm, no strong opinion. intercept is fine.

Copy link
Member

Choose a reason for hiding this comment

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

As I said above:

Those tests should all use normal Rust APIs then, no pthread APIs and no miri_start.

@RalfJung
Copy link
Member

RalfJung commented Oct 1, 2025

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: Waiting for the PR author to address review comments and removed S-waiting-on-review Status: Waiting for a review to complete labels Oct 1, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 1, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@RalfJung
Copy link
Member

RalfJung commented Oct 1, 2025

This looks great, thanks! Please squash the commits using ./miri squash. Then write @rustbot ready after you force-pushed the squashed PR.

@rustbot author

…n GenMC mode.

Remove atomic initialization dummy writes from tests.
@Patrick-6 Patrick-6 force-pushed the miri-genmc-temporal-mixing branch from 28acc86 to 57a7380 Compare October 1, 2025 10:37
@Patrick-6
Copy link
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Waiting for a review to complete and removed S-waiting-on-author Status: Waiting for the PR author to address review comments labels Oct 1, 2025
@RalfJung RalfJung enabled auto-merge October 1, 2025 11:32
@RalfJung RalfJung added this pull request to the merge queue Oct 1, 2025
Merged via the queue into rust-lang:master with commit 0aefe34 Oct 1, 2025
24 of 26 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Waiting for a review to complete label Oct 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants