Skip to content
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

Fix optimization of seqcst RMWs in OptimizeInstructions #7280

Merged
merged 1 commit into from
Feb 7, 2025

Conversation

tlively
Copy link
Member

@tlively tlively commented Feb 7, 2025

We previously reasoned that RMWs that do not change in-memory values
could be optimized to just atomic gets because they did not necessarily
synchronize with subsequent atomic reads of the same location. This is
not correct for seqcst RMWs, though, since subsequent seqcst reads in
the total order of seqcst operations are required to read from and
synchronize with these RMWs, even though they do not change the
in-memory values. Fix the optimization to only work on acquire-release
RMWs and RMWs to unshared memory.

We previously reasoned that RMWs that do not change in-memory values
could be optimized to just atomic gets because they did not necessarily
synchronize with subsequent atomic reads of the same location. This is
not correct for seqcst RMWs, though, since subsequent seqcst reads in
the total order of seqcst operations are _required_ to read from and
synchronize with these RMWs, even though they do not change the
in-memory values. Fix the optimization to only work on acquire-release
RMWs and RMWs to unshared memory.
@tlively tlively requested a review from kripken February 7, 2025 01:25
@tlively tlively merged commit 088b103 into main Feb 7, 2025
14 checks passed
@tlively tlively deleted the fix-optimizeinst-rmw-seqcst branch February 7, 2025 18:21
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.

2 participants